Executes Composer and runs a specified command (e.g. install / update)
495780
public function execute()
    {
        $path  = $this->phpci->buildPath;
        $build = $this->build;

        if ($this->directory == $path) {
            return false;
        }

        $filename = str_replace('%build.commit%', $build->getCommitId(), $this->filename);
        $filename = str_replace('%build.id%', $build->getId(), $filename);
        $filename = str_replace('%build.branch%', $build->getBranch(), $filename);
        $filename = str_replace('%project.title%', $build->getProject()->getTitle(), $filename);
        $filename = str_replace('%date%', date('Y-m-d'), $filename);
        $filename = str_replace('%time%', date('Hi'), $filename);
        $filename = preg_replace('/([^a-zA-Z0-9_-]+)/', '', $filename);

        $curdir = getcwd();
        chdir($this->phpci->buildPath);

        if (!is_array($this->format)) {
            $this->format = array($this->format);
        }

        foreach ($this->format as $format) {
            switch ($format) {
                case 'tar':
                    $cmd = 'tar cfz "%s/%s.tar.gz" ./*';
                    break;
                default:
                case 'zip':
                    $cmd = 'zip -rq "%s/%s.zip" ./*';
                    break;
            }

            $success = $this->phpci->executeCommand($cmd, $this->directory, $filename);
        }

        chdir($curdir);

        return $success;
    }
1237218
public function run() {
		add_action(
			'init',
			function() {
				load_plugin_textdomain( 'github-updater' );
			}
		);

		define( 'GITHUB_UPDATER_DIR', $this->dir );

		// Load Autoloader.
		require_once $this->dir . '/vendor/autoload.php';

		register_activation_hook( $this->file, array( new Init(), 'rename_on_activation' ) );
		( new Init() )->run();

		/**
		 * Initialize Persist Admin notices Dismissal.
		 *
		 * @link https://github.com/collizo4sky/persist-admin-notices-dismissal
		 */
		add_action( 'admin_init', array( 'PAnD', 'init' ) );
	}
88683
def execute(options):
    """"""
    # Load the key in PKCS 12 format that you downloaded from the Google APIs
    # Console when you created your Service account.
    package_name = options['<package>']
    source_directory = options['<output_dir>']

    if options['upload'] is True:
        upstream = True
    else:
        upstream = False

    sub_tasks = {'images': options['--images'], 'listings': options['--listings'], 'inapp': options['--inapp']}
    if sub_tasks == {'images': False, 'listings': False, 'inapp': False}:
        sub_tasks = {'images': True, 'listings': True, 'inapp': True}

    credentials = create_credentials(credentials_file=options['--credentials'],
                                     service_email=options['--service-email'],
                                     service_key=options['--key'])

    command = SyncCommand(
        package_name, source_directory, upstream, credentials, **sub_tasks)
    command.execute()
853644
def run(self):
        

        # download and compile solvers
        prepare.do(to_install)

        # now, do standard build
        distutils.command.build.build.run(self)
50475
public function execute()
    {
        // if npm does not work, we cannot use grunt, so we return false
        $cmd = 'cd %s && npm install';
        if (IS_WIN) {
            $cmd = 'cd /d %s && npm install';
        }
        if (!$this->phpci->executeCommand($cmd, $this->directory)) {
            return false;
        }

        // build the grunt command
        $cmd = 'cd %s && ' . $this->grunt;
        if (IS_WIN) {
            $cmd = 'cd /d %s && ' . $this->grunt;
        }
        $cmd .= ' --no-color';
        $cmd .= ' --gruntfile %s';
        $cmd .= ' %s'; // the task that will be executed

        // and execute it
        return $this->phpci->executeCommand($cmd, $this->directory, $this->gruntfile, $this->task);
    }
107335
public function main()
    {
        if (null === $this->getRepository()) {
            throw new BuildException('"repository" is required parameter');
        }

        $client = $this->getGitClient(false, $this->getRepository());
        $command = $client->getCommand('gc');
        $command
            ->setOption('aggressive', $this->isAggressive())
            ->setOption('auto', $this->isAuto())
            ->setOption('no-prune', $this->isNoPrune());
        if ($this->isNoPrune() == false) {
            $command->setOption('prune', $this->getPrune());
        }

        // suppress output
        $command->setOption('q');

        $this->log('git-gc command: ' . $command->createCommandString(), Project::MSG_INFO);

        try {
            $command->execute();
        } catch (Exception $e) {
            throw new BuildException('Task execution failed', $e);
        }

        $this->log(
            sprintf('git-gc: cleaning up "%s" repository', $this->getRepository()),
            Project::MSG_INFO
        );
    }
