Going to deployer manager
@throws \Exception
198695
public function deployerActivity()
    {
        $configs = JsonListener::open(FEnv::get("framework.config.core.config.file"));

        return ($this->render("deployermanager", array("selected" => "deployermanager",
            "default_env" => $configs->default_env, "loader_msg" => "Deployer Manager")));
    }
333357
public function boot()
    {
        $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'instance-validator');

        $this->publishes([
            __DIR__ . '/../../resources/lang' => resource_path('lang/vendor/instance-validator'),
        ]);

        Validator::extend('instance_of', function ($attribute, $value, $parameters, $validator)
        {
            if (count($parameters) != 1)
            {
                throw new Exception("The 'instance_of' validator requires a single type to be specified.");
            }

            return $value instanceof $parameters[0];
        });

        Validator::replacer('instance_of', function ($message, $attribute, $rule, $parameters)
        {
            $msg = Lang::trans('instance-validator::' . $message);
            $msg = str_replace([':attribute', ':type'], [$attribute, $parameters[0]], $msg);
            return $msg;
        });

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

        Validator::extend('collection_of', function ($attribute, $value, $parameters, $validator)
        {
            if (count($parameters) != 1)
            {
                throw new Exception("The 'collection_of' validator requires a single type to be specified.");
            }

            if(!$value instanceof Collection)
            {
                throw new Exception("The 'collection_of' validator requires a Collection instance.");
            }

            if ($value->isEmpty()) return true;

            $itemIsCorrectType = $value[0] instanceof $parameters[0] || (strtolower($parameters[0]) === 'string' && is_string($value[0]));

            return $itemIsCorrectType;
        });

        Validator::replacer('collection_of', function ($message, $attribute, $rule, $parameters)
        {
            $msg = Lang::trans('instance-validator::' . $message);
            $msg = str_replace([':attribute', ':type'], [$attribute, $parameters[0]], $msg);
            return $msg;
        });

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

        Validator::extend('paginator_of', function ($attribute, $value, $parameters, $validator)
        {
            if (count($parameters) != 1)
            {
                throw new Exception("The 'paginator_of' validator requires a single type to be specified.");
            }

            if(!$value instanceof LengthAwarePaginator)
            {
                throw new Exception("The 'paginator_of' validator requires a LengthAwarePaginator instance.");
            }

            if ($value->isEmpty()) return true;

            $itemIsCorrectType = $value->items()[0] instanceof $parameters[0] || (strtolower($parameters[0]) === 'string' && is_string($value->items()[0]));

            return $itemIsCorrectType;
        });

        Validator::replacer('paginator_of', function ($message, $attribute, $rule, $parameters)
        {
            $msg = Lang::trans('instance-validator::' . $message);
            $msg = str_replace([':attribute', ':type'], [$attribute, $parameters[0]], $msg);
            return $msg;
        });
    }
992880
public function run()
    {
        if (!$this->isAppRootSet()) {
            throw new Exception("The application root wasn't defined.", 1);
        }
        if (!$this->isConfigFileSet()) {
            throw new Exception("The main config file wasn't defined.", 2);
        }
        $sConfigPath = $this->getAppRoot().$this->getConfigFile();
        if (!is_readable($sConfigPath)) {
            throw new Exception("It's unable to load ".$sConfigPath
            .'as main config file.', 4);
        }
        $mConfig = include $sConfigPath;
        if (!is_array($mConfig)) {
            throw new Exception('The main config must be an array.', 5);
        }
        $this->configSet = $mConfig;
    }
789822
public function deploy()
    {
        $this->logger->notice('Deploying ' . $this->name . ' (' . $this->releaseIdentifier . ')');
        $this->workflow->run($this);
    }
869586
public function connect()
    {
        if ( ! ($this->connection = ssh2_connect($this->host, $this->port))) {
            throw new \Exception('Cannot connect to server');
        }
        
        if ( ! ssh2_auth_pubkey_file($this->connection, $this->authUser, $this->authPub, $this->authPriv,
            $this->authPass)
        ) {
            throw new \Exception('Autentication rejected by server');
        }
    }
