Function to publish staging or prod version from local tree,
or to promote staging to prod, per passed arg.
@param {string} pubScope the scope to publish to.
339
function mdlPublish(pubScope) {
  let cacheTtl = null;
  let src = null;
  let dest = null;

  if (pubScope === 'staging') {
    // Set staging specific vars here.
    cacheTtl = 0;
    src = 'dist/*';
    dest = bucketStaging;
  } else if (pubScope === 'prod') {
    // Set prod specific vars here.
    cacheTtl = 60;
    src = 'dist/*';
    dest = bucketProd;
  } else if (pubScope === 'promote') {
    // Set promote (essentially prod) specific vars here.
    cacheTtl = 60;
    src = `${bucketStaging}/*`;
    dest = bucketProd;
  }

  let infoMsg = `Publishing ${pubScope}/${pkg.version} to GCS (${dest})`;
  if (src) {
    infoMsg += ` from ${src}`;
  }
  console.log(infoMsg);

  // Build gsutil commands:
  // The gsutil -h option is used to set metadata headers.
  // The gsutil -m option requests parallel copies.
  // The gsutil -R option is used for recursive file copy.
  const cacheControl = `-h "Cache-Control:public,max-age=${cacheTtl}"`;
  const gsutilCacheCmd = `gsutil -m setmeta ${cacheControl} ${dest}/**`;
  const gsutilCpCmd = `gsutil -m cp -r -z html,css,js,svg ${src} ${dest}`;

  gulp.src('').pipe($.shell([gsutilCpCmd, gsutilCacheCmd]));
}
960848
function (version, args, pipe) {
        let spawnOpts = { cwd: ForestInternal.elmRoot(version) };
        let buffers = [];
        return new Promise((resolve, reject) => {
            let child = child_process_1.spawn('npm', args, spawnOpts);
            if (pipe) {
                child.stdout.pipe(process.stdout);
                child.stderr.pipe(process.stderr);
                process.stdin.pipe(child.stdin);
                process.stdin.resume();
            }
            child.stdout.on('data', (data) => {
                buffers.push(data);
            });
            child.on('close', (code) => {
                if (pipe) {
                    process.stdin.pause();
                    process.stdin.unpipe();
                }
                if (code === 0) {
                    let str = Buffer.concat(buffers).toString('utf-8');
                    return resolve(str);
                }
                // Use reject instead of throw here because we are in a callback
                reject(new ForestError(Errors.NpmCommandFailed, `npm command failed with exit code ${code}`, code));
            });
        }).catch((err) => {
            if (err instanceof ForestError) {
                throw err;
            }
            else {
                throw new ForestError(Errors.NpmRunFailed, err);
            }
        });
    }
1305300
function assertNode6PublishingPrerequisite() {
    return node.getNodeInfos().then((nodeInfos) => {
        if (nodeInfos.isAtLeastNode6 && nodeInfos.isSafeNpm) {
            return Promise.resolve();
        }
        throw new Error(
            `npm@${
                nodeInfos.npmVersion
            } has known issues publishing when running Node.js 6. Please upgrade npm or downgrade Node and publish again. See: https://github.com/npm/npm/issues/5082`
        );
    });
}
801403
def pub_upload(args, location=None, prefix=""):
    
    upload(location, remotes=args, prefix=prefix)