651690
public function runCommand($command)
    {
        $this->setAutoExit(false);
        $argv = explode(' ','application '.$command);
        $input = new ArgvInput($argv);
        $this->run($input);
    }
1148407
private function installUpdateComposer()
    {
        if (!is_file(dirname($this->documentRoot) . '/composer.phar')) {
            // Download composer to the DOCUMENT_ROOT's parent directory.
            if (file_put_contents(
                dirname($this->documentRoot) . '/composer.phar',
                fopen("https://getcomposer.org/download/1.7.1/composer.phar", 'r')
            )) {
                echo $this->logEntry("Composer downloaded successfully. Making composer.phar executable...");
                // CD into DOCUMENT_ROOT parent and make composer.phar executable
                exec("cd " . dirname($this->documentRoot) . " && chmod +x composer.phar");
            } else {
                echo $this->logEntry("Could not get Composer working.  Please check your settings and try again.");
            }
        } else {
            // Check that composer is working
            $check_composer = shell_exec(dirname($this->documentRoot) . "/composer.phar" . ' --version 2>&1');
            echo $this->logEntry($check_composer);
            if (strpos($check_composer, 'omposer version')) {
                // Check for Composer updates
                $update_composer = shell_exec(dirname($this->documentRoot) . "/composer.phar self-update 2>&1");
                echo $this->logEntry("Checking For Composer Update...");
                echo $this->logEntry($update_composer);
            }
        }
    }
684892
def run(cls):
        """"""
        project = __import__(IMPORT, fromlist=[''])
        for expected, var in [('@Robpol86', '__author__'), (LICENSE, '__license__'), (VERSION, '__version__')]:
            if getattr(project, var) != expected:
                raise SystemExit('Mismatch: {0}'.format(var))
        # Check changelog.
        if not re.compile(r'^%s - \d{4}-\d{2}-\d{2}[\r\n]' % VERSION, re.MULTILINE).search(readme()):
            raise SystemExit('Version not found in readme/changelog file.')
        # Check tox.
        if INSTALL_REQUIRES:
            contents = readme('tox.ini')
            section = re.compile(r'[\r\n]+install_requires =[\r\n]+(.+?)[\r\n]+\w', re.DOTALL).findall(contents)
            if not section:
                raise SystemExit('Missing install_requires section in tox.ini.')
            in_tox = re.findall(r'    ([^=]+)==[\w\d.-]+', section[0])
            if INSTALL_REQUIRES != in_tox:
                raise SystemExit('Missing/unordered pinned dependencies in tox.ini.')
866647
def run(self, command, variables=[], board=None, packages=[]):
        """"""

        # -- Check for the SConstruct file
        if not isfile(util.safe_join(util.get_project_dir(), 'SConstruct')):
            variables += ['-f']
            variables += [util.safe_join(
                util.get_folder('resources'), 'SConstruct')]
        else:
            click.secho('Info: use custom SConstruct file')

        # -- Resolve packages
        if self.profile.check_exe_default():
            # Run on `default` config mode
            if not util.resolve_packages(
              packages,
              self.profile.packages,
              self.resources.distribution.get('packages')
             ):
                # Exit if a package is not installed
                raise Exception
        else:
            click.secho('Info: native config mode')

        # -- Execute scons
        return self._execute_scons(command, variables, board)
