Generate all distribution files
@private
340248
function dist() {
	if (test('-d', DIST_DIR)) {
		rm('-r', DIST_DIR + '*');
	} else {
		mkdir(DIST_DIR);
	}

	[{
		name: DIST_NATIVE_NAME,
		files: SRC_NATIVE_FILES,
		testingFiles: TESTING_NATIVE_FILES
	}, {
		name: DIST_JQUERY_NAME,
		files: SRC_JQUERY_FILES,
		testingFiles: TESTING_JQUERY_FILES
	}, {
		name: DIST_NAME,
		files: SRC_NATIVE_FILES,
		testingFiles: TESTING_NATIVE_FILES
	}].forEach(function(config){
		generateDistFiles(config);
	});
}
1083235
def generateZipFile(self, outpath='.'):
        
        fname = self.installName() + '.zip'
        outfile = os.path.abspath(os.path.join(outpath, fname))

        # clears out the exiting archive
        if os.path.exists(outfile):
            try:
                os.remove(outfile)
            except OSError:
                log.warning('Could not remove zipfile: %s', outfile)
                return False

        # generate the zip file
        zfile = zipfile.ZipFile(outfile, 'w')

        # zip up all relavent fields from the code base
        if os.path.isfile(self.sourcePath()):
            zfile.write(self.sourcePath(), os.path.basename(self.sourcePath()))
        else:
            basepath = os.path.abspath(os.path.join(self.sourcePath(), '..'))
            baselen = len(basepath) + 1
            for root, folders, filenames in os.walk(basepath):
                # ignore hidden folders
                if '.svn' in root or '.git' in root:
                    continue

                # ignore setuptools build info
                part = root[baselen:].split(os.path.sep)[0]
                if part in ('build', 'dist') or part.endswith('.egg-info'):
                    continue

                # include files
                for filename in filenames:
                    ext = os.path.splitext(filename)[1]
                    if ext in self.ignoreFileTypes():
                        continue

                    arcroot = root[baselen:].replace('\\', '/')
                    arcname = os.path.join(arcroot, filename)
                    log.info('Archiving %s...', arcname)
                    zfile.write(os.path.join(root, filename), arcname)

        zfile.close()
        return True