1314841
function publishNpm(pck) {
	var pkg = null, auth = [], npm = null;
	if (pck.commit.hasNpmToken && pck.commit.pkgPath) {
		try {
			npm = require('npm');
		} catch (e) {
			pck.rollCall.error('npm publish failed because npm module is not found (use "npm link npm")', e).resume();
			return;
		}
		rbot.log.info('Publishing to npm');
		go();
	} else {
		rbot.log.verbose('Skipping npm publish for ' + pck.commit.pkgPath + ' version ' + pck.commit.version);
	}
	function go() {
		var pd = pck.commit.versionPkg({
			replacer : pck.options.pkgJsonReplacer,
			space : pck.options.pkgJsonSpace,
			readOnly : true
		});
		pkg = pd.pkg;
		if (!pkg || !pkg.author || !pkg.author.email) {
			pck.rollCall.error('npm publish failed due to missing author.email in ' + pck.commit.pkgPath);
		} else {
			auth = (typeof pck.commit.npmToken === 'function' ? pck.commit.npmToken() : pck.commit.npmToken);
			auth = typeof auth === 'string' && (auth = new Buffer(auth, 'base64').toString()) ? auth.split(':') : [];
			if (auth.length !== 2) {
				pck.rollCall.error('npm NPM_TOKEN is missing or invalid');
			} else {
				pck.rollCall.pause(function() {
					npm.load({}, function(e) {
						if (e) {
							pck.rollCall.error('npm load failed', e).resume();
						} else {
							pck.rollCall.pause(adduser);
						}
					});
				});
			}
		}
	}
	function adduser() {
		npm.config.set('email', pkg.author.email, 'user');
		npm.registry.adduser(pck.options.npmRegistryURL, auth[0], auth[1], pkg.author.email, aucb);
		function aucb(e) {
			if (e) {
				pck.rollCall.error('npm publish failed to be authenticated', e).resume();
			} else {
				pck.rollCall.pause(pub);
			}
		}
	}
	function pub() {
		var pargs = [];
		if (pck.options.npmTag) {
			pargs.push('--tag ' + pck.options.npmTag);
		}
		rbot.log.info('npm publish ' + pargs.join(' '));
		// switch to the master branch so publish will pickup the right version
		pck.command.chkoutCmd(pck.commit.branch);
		npm.commands.publish(pargs, function(e) {
			if (e) {
				pck.rollCall.error('npm publish failed', e).resume();
			} else {
				pck.rollCall.pause(postPub);
			}
		});
		function postPub() {
			pck.command.chkoutRun(null, function() {
				rbot.log.verbose('npm publish complete');
				pck.rollCall.resume();
			});
		}
	}
}
1037224
public void addScope(IScope scope) {
        String app = scope.getName();
        // add the name to the collection (no '/' prefix)
        activeRooms.add(app);
        // check the context for a predefined websocket scope
        IContext ctx = scope.getContext();
        if (ctx != null && ctx.hasBean("webSocketScopeDefault")) {
            log.debug("WebSocket scope found in context");
            WebSocketScope wsScope = (WebSocketScope) scope.getContext().getBean("webSocketScopeDefault");
            if (wsScope != null) {
                log.trace("Default WebSocketScope has {} listeners", wsScope.getListeners().size());
            }
            // add to scopes
            scopes.put(String.format("/%s", app), wsScope);
        } else {
            log.debug("Creating a new scope");
            // add a default scope and listener if none are defined
            WebSocketScope wsScope = new WebSocketScope();
            wsScope.setScope(scope);
            wsScope.setPath(String.format("/%s", app));
            if (wsScope.getListeners().isEmpty()) {
                log.debug("adding default listener");
                wsScope.addListener(new DefaultWebSocketDataListener());
            }
            notifyListeners(WebSocketEvent.SCOPE_CREATED, wsScope);
            // add to scopes
            addWebSocketScope(wsScope);
        }
    }
237872
def publish(branch, path = Dir.pwd, remote = 'origin')
      exit_status = 1
      error "no branch provided" if branch.nil?
      #remotes  = FalkorLib::Git.remotes(path)
      branches = FalkorLib::Git.list_branch(path)
      Dir.chdir(FalkorLib::Git.rootdir( path ) ) do
        if branches.include? "remotes/#{remote}/#{branch}"
          warning "the  remote branch '#{remote}/#{branch}' already exists"
        else
          info "Publish the branch '#{branch}' on the remote '#{remote}'"
          exit_status = run %(
                          git push #{remote} #{branch}:refs/heads/#{branch}
                          git fetch #{remote}
                          git branch -u #{remote}/#{branch} #{branch}
                )
        end
      end
      exit_status
    end
204446
def publish_repo(self, repo, env):
        
        _r = self.connectors[env].post('/repositories/%s-%s/actions/publish/' % (repo, env), {'id': 'yum_distributor'})
        if _r.status_code != Constants.PULP_POST_ACCEPTED:
            _r.raise_for_status()
        else:
            juicer.utils.Log.log_info("`%s` published in `%s`" % (repo, env))