1175032
private function executeInstaller()
    {
        $oInput  = $this->oInput;
        $oOutput = $this->oOutput;

        // --------------------------------------------------------------------------

        $oOutput->writeln('');
        $oOutput->writeln('<info>---------------</info>');
        $oOutput->writeln('<info>Nails Installer</info>');
        $oOutput->writeln('<info>---------------</info>');
        $oOutput->writeln('');

        // --------------------------------------------------------------------------

        //  Define app & deploy vars
        $appVars    = $this->defineAppVars();
        $deployVars = $this->defineDeployVars();

        // --------------------------------------------------------------------------

        //  Pre-Install tests
        $preTestErrors = $this->preInstallTests();

        // --------------------------------------------------------------------------

        if (empty($preTestErrors)) {

            if ($oInput->isInteractive()) {
                $oOutput->writeln('');
                $oOutput->writeln('<info>App Settings</info>');
                $this->setVars($appVars);

                // --------------------------------------------------------------------------

                $oOutput->writeln('');
                $oOutput->writeln('<info>Deploy Settings</info>');
                $this->setVars($deployVars);
            }

            // --------------------------------------------------------------------------

            //  Tell user what's about to happen
            $oOutput->writeln('');
            $oOutput->writeln('<info>I\'m about to do the following:</info>');

            //  app.php
            $oOutput->writeln('');
            $oOutput->writeln('1) Write <info>config/app.php</info>');

            foreach ($appVars as &$v) {

                if (is_string($v)) {
                    continue;
                }

                $sValue = $v['value'] ?: '<blank>';
                $oOutput->writeln(' - Set <comment>' . $v['label'] . '</comment> to <comment>' . $sValue . '</comment>');
            }

            //  deploy.php
            $oOutput->writeln('');
            $oOutput->writeln('2) Write <info>config/deploy.php</info>');

            foreach ($deployVars as &$v) {

                if (is_string($v)) {
                    continue;
                }

                $sValue = $v['value'] ?: '<blank>';
                $oOutput->writeln(' - Set <comment>' . $v['label'] . '</comment> to <comment>' . $sValue . '</comment>');
            }

            //  Migrate database and rewrite routes
            $oOutput->writeln('');
            $oOutput->writeln('3) Migrate the database');
            $oOutput->writeln('4) Rewrite app routes');

            $oOutput->writeln('');
            $question  = 'Does this look OK?';
            $doInstall = $this->confirm($question, true);

            if ($doInstall) {

                $curStep  = 1;
                $numSteps = 1;  //  app.php
                $numSteps += 1; //  deploy.php
                $numSteps += 1; //  migrate DB
                $numSteps += 1; //  rewrite routes
                $numSteps += !empty($users) ? 1 : 0;

                $oOutput->writeln('');
                $oOutput->writeln('<info>Installing...</info>');

                //  Write app.php
                $oOutput->write('<comment>[' . $curStep . '/' . $numSteps . ']</comment> Writing <info>config/app.php</info>... ');
                if ($this->writeFile($appVars, 'config/app.php')) {
                    $oOutput->writeln('<info>done!</info>');
                } else {
                    $oOutput->writeln('<error>failed!</error>');
                }
                $curStep++;

                //  Write deploy.php
                $oOutput->write('<comment>[' . $curStep . '/' . $numSteps . ']</comment> Writing <info>config/deploy.php</info>... ');
                if ($this->writeFile($deployVars, 'config/deploy.php')) {
                    $oOutput->writeln('<info>done!</info>');
                } else {
                    $oOutput->writeln('<error>failed!</error>');
                }
                $curStep++;

                /**
                 * Get the current database credential values. If an existing deploy.php is already there then
                 * we can't rely on it having the latest details (as it might have just been updated).
                 */

                $dbHost = $this->getVarValue('DEPLOY_DB_HOST', $deployVars);
                $dbUser = $this->getVarValue('DEPLOY_DB_USERNAME', $deployVars);
                $dbPass = $this->getVarValue('DEPLOY_DB_PASSWORD', $deployVars);
                $dbName = $this->getVarValue('DEPLOY_DB_DATABASE', $deployVars);

                Factory::setProperty('DB_HOST', $dbHost);
                Factory::setProperty('DB_USERNAME', $dbUser);
                Factory::setProperty('DB_PASSWORD', $dbPass);
                Factory::setProperty('DB_DATABASE', $dbName);

                //  Migrate DB
                $oOutput->write('<comment>[' . $curStep . '/' . $numSteps . ']</comment> Migrating database... ');
                $this->migrateDb($dbHost, $dbUser, $dbPass, $dbName);
                $curStep++;

                //  Rewrite routes
                $oOutput->write('<comment>[' . $curStep . '/' . $numSteps . ']</comment> Rewriting routes... ');
                $this->rewriteRoutes();

                // --------------------------------------------------------------------------

                //  Cleaning up
                $oOutput->writeln('');
                $oOutput->writeln('<comment>Cleaning up...</comment>');

                //  And we're done!
                $oOutput->writeln('');
                $oOutput->writeln('Complete!');

                return self::EXIT_CODE_SUCCESS;

            } else {
                return $this->abort();
            }

        } else {

            $exitCode = $this->abort();

            foreach ($preTestErrors as $error) {
                $oOutput->writeln(' - ' . $error);
            }

            return $exitCode;
        }
    }