742342
function generate (projectPatch, source, done) {
  shell.mkdir('-p', projectPatch)
  shell.cp('-Rf', source, projectPatch)
  done()
}
149125
function compressDistributionPackage() {
  const src = [
    path.join(__dirname, 'build/**'),
    path.join(__dirname, 'LICENSE'),
    path.join(__dirname, 'CHANGELOG.md'),
    path.join(__dirname, 'bindings/*/esm/**'),
    path.join(__dirname, 'bindings/*/dist/**'),
    '!' + path.join(__dirname, 'build/docs/**'),
    '!' + path.join(__dirname, 'build/docs'),
  ];

  return gulp.src(src)
    .pipe($.zip('onsenui.zip'))
    .pipe(gulp.dest(path.join(__dirname, 'build')));
}
1144830
function save(template, distpath) {
  var data = generate(template);
  var dir = path.dirname(distpath);

  mkdirp(dir, function(err) {
    if(err) {
      console.log(err.message);
      return;
    }

    fs.writeFile(distpath, JSON.stringify(data, null, 2), function(err) {
      if(err) {
        console.log(err.message);
        return;
      }
    });

  });

}
55054
function generateNSISScript(files, callback) {
    sys.puts('Generating NSIS script');
    var installFileList = '  SetOverwrite try\n',
        removeFileList  = '',
        removeDirList   = '';

    files = files.filter(function(file) {
        // Ignore node-builds for other platforms
        if (~file.indexOf('node-builds') && !~file.indexOf('cyg') && !~file.indexOf('tmp') && !~file.indexOf('etc')) {
            return;
        }

        return file;
    });


    // Generate the install and remove lists
    var prevDirname, i, len;
    for (i = 0, len = files.length; i < len; i++) {
        var file = files[i];
        var dirname = path.dirname(file);

        if (dirname != prevDirname) {
            prevDirname = dirname;
            installFileList += '  SetOutPath "$INSTDIR\\' + dirname.replace(/\//g, '\\') + '"\n';
            removeDirList  += '  RMDir "$INSTDIR\\' + dirname.replace(/\//g, '\\') + '"\n';
        }

        var m;
        if ((m = file.match(/\/?(README|LICENSE)(.md)?$/))) {
            // Rename README and LICENSE so they end in .txt
            installFileList += '  File /oname=' + m[1] + '.txt "${ROOT_PATH}\\' + file.replace(/\//g, '\\') + '"\n';
        } else {
            installFileList += '  File "${ROOT_PATH}\\' + file.replace(/\//g, '\\') + '"\n';
        }
        removeFileList  += '  Delete "$INSTDIR\\' + file.replace(/\//g, '\\') + '"\n';
    }


    var tmp = new Template(fs.readFileSync(path.join(__dirname, 'installer_nsi.template'), 'utf8'));
    var data = tmp.substitute({
        root_path: path.join(__dirname, '../..'),
        output_path: OUTPUT_PATH,
        version: 'v' + VERSION,
        install_file_list: installFileList,
        remove_file_list: removeFileList,
        remove_dir_list: removeDirList
    });

    callback(data);
}
28366
def distribute(build):
    
    build.packages.install("wheel")
    build.packages.install("twine")
    build.executables.run([
        "python", "setup.py",
        "sdist", "bdist_wheel", "--universal", "upload",
    ])
    build.executables.run([
        "twine", "upload", "dist/*"
    ])
471555
function generateLayers () {
			grunt.log.write("Generating layers...");

			var config = lang.extend({}, requireConfig, {
				isPrepareStage: true,
				optimize: "none",
				optimizeCss: "none",
				appDir: buildDir,
				dir: tempDir,
				baseUrl: "./",
				logLevel: 2, // WARN
				removeCombined: false,
				skipDirOptimize: true,
				keepBuildDir: false,
				skipSemiColonInsertion: true,
				pragmas: {
					prepare: true,
					build: true
				},
				// Pragmas for rjs plugins:
				pragmasOnSave: {
					prepareSave: true
				},
				// main (root) modules:
				modules: modules.map(function (module) { return { name: module }; }),
				onBuildWrite: function (moduleName, modulePath, contents) {
					// put moduleName into some layer basing on its path
					layers.some(function (layer) {
						var relPath = path.relative(path.resolve(config.dir), modulePath);
						var layerDir = layer.dir;
						if (!Array.isArray(layerDir)) {
							layerDir = [layerDir];
						}
						layerDir.forEach(function(dir) {
							if (relPath.indexOf(dir) === 0) {
								if (options.ignoreModules) {
									if (options.ignoreModules.some(function (m) {
										return m === moduleName;
									})) {
										return;
									}
								}
								layer.modules[moduleName] = true;
							}
						});
					});
					if (moduleName.indexOf('xhtmpl!') === 0) {
						modulesToDelete.push(path.join(outputDir, modulePath.slice('xhtmpl!'.length)));

						// Manually save pre-compiled template back into buildDir as
						// we're currently saving into tempDir (that's why we can't rely on returning content)

						// NOTE: manually remove leading semicolon
						// TODO: the code should be removed after migrating on 2.1.9 (with skipSemiColonInsertion support)
						if (contents.charAt(contents.length-1) === ";") {
							contents = contents.slice(0, contents.length-1);
						}
						file.saveFile(path.join(buildDir, modulePath.slice('xhtmpl!'.length)), contents);
					}
					//return contents;
					return "// this is a stub for finding layer's dependencies: moduleName=" + moduleName;
				}
			});

			requirejs.optimize(
				config,
				lang.safeCallback(function () {
					// create layer modules using 'layers' structure created in onBuildWrite:
					// every 'layer module' is an empty RJS module with imports (via define([..])) of all modules inside this layer
					layers.forEach(function (layer) {
						var modules = Object.keys(layer.modules).sort(),
							content = "define([\n\t\"" + modules.join("\",\n\t\"") + "\"\n], function () {});";
						file.saveFile(path.join(buildDir, layer.name) + ".js", content);
					});

					grunt.log.writeln('OK'.green);

					// Go to next step
					optimizeModules();
				}),
				lang.errorCallback
			);
		}
164258
function generateUtilityFiles(next) {
    fs.copy(path.join(getConfig('template.folder'), 'index.js'), path.join(getConfig('output.folder'), 'index.js'), function (err) {
        if (err) { next(err); return; }
        if (getConfig('output.log')) { logger.info('(Created) Index file: ' + path.resolve(path.join(getConfig('output.folder'), 'index.js'))); }
        fs.copy(path.join(getConfig('template.folder'), '..', 'utils.js'), path.join(getConfig('output.folder'), 'utils.js'), function (err) {
            if (err) { next(err); return; }
            next(null);
        });
    });
    try {
        overriddenAliases = require(path.join(process.cwd(), getConfig('output.folder'), 'alias.json'));
    } catch (ignore) {}
}
1039664
def build_distribution():
    """"""
    result = invoke.run('python setup.py sdist bdist_egg bdist_wheel',
                        warn=True, hide=True)
    if result.ok:
        print("[{}GOOD{}] Distribution built without errors."
              .format(GOOD_COLOR, RESET_COLOR))
    else:
        print('[{}ERROR{}] Something broke trying to package your '
              'code...'.format(ERROR_COLOR, RESET_COLOR))
        print(result.stderr)
        sys.exit(1)
609576
function build_dist_sourcemap(){
  // run webpack
  return gulp.src('index.js').pipe(webpackStream(createWebpackConfig({
    mode: 'development',
    entry: classicEntry,
    output: {
        filename:'oidc-client.js',
        libraryTarget:'var',
        library:'Oidc'
    },
    plugins: [],
    devtool:'inline-source-map'
  }), webpack))
  .pipe(gulp.dest('dist/'));
}
1067715
function distJsFiles() {
        return [{src: cog.pathDist() + cog.getConfig('name') + '.js', dst: cog.pathDist() + cog.getConfig('name') + '.min.js'}];
    }
842852
function createFiles (files, argv, templates, cb) {
  if (!templates) {
    const parent = path.resolve(module.parent.filename)
    templates = path.join(parent, '../templates')
  }

  const dir = argv.directory
  parallel(files.map(mapFn), cb)

  function mapFn (file) {
    const tempDir = path.resolve(templates)
    const inFile = path.join(tempDir, file.replace(/^\./, '_.'))
    const outFile = path.resolve(path.join(dir, file))

    return function (done) {
      fs.createReadStream(inFile)
        .pipe(through(transform))
        .pipe(fs.createWriteStream(outFile))
        .on('error', done)
        .on('finish', function () {
          process.stdout.write('write: ' + outFile + '\n')
          done()
        })

      function transform (chunk, enc, cb) {
        const str = chunk.toString()
        const mt = mustache.render(str, argv)
        cb(null, mt)
      }
    }
  }
}
17823
protected function generateFiles()
    {
        foreach ($this->files as $key => $file) {
            $file = $this->formatContent($file);

            $this->makeFile($key, $file);
        }
    }
901678
function() {
			var corePath = __dirname + "/../src/core.js",
				contents = fs.readFileSync( corePath, "utf8" );
			contents = contents.replace( /@VERSION/g, Release.newVersion );
			fs.writeFileSync( corePath, contents, "utf8" );
		}
455108
function generate(target, data, done) {
        var files = this.files,
            dest = null,
            paths = [],
            promises = [],
            folders = [];

        //by default, we generate a table of contents called readme.md
        var options = this.options({
            contentsEnabled: true,
            contentsFile: 'readme.md',
            contentsTitle: 'Documentation',
            templateDir: null
        });

        //map the list of files we'll be generating documentation for
        files.forEach(function(group) {
            dest = group.dest;
            group.src.filter(function(file) {
                var obj = {
                    filename: path.basename(file),
                    folder: path.dirname(file),
                    path: file
                };

                if(options.pathFilter)
                    obj.folder = obj.folder.replace(options.pathFilter, '');

                folders.push(obj);
            });
        });

        //map the set of folders, sort, and generate documentation
        folders = _(folders)
            .groupBy(function(p) { return p.folder; })
            .sortBy(function(p) { return p.length && p[0].folder; })
            .map(function(group) {
                var file = group.length && group[0] || {};
                return {
                    name: file.folder,
                    path: file.path.replace(file.filename, ''),
                    files: group,
                    fileData: {}
                };
            })
            .each(function(folder) {
                var def = Q.defer();

                //queue the promise for the docs, and ensure the target exists (can safely run on an existing folder)
                promises.push(def.promise);
                grunt.file.mkdir(dest +'/'+ folder.name);

                //generate the docs for the folder, resolving the promise when complete
                jsdox.generateForDir(folder.path, dest +'/'+ folder.name, options.templateDir, def.resolve, function(file, fileData) {
                    folder.fileData[file] = fileData;
                });
            });

        //when all docs have been generated, build the table of contents, if needed (this stuff should be moved into a template)
        Q.all(promises).then(function() {
            if(!options.contentsEnabled) return done();

            var buf = [],
                w = function() { buf.push.apply(buf, arguments); };

            w(options.contentsTitle || 'Documentation', '===');

            folders.forEach(function(folder) {
                var docs = [];

                //derive the set of documents we *actually* generated docs for; that way we only add documented
                //code to the table of contents
                folder.files.forEach(function(file) {
                    //reset the path, pointing to the markdown file, and set the file data parsed by jsdox
                    file.path = path.join(file.folder, file.filename.replace('.js', '')).replace(/^\//, '');
                    file.data = folder.fileData[file.filename]||{};
                    if(grunt.file.exists(dest, file.path + '.md')) docs.push(file);
                });

                if(docs.length > 0) {
                    w(folder.name || 'Root', '---');
                    w('name | overview', ':-- | :--');
                    docs.forEach(function(file) {
                        w('['+ file.path +'.js]('+ file.path + '.md' + ') | '+ (file.data.overview?'_'+ file.data.overview +'_':''));
                    });
                    w('- - -');
                }

                w('\n');
            });

            //write out the table of contents, and complete the async generate task
            fs.writeFileSync(path.join(dest, (options.contentsFile || 'readme.md')), buf.join('\n'));
            done();
        });
    }
1053677
function build_dist_min(){
  // run webpack
  return gulp.src('index.js').pipe(webpackStream(createWebpackConfig({
    mode: 'production',
    entry: classicEntry,
    output: {
        filename:'oidc-client.min.js',
        libraryTarget:'var',
        library:'Oidc'
    },
    plugins: [],
    devtool: false,
    optimization: {
      minimizer: [
        new UglifyJsPlugin({
          uglifyOptions: {
            keep_fnames: true
          }
        })
      ]
    }
  }), webpack))
  .pipe(gulp.dest('dist/'));
}