852818
def publish(**kwargs):
    

    current_version = get_current_version()
    click.echo('Current version: {0}'.format(current_version))
    retry = kwargs.get("retry")
    debug('publish: retry=', retry)
    if retry:
        # The "new" version will actually be the current version, and the
        # "current" version will be the previous version.
        new_version = current_version
        current_version = get_previous_version(current_version)
    else:
        level_bump = evaluate_version_bump(current_version, kwargs['force_level'])
        new_version = get_new_version(current_version, level_bump)
    owner, name = get_repository_owner_and_name()

    ci_checks.check('master')
    checkout('master')

    if version(**kwargs):
        push_new_version(
            gh_token=os.environ.get('GH_TOKEN'),
            owner=owner,
            name=name
        )

        if config.getboolean('semantic_release', 'upload_to_pypi'):
            upload_to_pypi(
                username=os.environ.get('PYPI_USERNAME'),
                password=os.environ.get('PYPI_PASSWORD'),
                # We are retrying, so we don't want errors for files that are already on PyPI.
                skip_existing=retry,
            )

        if check_token():
            click.echo('Updating changelog')
            try:
                log = generate_changelog(current_version, new_version)
                post_changelog(
                    owner,
                    name,
                    new_version,
                    markdown_changelog(new_version, log, header=False)
                )
            except GitError:
                click.echo(click.style('Posting changelog failed.', 'red'), err=True)

        else:
            click.echo(
                click.style('Missing token: cannot post changelog', 'red'), err=True)

        click.echo(click.style('New release published', 'green'))
    else:
        click.echo('Version failed, no release will be published.', err=True)
780570
function publish( data ) {
	var root;
	var docs;

	// Remove undocumented doclets:
	data( opts ).remove();

	// Retrieve an array of raw doclet objects:
	docs = data().get();

	// Transform the raw doclet array:
	root = {};
	transform( root, docs );

	// Write to stdout:
	console.log( JSON.stringify( root ) );
}
541904
function handleArguments(env) {

  // This translates the --continue flag in gulp
  // To the settle env variable for undertaker
  // We use the process.env so the user's gulpfile
  // Can know about the flag
  if (opts.continue) {
    process.env.UNDERTAKER_SETTLE = 'true';
  }

  if (opts.help) {
    parser.showHelp(console.log);
    exit(0);
  }

  // Anything that needs to print outside of the logging mechanism should use console.log
  if (opts.version) {
    console.log('CLI version:', cliVersion);
    console.log('Local version:', env.modulePackage.version || 'Unknown');
    exit(0);
  }

  if (opts.verify) {
    var pkgPath = opts.verify !== true ? opts.verify : 'package.json';
    /* istanbul ignore else */
    if (path.resolve(pkgPath) !== path.normalize(pkgPath)) {
      pkgPath = path.join(env.cwd, pkgPath);
    }
    log.info('Verifying plugins in ' + pkgPath);
    return getBlacklist(function(err, blacklist) {
      /* istanbul ignore if */
      if (err) {
        return logBlacklistError(err);
      }

      var blacklisted = verifyDeps(require(pkgPath), blacklist);

      logVerify(blacklisted);
    });
  }

  if (!env.modulePath) {
    /* istanbul ignore next */
    var missingNodeModules =
      fs.existsSync(path.join(env.cwd, 'package.json'))
      && !fs.existsSync(path.join(env.cwd, 'node_modules'));

    /* istanbul ignore next */
    var missingGulpMessage =
      missingNodeModules
        ? 'Local modules not found in'
        : 'Local gulp not found in';
    log.error(
      ansi.red(missingGulpMessage),
      ansi.magenta(tildify(env.cwd))
    );
    /* istanbul ignore next */
    var installCommand =
      missingNodeModules
        ? 'npm install'
        : 'npm install gulp';
    log.error(ansi.red('Try running: ' + installCommand));
    exit(1);
  }

  if (!env.configPath) {
    log.error(ansi.red('No gulpfile found'));
    exit(1);
  }

  // Chdir before requiring gulpfile to make sure
  // we let them chdir as needed
  if (process.cwd() !== env.cwd) {
    process.chdir(env.cwd);
    log.info(
      'Working directory changed to',
      ansi.magenta(tildify(env.cwd))
    );
  }

  // Find the correct CLI version to run
  var range = findRange(env.modulePackage.version, ranges);

  if (!range) {
    log.error(
      ansi.red('Unsupported gulp version', env.modulePackage.version)
    );
    exit(1);
  }

  // Load and execute the CLI version
  var versionedDir = path.join(__dirname, '/lib/versioned/', range, '/');
  require(versionedDir)(opts, env, env.configProps);
}
475145
function createPublisher(bucket) {
  // Access keys etc. are not needed in config as they
  // should be defined in the AWS credentials file.
  //
  // See:
  //   http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html
  //   https://www.npmjs.com/package/gulp-awspublish

  var config = {
    params: {
      'Bucket': bucket
    }
  };
  var publisher = awspublish.create(config);
  return publisher;
}
1318024
function setAndPublish(variableName, object, channel, option){

    client.set(variableName, JSON.stringify(object));
    // Publish that it did an update
    client.publish(channel, option);
}
184640
function publish() {
			if (!options.distBranch) {
				rbot.log.info('Skipping publishing from "' + pubSrcDir + '" to ' + pubDistDir + ' (no distBranch)');
				return;
			} else if (!commit.releaseId) {
				rbot.log.info('Skipping publishing from "' + pubSrcDir + '" to "' + pubDistDir + '" in branch "'
						+ options.distBranch + '" (no releaseId/tag)');
				return;
			}
			rbot.log.info('Publishing to branch "' + options.distBranch + '"');
			rbot.log.info('Copying publication directories/files from "' + pubSrcDir + '" to "' + pubDistDir + '"');
			// copy all directories/files over that need to be published
			// so that they are not removed by the following steps
			rbot.log.info(utils.copyRecursiveSync(pubSrcDir, pubDistDir, options.distExcludeDirRegExp,
					options.distExcludeFileRegExp).toString());
			// cmd('cp -r ' + path.join(pubSrcDir, '*') + ' ' + pubDistDir);
			chkoutRun(null, publishRun);
			function publishRun() {
				try {
					cmd('git fetch ' + options.repoName + ' ' + options.distBranch);
					pubHash = cmd('git rev-parse HEAD');
				} catch (e) {
					if (util.isRegExp(options.distBranchCreateRegExp) && options.distBranchCreateRegExp.test(e.message)) {
						cmd('git checkout -q --orphan ' + options.distBranch);
					} else {
						throw e;
					}
				}
				if (pubHash) {
					cmd('git checkout -q --track ' + options.repoName + '/' + options.distBranch);
				}
				cmd('git rm -rfq .');
				cmd('git clean -dfq .');
				rbot.log.info('Copying publication directories/files from "' + pubDistDir + '" to "' + commit.buildDir
						+ '"');
				rbot.log.info(utils.copyRecursiveSync(pubDistDir, commit.buildDir).toString());
				// cmd('cp -r ' + path.join(pubDistDir, '*') + '
				// .');

				// give taskateers a chance to update branch file
				// contents
				utils.updateFiles(options.distBranchUpdateFiles, options.distBranchUpdateFunction, commit.buildDir,
						rollCall.error);

				cmd('git add -A');
				cmd('git commit -q -m "' + tmpltData.distBranchPubMsg + '"');
				cmd('git push -f ' + options.repoName + ' ' + options.distBranch);

				rollCall.addRollback(rollbackPublish);
				rollCall.then(pack.publish);
			}
		}