1242469
protected function composerRunCommand($command)
    {
        $this->info("Run \"$command\".");

        $output = [];
        exec($command, $output, $returnStatusCode);

        if ($returnStatusCode !== 0) {
            throw RuntimeException::commandExecutionFailed($command, $returnStatusCode);
        }

        $this->info("\"$command\" was successfully ran.");
    }
903756
def run_commands (self):
        """"""
        cwd = os.getcwd()
        data = []
        data.append('config_dir = %r' % os.path.join(cwd, "config"))
        data.append("install_data = %r" % cwd)
        data.append("install_scripts = %r" % cwd)
        self.create_conf_file(data)
        super(MyDistribution, self).run_commands()
1223942
public function run()
    {
        $isPost = $_SERVER["REQUEST_METHOD"] == 'POST';
        $src    = $_SERVER["REQUEST_METHOD"] == 'POST' ? $_POST : $_GET;
        $cmd    = isset($src['cmd']) ? $src['cmd'] : '';
        $args   = array();

        if (!function_exists('json_encode')) {
            $error = $this->elFinder->error(elFinder::ERROR_CONF, elFinder::ERROR_CONF_NO_JSON);
            $this->output(array('error' => '{"error":["'.implode('","', $error).'"]}', 'raw' => true));
        }

        if (!$this->elFinder->loaded()) {
            $this->output(array('error' => $this->elFinder->error(elFinder::ERROR_CONF, elFinder::ERROR_CONF_NO_VOL), 'debug' => $this->elFinder->mountErrors));
        }

        // telepat_mode: on
        if (!$cmd && $isPost) {
            $this->output(array('error' => $this->elFinder->error(elFinder::ERROR_UPLOAD, elFinder::ERROR_UPLOAD_TOTAL_SIZE), 'header' => 'Content-Type: text/html'));
        }
        // telepat_mode: off

        if (!$this->elFinder->commandExists($cmd)) {
            $this->output(array('error' => $this->elFinder->error(elFinder::ERROR_UNKNOWN_CMD)));
        }

        // collect required arguments to exec command
        foreach ($this->elFinder->commandArgsList($cmd) as $name => $req) {
            $arg = $name == 'FILES'
                ? $_FILES
                : (isset($src[$name]) ? $src[$name] : '');

            if (!is_array($arg)) {
                $arg = trim($arg);
            }
            if ($req && (!isset($arg) || $arg === '')) {
                $this->output(array('error' => $this->elFinder->error(elFinder::ERROR_INV_PARAMS, $cmd)));
            }
            $args[$name] = $arg;
        }

        $args['debug'] = isset($src['debug']) ? !!$src['debug'] : false;

        $this->output($this->elFinder->exec($cmd, $args));
    }
369508
def run(self):
        
        run_command = (
            settings.project_customization.runfile.read_text().split()
        )
        chmod_string = (
            "chmod +x "
            + settings.project_customization.runfile.absolute().as_posix()
        )
        subprocess.run(chmod_string.split())
        subprocess.run(
            run_command, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr
        )
449285
public function execute() {
        global $CFG;

        if (!empty($CFG->skiplangupgrade)) {
            mtrace('Langpack update skipped. ($CFG->skiplangupgrade set)');

            return;
        }

        $controller = new \tool_langimport\controller();
        if ($controller->update_all_installed_languages()) {
            foreach ($controller->info as $message) {
                mtrace($message);
            }
            return true;
        } else {
            foreach ($controller->errors as $message) {
                mtrace($message);
            }
            return false;
        }

    }
1043788
def run_npm_install(path, options, context):
    """"""
    # Use npm ci if available (npm v5.7+)
    if options.get('skip_npm_ci'):
        LOGGER.info("Skipping npm ci or npm install on %s...",
                    os.path.basename(path))
    elif context.env_vars.get('CI') and use_npm_ci(path):  # noqa
        LOGGER.info("Running npm ci on %s...",
                    os.path.basename(path))
        subprocess.check_call([NPM_BIN, 'ci'])
    else:
        LOGGER.info("Running npm install on %s...",
                    os.path.basename(path))
        subprocess.check_call([NPM_BIN, 'install'])