protected function execute(InputInterface $input, OutputInterface $output)
    {
        $rootDir = $this->getRootDir();
        $stagingName = $input->getOption('staging-name');
        $stagingPath = $this->getCapistranoDir().'/deploy/';
        $staging = sprintf('%s%s.rb', $stagingPath, $stagingName);

        $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
        $this->sayWelcome($output);

        if (false === file_exists($staging)) {
            $yamlStaging = sprintf('%s/config/rch/staging/%s.yml', $rootDir, $stagingName);

            if (false === file_exists($yamlStaging)) {
                throw new InvalidArgumentException(sprintf('Unable to find staging with name %s', $stagingName));
            }

            $params = $this->parseYamlStaging($yamlStaging);
            $generator = new StagingGenerator($params, $stagingPath, $stagingName);

            $this->generate($generator);
        }

        $builder = new ProcessBuilder(['bundle', 'exec', 'cap', $stagingName, 'deploy']);
        $builder->setTimeout(null);
        $process = $builder->getProcess();

        $process->run(function ($type, $buffer) use ($output) {
            $output->write(sprintf('<info>%s</info>', $buffer));
        });

        if (!$process->isSuccessful()) {
            $output->writeln(PHP_EOL);
            $output->writeln('<error>Deployment failed</error>');
            $output->writeln(
                sprintf('<error>Execute <comment>cap %s deploy --trace</comment> for more details</error>', $stagingName)
            );

            return $process->getExitCode();
        }

        return $output->writeln(
            '<info>Project successfully deployed !</info>'
        );
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $rootDir = $this->getRootDir();
        $stagingName = $input->getOption('staging-name');
        $stagingPath = $this->getCapistranoDir().'/deploy/';
        $staging = sprintf('%s%s.rb', $stagingPath, $stagingName);

        $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
        $this->sayWelcome($output);

        if (false === file_exists($staging)) {
            $yamlStaging = sprintf('%s/config/rch/staging/%s.yml', $rootDir, $stagingName);

            if (false === file_exists($yamlStaging)) {
                throw new InvalidArgumentException(sprintf('Unable to find staging with name %s', $stagingName));
            }

            $params = $this->parseYamlStaging($yamlStaging);
            $generator = new StagingGenerator($params, $stagingPath, $stagingName);

            $this->generate($generator);
        }

        $builder = new ProcessBuilder(['bundle', 'exec', 'cap', $stagingName, 'deploy']);
        $builder->setTimeout(null);
        $process = $builder->getProcess();

        $process->run(function ($type, $buffer) use ($output) {
            $output->write(sprintf('<info>%s</info>', $buffer));
        });

        if (!$process->isSuccessful()) {
            $output->writeln(PHP_EOL);
            $output->writeln('<error>Deployment failed</error>');
            $output->writeln(
                sprintf('<error>Execute <comment>cap %s deploy --trace</comment> for more details</error>', $stagingName)
            );

            return $process->getExitCode();
        }

        return $output->writeln(
            '<info>Project successfully deployed !</info>'
        );
    }
protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ rootDir = $ this -> getRootDir ( ) ; $ stagingName = $ input -> getOption ( 'staging-name' ) ; $ stagingPath = $ this -> getCapistranoDir ( ) . '/deploy/' ; $ staging = sprintf ( '%s%s.rb' , $ stagingPath , $ stagingName ) ; $ output -> setVerbosity ( OutputInterface :: VERBOSITY_VERBOSE ) ; $ this -> sayWelcome ( $ output ) ; if ( false === file_exists ( $ staging ) ) { $ yamlStaging = sprintf ( '%s/config/rch/staging/%s.yml' , $ rootDir , $ stagingName ) ; if ( false === file_exists ( $ yamlStaging ) ) { throw new InvalidArgumentException ( sprintf ( 'Unable to find staging with name %s' , $ stagingName ) ) ; } $ params = $ this -> parseYamlStaging ( $ yamlStaging ) ; $ generator = new StagingGenerator ( $ params , $ stagingPath , $ stagingName ) ; $ this -> generate ( $ generator ) ; } $ builder = new ProcessBuilder ( [ 'bundle' , 'exec' , 'cap' , $ stagingName , 'deploy' ] ) ; $ builder -> setTimeout ( null ) ; $ process = $ builder -> getProcess ( ) ; $ process -> run ( function ( $ type , $ buffer ) use ( $ output ) { $ output -> write ( sprintf ( '<info>%s</info>' , $ buffer ) ) ; } ) ; if ( ! $ process -> isSuccessful ( ) ) { $ output -> writeln ( PHP_EOL ) ; $ output -> writeln ( '<error>Deployment failed</error>' ) ; $ output -> writeln ( sprintf ( '<error>Execute <comment>cap %s deploy --trace</comment> for more details</error>' , $ stagingName ) ) ; return $ process -> getExitCode ( ) ; } return $ output -> writeln ( '<info>Project successfully deployed !</info>' ) ; }
Deploys application.

@param InputInterface  $input
@param OutputInterface $output
Deploys application .