1352888
@Override
	public void modifyScope(IAggregator aggregator, Object scope) {
		final String sourceMethod = "prepareEnv"; //$NON-NLS-1$
		boolean isTraceLogging = log.isLoggable(Level.FINER);
		if (isTraceLogging) {
			log.entering(BundleVersionsHash.class.getName(), sourceMethod, new Object[]{aggregator, scope});
		}
		FunctionObject fn = new FunctionObject((Scriptable)scope, this);
		ScriptableObject.putProperty((Scriptable)scope, propName, fn);
		if (isTraceLogging) {
			log.exiting(BundleVersionsHash.class.getName(), sourceMethod);
		}
	}
752125
function(node) {
				var scope = context.getScope(),
					features = context.ecmaFeatures || {};

				stack.push({
					init: true,
					node: node,
					valid: !(
						scope.isStrict ||
						node.sourceType === "module" ||
						(features.globalReturn && scope.childScopes[0].isStrict)
					)
				});
			}
239849
public function publishSingle()
    {
        $owner = $this->owner;
        // get the last published version
        $original = null;
        if ($this->isPublished()) {
            $original = self::get_by_stage($owner->baseClass(), self::LIVE)
                ->byID($owner->ID);
        }

        // Publish it
        $owner->invokeWithExtensions('onBeforePublish', $original);
        $owner->writeToStage(static::LIVE);
        $owner->invokeWithExtensions('onAfterPublish', $original);
        return true;
    }