Switch to given stage (dev/qa/production) + pull
502640
def switch(stage):
    
    stage = stage.lower()
    local("git pull")
    if stage in ['dev', 'devel', 'develop']:
        branch_name = 'develop'
    elif stage in ['qa', 'release']:
        branches = local('git branch -r', capture=True)
        possible_branches = []
        for b in branches.split("\n"):
            b_parts = b.split('/')
            if b_parts[1] == 'release':
                possible_branches.append(b_parts[2])
        if len(possible_branches) == 0:
            raise Exception('No release branches found. Please create a new release first.')
        possible_branches = sorted(possible_branches, reverse=True)
        branch_name = 'release/%s' % possible_branches[0]
    elif stage in ['production', 'master']:
        branch_name = 'master'
    else:
        raise NotImplemented
    local("git checkout %s" % branch_name)
    local("git pull")
1235551
def stage():
    """"""
    common_conf()
    env.user = settings.LOGIN_USER_STAGE
    env.machine = 'stage'
    env.host_string = settings.HOST_STAGE
    env.hosts = [env.host_string, ]
1066755
function(stage) {
      var fileStart = options.dir + '/' + stage;
      for (var ext in input) {
        if (grunt.file.exists(fileStart + '.' + ext)) {
          return true;
        }
      }
      return false;
    }
886007
public static void switchFocus (Stage stage, Focusable widget) {
		if (focusedWidget == widget) return;
		if (focusedWidget != null) focusedWidget.focusLost();
		focusedWidget = widget;
		if (stage != null) stage.setKeyboardFocus(null);
		focusedWidget.focusGained();
	}
1266310
async function changesToRelease () {
  const lastCommitWasRelease = new RegExp(`^Bump v[0-9.]*(-beta[0-9.]*)?(-nightly[0-9.]*)?$`, 'g')
  const lastCommit = await GitProcess.exec(['log', '-n', '1', `--pretty=format:'%s'`], gitDir)
  return !lastCommitWasRelease.test(lastCommit.stdout)
}
623743
function(floors, options, callback) {
                if(floors != null && floors.length > 0) {
                   _moveElevator(config, floors, options.ascending, logger, levelController, function(error) {
                        return callback(error, floors, options);
                    });
                } else {
                    return callback(null, null, null);
                }           
            }
783087
def update_stage_config(    self,
                                project_name,
                                stage_name,
                                cloudwatch_log_level,
                                cloudwatch_data_trace,
                                cloudwatch_metrics_enabled
                            ):
        
        if cloudwatch_log_level not in self.cloudwatch_log_levels:
            cloudwatch_log_level = 'OFF'

        for api in self.get_rest_apis(project_name):
            self.apigateway_client.update_stage(
                restApiId=api['id'],
                stageName=stage_name,
                patchOperations=[
                    self.get_patch_op('logging/loglevel', cloudwatch_log_level),
                    self.get_patch_op('logging/dataTrace', cloudwatch_data_trace),
                    self.get_patch_op('metrics/enabled', cloudwatch_metrics_enabled),
                ]
            )
1114053
def pull(self):
        """"""
        repo_root = settings.REPO_ROOT
        pull_from_origin(join(repo_root, self.name))
959141
function runAfterSuccessScripts() {
  const autorelease =
    pkg.version === '0.0.0-semantically-released' &&
    parseEnv('TRAVIS', false) &&
    process.env.TRAVIS_BRANCH === 'master' &&
    !parseEnv('TRAVIS_PULL_REQUEST', false)

  const reportCoverage = hasFile('coverage') && !parseEnv('SKIP_CODECOV', false)

  if (!autorelease && !reportCoverage) {
    console.log(
      'No need to autorelease or report coverage. Skipping travis-after-success script...',
    )
  } else {
    const result = spawn.sync(
      resolveBin('concurrently'),
      getConcurrentlyArgs(
        {
          codecov: reportCoverage
            ? `echo installing codecov && npx -p codecov@3 -c 'echo running codecov && codecov'`
            : null,
          release: autorelease
            ? `echo installing semantic-release && npx -p semantic-release@15 -c 'echo running semantic-release && semantic-release'`
            : null,
        },
        {killOthers: false},
      ),
      {stdio: 'inherit'},
    )

    process.exit(result.status)
  }
}
932544
def cli(ctx, stage):
    """"""
    if not ctx.bubble:
        ctx.say_yellow(
            'There is no bubble present, will not show any transformer functions')
        raise click.Abort()
    rule_functions = get_registered_rule_functions()
    ctx.gbc.say('before loading functions:' + str(len(rule_functions)))
    load_rule_functions(ctx)
    ctx.gbc.say('after loading functions:' + str(len(rule_functions)))
    ctx.gbc.say('rule_functions:', stuff=rule_functions, verbosity=10)
    rule_functions.set_parent(ctx.gbc)
    for f in rule_functions:
        ctx.say('fun: ' + f, verbosity=1)
    ctx.gbc.say('funs: ', stuff=rule_functions.get_rule_functions(), verbosity=100)

    return True