278682
protected function getBuildFile()
    {
        $buildfile = getcwd().'/build.yml';

        if (true === $this->input->hasParameterOption('--buildfile')) {
            $buildfile = realpath($this->input->getParameterOption('--buildfile'));
        }

        if (is_file($buildfile) && is_readable($buildfile)) {
            return $buildfile;
        }

        throw new \Exception(
            sprintf('Could not find build file "%s"', $buildfile)
        );
    }
421872
public void init() throws Exception {
        userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
        System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());

        if (!cfg.exists()) {

            ConfigurationManager manager = new ConfigurationManager(cfg, false, locateConfigurationProvider());

            try {

                manager.runProjectConfigurationInitializers();

                if (options.isVerbose()) {
                    log.info("CONFIGURATION FILE [" + cfg.getAbsolutePath() + "] CREATION COMPLETE");
                }

            } catch (IOException aux) {
                if (options.isVerbose()) {
                    log.error("The system can't create the file [ " + cfg.getAbsolutePath() + "]");
                }
                if (options.isThrowException()) {
                    System.setProperty("user.dir", userDir);
                    throw aux;
                }
            }

        } else {
            if (options.isVerbose()) {
                log.error("The configuration file [" + cfg.getAbsolutePath() + "] already exists");
            }
        }
        System.setProperty("user.dir", userDir);
    }
1375034
public function main()
    {
        if ($this->remove) {
            if ($this->name === null || $this->name === "") {
                throw new BuildException("The 'name' attribute is required with 'unset'.");
            }
            $this->removeProperty($this->name);
            return;
        }
        if ($this->file === null) {
            // check for the required name attribute
            if ($this->name === null || $this->name === '') {
                throw new BuildException("The 'name' attribute is required.");
            }

            // adjust the property value if necessary -- is this necessary?
            // Doesn't Ant do this automatically?
            $this->value = $this->getProject()->replaceProperties($this->value);

            // set the property
            $this->forceProperty($this->name, $this->value);
        } else {
            if (!$this->file->exists()) {
                throw new BuildException($this->file->getAbsolutePath() . " does not exists.");
            }
            $this->loadFile($this->file);
        }
    }
131306
public function main()
    {
        $this->validate();
        $this->datetimeTaskStart = new \DateTimeImmutable();

        if ($this->describeMainStack()) {
            $this->updateStacks();
        } else {
            $this->creationStacks();
        }

        while (!$this->stackIsReady()) {
            sleep(3);
            if (empty($this->events)) {
                $this->log("Waiting for stack provisioning...");
            }
        }

        $stacks = $this->describeMainStack($e);

        if (null === $stacks) {
            throw $e;
        }

        $outputLog = '';

        if ($stacks[0]['Outputs']) {
            foreach ($stacks[0]['Outputs'] as $row) {
                $outputLog .= PHP_EOL . $row['OutputKey'] . ': ' . $row['OutputValue'];
                if ($output = $this->getOutput($row['OutputKey'])) {
                    /** @var StackOutput $output */
                    $this->project->setProperty($output->getProperty(), $row['OutputValue']);
                }
            }
        }

        $this->log($outputLog);
    }
299823
public function boot()
    {
        $path = __DIR__ . '/../resources/lang/en/exceptionmessages.php';

        $this->publishes([
            $path => resource_path("lang/vendor/{$this->namespace}/en/exceptionmessages.php"),
        ]);

        $this->loadTranslationsFrom($path, $this->namespace);
    }
842188
public function main()
    {
        if ((count($this->sourceFileSets) === 0) && (count($this->sourceFileLists) === 0)) {
            throw new BuildException(
                'At least one <srcfileset> or <srcfilelist>'
                . ' element must be set'
            );
        }
        if ((count($this->targetFileSets) === 0) && (count($this->targetFileLists) === 0)) {
            throw new BuildException(
                'At least one <targetfileset> or'
                . ' <targetfilelist> element must be set'
            );
        }
        $now = (new DateTime())->getTimestamp();
        /*
          We have to munge the time to allow for the filesystem time
          granularity.
        */
        // $now += FILE_UTILS . getFileTimestampGranularity();

        // Grab all the target files specified via filesets:
        $allTargets = [];
        $oldestTargetTime = 0;
        $oldestTarget = null;
        foreach ($this->targetFileSets as $targetFS) {
            if (!$targetFS->getDir($this->getProject())->exists()) {
                // this is the same as if it was empty, no target files found
                continue;
            }
            $targetDS = $targetFS->getDirectoryScanner($this->getProject());
            $targetFiles = $targetDS->getIncludedFiles();

            foreach ($targetFiles as $targetFile) {
                $dest = new PhingFile($targetFS->getDir($this->getProject()), $targetFile);
                $allTargets[] = $dest;

                if ($dest->lastModified() > $now) {
                    $this->log(
                        'Warning: ' . $targetFile . ' modified in the future.',
                        Project::MSG_WARN
                    );
                }
                if ($oldestTarget === null
                    || $dest->lastModified() < $oldestTargetTime
                ) {
                    $oldestTargetTime = $dest->lastModified();
                    $oldestTarget = $dest;
                }
            }
        }
        // Grab all the target files specified via filelists:
        $upToDate = true;
        foreach ($this->targetFileLists as $targetFL) {
            $targetFiles = $targetFL->getFiles($this->getProject());

            foreach ($targetFiles as $targetFile) {
                $dest = new PhingFile($targetFL->getDir($this->getProject()), $targetFile);
                if (!$dest->exists()) {
                    $this->log($targetFile . ' does not exist.', Project::MSG_VERBOSE);
                    $upToDate = false;
                    continue;
                }

                $allTargets[] = $dest;
                if ($dest->lastModified() > $now) {
                    $this->log(
                        'Warning: ' . $targetFile . ' modified in the future.',
                        Project::MSG_WARN
                    );
                }
                if ($oldestTarget === null
                    || $dest->lastModified() < $oldestTargetTime
                ) {
                    $oldestTargetTime = $dest->lastModified();
                    $oldestTarget = $dest;
                }
            }
        }
        if ($oldestTarget !== null) {
            $this->log($oldestTarget . ' is oldest target file', Project::MSG_VERBOSE);
        } else {
            // no target files, then we cannot remove any target files and
            // skip the following tests right away
            $upToDate = false;
        }
        // Check targets vs source files specified via filelists:
        if ($upToDate) {
            foreach ($this->sourceFileLists as $sourceFL) {
                $sourceFiles = $sourceFL->getFiles($this->getProject());

                foreach ($sourceFiles as $sourceFile) {
                    $src = new PhingFile($sourceFL->getDir($this->getProject()), $sourceFile);

                    if ($src->lastModified() > $now) {
                        $this->log(
                            'Warning: ' . $sourceFile
                            . ' modified in the future.',
                            Project::MSG_WARN
                        );
                    }
                    if (!$src->exists()) {
                        $this->log(
                            $sourceFile . ' does not exist.',
                            Project::MSG_VERBOSE
                        );
                        $upToDate = false;
                        break 2;
                    }
                    if ($src->lastModified() > $oldestTargetTime) {
                        $upToDate = false;
                        $this->log(
                            $oldestTarget . ' is out of date with respect to '
                            . $sourceFile,
                            Project::MSG_VERBOSE
                        );
                        break 2;
                    }
                }
            }
        }
        // Check targets vs source files specified via filesets:
        if ($upToDate) {
            foreach ($this->sourceFileSets as $sourceFS) {
                $sourceDS = $sourceFS->getDirectoryScanner($this->getProject());
                $sourceFiles = $sourceDS->getIncludedFiles();

                foreach ($sourceFiles as $sourceFile) {
                    $src = new PhingFile($sourceFS->getDir($this->getProject()), $sourceFile);

                    if ($src->lastModified() > $now) {
                        $this->log(
                            'Warning: ' . $sourceFile
                            . ' modified in the future.',
                            Project::MSG_WARN
                        );
                    }
                    if ($src->lastModified() > $oldestTargetTime) {
                        $upToDate = false;
                        $this->log(
                            $oldestTarget . ' is out of date with respect to '
                            . $sourceFile,
                            Project::MSG_VERBOSE
                        );
                        break 2;
                    }
                }
            }
        }
        if (!$upToDate) {
            $this->log('Deleting all target files. ', Project::MSG_VERBOSE);
            foreach ($allTargets as $fileToRemove) {
                $this->log(
                    'Deleting file ' . $fileToRemove->getAbsolutePath(),
                    Project::MSG_VERBOSE
                );
                $fileToRemove->delete();
            }
        }
    }