25569
def _construct_stage(self, deployment, swagger):
        

        # If StageName is some intrinsic function, then don't prefix the Stage's logical ID
        # This will NOT create duplicates because we allow only ONE stage per API resource
        stage_name_prefix = self.stage_name if isinstance(self.stage_name, string_types) else ""

        stage = ApiGatewayStage(self.logical_id + stage_name_prefix + 'Stage',
                                attributes=self.passthrough_resource_attributes)
        stage.RestApiId = ref(self.logical_id)
        stage.update_deployment_ref(deployment.logical_id)
        stage.StageName = self.stage_name
        stage.CacheClusterEnabled = self.cache_cluster_enabled
        stage.CacheClusterSize = self.cache_cluster_size
        stage.Variables = self.variables
        stage.MethodSettings = self.method_settings
        stage.AccessLogSetting = self.access_log_setting
        stage.CanarySetting = self.canary_setting
        stage.TracingEnabled = self.tracing_enabled

        if swagger is not None:
            deployment.make_auto_deployable(stage, swagger)

        return stage
388818
def setup_stage(name, options = {}, &block)
      stages[name] = ''

      if options.has_key?(:desc)
        stages[name] = options[:desc]
      end

      if name.to_s == get(:stage).to_s
        @loaded_stage = name

        instance_eval(&block)
      end
    end
1093815
def perform_release(context):
    """"""
    try:
        run_tests()

        if not context.skip_changelog:
            generate_changelog(context)

        increment_version(context)

        build_distributions(context)

        install_package(context)

        upload_package(context)

        install_from_pypi(context)

        publish(context)
    except Exception:
        log.exception('Error releasing')
1269365
def dispatch_command(self, command, stage):
        

        self.api_stage = stage

        if command not in ['status', 'manage']:
            if not self.vargs.get('json', None):
                click.echo("Calling " + click.style(command, fg="green", bold=True) + " for stage " +
                           click.style(self.api_stage, bold=True) + ".." )

        # Explicitly define the app function.
        # Related: https://github.com/Miserlou/Zappa/issues/832
        if self.vargs.get('app_function', None):
            self.app_function = self.vargs['app_function']

        # Load our settings, based on api_stage.
        try:
            self.load_settings(self.vargs.get('settings_file'))
        except ValueError as e:
            if hasattr(e, 'message'):
                print("Error: {}".format(e.message))
            else:
                print(str(e))
            sys.exit(-1)
        self.callback('settings')

        # Hand it off
        if command == 'deploy': # pragma: no cover
            self.deploy(self.vargs['zip'])
        if command == 'package': # pragma: no cover
            self.package(self.vargs['output'])
        if command == 'template': # pragma: no cover
            self.template(      self.vargs['lambda_arn'],
                                self.vargs['role_arn'],
                                output=self.vargs['output'],
                                json=self.vargs['json']
                            )
        elif command == 'update': # pragma: no cover
            self.update(self.vargs['zip'], self.vargs['no_upload'])
        elif command == 'rollback': # pragma: no cover
            self.rollback(self.vargs['num_rollback'])
        elif command == 'invoke': # pragma: no cover

            if not self.vargs.get('command_rest'):
                print("Please enter the function to invoke.")
                return

            self.invoke(
                self.vargs['command_rest'],
                raw_python=self.vargs['raw'],
                no_color=self.vargs['no_color'],
            )
        elif command == 'manage': # pragma: no cover

            if not self.vargs.get('command_rest'):
                print("Please enter the management command to invoke.")
                return

            if not self.django_settings:
                print("This command is for Django projects only!")
                print("If this is a Django project, please define django_settings in your zappa_settings.")
                return

            command_tail = self.vargs.get('command_rest')
            if len(command_tail) > 1:
                command = " ".join(command_tail) # ex: zappa manage dev "shell --version"
            else:
                command = command_tail[0] # ex: zappa manage dev showmigrations admin

            self.invoke(
                command,
                command="manage",
                no_color=self.vargs['no_color'],
            )

        elif command == 'tail': # pragma: no cover
            self.tail(
                colorize=(not self.vargs['no_color']),
                http=self.vargs['http'],
                non_http=self.vargs['non_http'],
                since=self.vargs['since'],
                filter_pattern=self.vargs['filter'],
                force_colorize=self.vargs['force_color'] or None,
                keep_open=not self.vargs['disable_keep_open']
            )
        elif command == 'undeploy': # pragma: no cover
            self.undeploy(
                no_confirm=self.vargs['yes'],
                remove_logs=self.vargs['remove_logs']
            )
        elif command == 'schedule': # pragma: no cover
            self.schedule()
        elif command == 'unschedule': # pragma: no cover
            self.unschedule()
        elif command == 'status': # pragma: no cover
            self.status(return_json=self.vargs['json'])
        elif command == 'certify': # pragma: no cover
            self.certify(
                no_confirm=self.vargs['yes'],
                manual=self.vargs['manual']
            )
        elif command == 'shell': # pragma: no cover
            self.shell()
425163
def process_pull
      factory = "::#{object_type}".constantize
      syncer = factory.synchronizer
      syncer.pull_object(self.object_remote_id)
      
      self.state = 'done'
      self.save
    end
863023
function switchState(started, pkg) {
    pkg.started = started;

    //add available port back into port range
    if (!started && pkg.env && pkg.env.PORT)
      ports.push(pkg.env.PORT);

    console.log((started ? 'Started' : 'Stopped') + ' application ' + pkg.user + '/' + pkg.name);

    logInfo('info', 'Application ' + (started ? 'started' : 'stopped'), {name: pkg.app, user: pkg.user});
    droneModel.createOrUpdate(pkg, function(){});
  }
162497
def switch_to_input(self, pull=None, **kwargs):
        
        self.direction = digitalio.Direction.INPUT
        self.pull = pull