1371945
public function launch()
    {
        foreach($this->getServers() as $server)
        {
            $server = $this->getContainer()->get($server);
            if (!$server)
            {
                throw new \Exception("Unable to find Server Service.");
            }

            if (!($server instanceof ServerTypeInterface))
            {
                throw new \Exception("Server Service must implement ServerTypeInterface");
            }

            if ($this->getOutput())
            {
                $this->getOutput()->writeln("Launching " . $server->getName() . " on: " . $server->getAddress());
            }
            //launch server into background process?
            $server->launch();
        }
    }
522937
public function runMd()
    {

        // run the mess detector
        $this->_exec(
            sprintf(
                '%s/bin/phpmd %s xml phpmd.xml --reportfile %s/reports/pmd.xml --ignore-violations-on-exit || exit 0',
                $this->getVendorDir(),
                $this->getSrcDir(),
                $this->getTargetDir()
            )
        );
    }
310708
protected function initConfig()
    {
        if (!($this->config instanceof Repository)) {
            $filePath   = $this->configPath();
            if (!is_file($filePath)) {
                throw new Exception("Application config file can not found({$filePath}).");
            }

            $this->setConfig(new Repository(require $filePath));
            date_default_timezone_set($this->config['timezone']);
        }
    }
355208
public function run()
    {
        if (PHP_SAPI === 'cli' && is_subclass_of($this, ConsoleAppInterface::class))
        {
            $this->execConsoleApp();
        }
        else if (is_subclass_of($this, WebAppInterface::class))
        {
            $this->execWebApp();
        }
        else
        {
            throw new \Exception("No interface was implemented");
        }
    }
154507
public function main()
    {
        if (null === $this->getRepository()) {
            throw new BuildException('"repository" is required parameter');
        }

        $client = $this->getGitClient(false, $this->getRepository());
        $command = $client->getCommand('push');
        $command
            ->setOption('tags', $this->isTags())
            ->setOption('mirror', $this->isMirror())
            ->setOption('delete', $this->isDelete())
            ->setOption('q', $this->isQuiet())
            ->setOption('force', $this->isForce());

        // set operation target
        if ($this->isAllRemotes()) { // --all
            $command->setOption('all', true);
            $this->log('git-push: push to all refs', Project::MSG_INFO);
        } elseif ($this->isMirror()) { // <repository> [<refspec>]
            $command->setOption('mirror', true);
            $this->log('git-push: mirror all refs', Project::MSG_INFO);
        } elseif ($this->getDestination()) { // <repository> [<refspec>]
            $command->addArgument($this->getDestination());
            if ($this->getRefspec()) {
                $command->addArgument($this->getRefspec());
            }
            $this->log(
                sprintf(
                    'git-push: pushing to %s %s',
                    $this->getDestination(),
                    $this->getRefspec()
                ),
                Project::MSG_INFO
            );
        } else {
            throw new BuildException('At least one destination must be provided');
        }

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

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

        $this->log('git-push: complete', Project::MSG_INFO);
        if ($this->isDelete()) {
            $this->log('git-push: branch delete requested', Project::MSG_INFO);
        }
        $this->log('git-push output: ' . trim($output), Project::MSG_INFO);
    }
726827
protected function loadManager()
    {
        if (null === $this->getManager()) {
            $manager = new Manager($this->getConfig(), $this);
            $this->setManager($manager);
        } else {
            $manager = $this->getManager();
            $manager->setCommand($this);
        }
    }