Set project deployment options.

@param InputInterface $input
@param OutputInterface $output

@return $this
182651
protected function setDeployOptions(InputInterface $input, OutputInterface $output)
    {
        $project = ProjectX::getProjectType();

        if ($project instanceof DeployAwareInterface) {
            $command_io = new SymfonyStyle($input, $output);
            $command_io->title('Deploy Build Options');

            $form = (new Form())
                ->setInput($input)
                ->setOutput($output)
                ->setHelperSet($this->getHelperSet())
                ->addFields([
                    (new BooleanField('deploy', 'Setup build deploy?'))
                        ->setDefault(false)
                        ->setSubform(function ($subform, $value) {
                            if (true === $value) {
                                $subform->addFields([
                                    (new TextField('repo_url', 'Repository URL')),
                                ]);
                            }
                        })
                ])
                ->process();

            $results = $form->getResults();

            if (isset($results['deploy']) && !empty($results['deploy'])) {
                $this->options['deploy'] = $results['deploy'];
            }
        }

        return $this;
    }
136960
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $config = new Config(
            $input->getOption('prod'),
            $input->getOption('destination'),
            '/sites/all/modules/%s',
            '/sites/all/themes/%s',
            '/sites/all/drush/%s',
            '/profiles/%s',
            '/sites/default/files',
            '/sites/default/files-private',
            '/sites/default/settings.php'
        );

        $finder = new Finder(
             $input->getOption('source'),
            $input->getOption('destination'),
            'cnf/files',
            'cnf/private',
            'cnf/settings.php'
        );

        $im = $this->getComposer()->getInstallationManager();
        $rm = $this->getComposer()->getRepositoryManager();

        $mapper = new Mapper($config, $finder, $im, $rm);
        $mapper->clear();
        $mapper->mirror($mapper->getMap());
    }
1197750
protected function initialize(InputInterface $input, OutputInterface $output) {
        parent::initialize($input, $output);

        if (!Docker::exists()) {
            $this->stdOut->writeln("<error>Cannot find docker command</error>");
            exit(1);
        }
        if (!Compose::exists()) {
            $this->stdOut->writeln("<error>Cannot find docker-compose command</error>");
            exit(1);
        }

        // For Mac OS X we need to ensure a Docker VM is running.
        if (!Docker::native()) {
            $this->validateNonNative();
        } else {
            $this->validateNative();
        }
    }
186021
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $dir = $input->getArgument('dir');

        Console::setCustomEnvDirectory($dir);

        $output->writeln('### ENV directory has been set to '.$dir.' ###');
    }
1241074
public function execute(InputInterface $input, OutputInterface $output)
    {
        try {
            $output->writeln(
                '<comment>Generating new Embeddable  '
                . $input->getOption(static::OPT_NEW_EMBEDDABLE_CATEGORY_NAME) . '\\' .
                $input->getOption(static::OPT_NEW_EMBEDDABLE_NAME)
                . '</comment>'
            );
            $this->checkOptions($input);
            $this->action
                ->setProjectRootDirectory($input->getOption(AbstractCommand::OPT_PROJECT_ROOT_PATH))
                ->setProjectRootNamespace($input->getOption(AbstractCommand::OPT_PROJECT_ROOT_NAMESPACE))
                ->setCatName($input->getOption(static::OPT_NEW_EMBEDDABLE_CATEGORY_NAME))
                ->setName($input->getOption(static::OPT_NEW_EMBEDDABLE_NAME))
                ->run();
            $output->writeln('<info>completed</info>');
        } catch (\Exception $e) {
            throw new DoctrineStaticMetaException(
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
    }
1104218
protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var ConfigurationHelper $configurationHelper */
        $configurationHelper = $this->getHelper('phpdocumentor_configuration');
        $target = $configurationHelper->getOption($input, 'target', 'parser/target');
        if (strpos($target, '/tmp/') === 0) {
            $target = str_replace('/tmp/', sys_get_temp_dir() . DIRECTORY_SEPARATOR, $target);
        }
        
        $fileSystem = new Filesystem();
        if (! $fileSystem->isAbsolutePath($target)) {
            $target = getcwd().DIRECTORY_SEPARATOR.$target;
        }
        if (!file_exists($target)) {
            mkdir($target, 0777, true);
        }
        if (!is_dir($target)) {
            throw new \Exception($this->__('PPCPP:EXC-BADTARGET'));
        }
        $this->getCache()->getOptions()->setCacheDir($target);

        $builder = $this->getBuilder();
        $builder->createProjectDescriptor();
        $projectDescriptor = $builder->getProjectDescriptor();

        $output->write($this->__('PPCPP:LOG-COLLECTING'));
        $files = $this->getFileCollection($input);

        /** @var Finder $exampleFinder */
        $exampleFinder = $this->getContainer()->offsetGet('parser.example.finder');
        $exampleFinder->setSourceDirectory($files->getProjectRoot());
        $exampleFinder->setExampleDirectories($configurationHelper->getConfigValueFromPath('files/examples'));
        $output->writeln($this->__('PPCPP:LOG-OK'));

        /** @var ProgressHelper $progress  */
        $progress = $this->getProgressBar($input);
        if (!$progress) {
            $this->getHelper('phpdocumentor_logger')->connectOutputToLogging($output, $this);
        }

        $output->write($this->__('PPCPP:LOG-INITIALIZING'));
        $this->populateParser($input, $files);

        if ($progress) {
            $progress->start($output, $files->count());
        }

        try {
            $output->writeln($this->__('PPCPP:LOG-OK'));
            $output->writeln($this->__('PPCPP:LOG-PARSING'));

            $mapper = new ProjectDescriptorMapper($this->getCache());
            $mapper->garbageCollect($files);
            $mapper->populate($projectDescriptor);

            $visibility = (array) $configurationHelper->getOption($input, 'visibility', 'parser/visibility');
            $visibilities = array();
            foreach ($visibility as $item) {
                $visibilities = $visibilities + explode(',', $item);
            }
            $visibility = null;
            foreach ($visibilities as $item) {
                switch ($item) {
                    case 'public':
                        $visibility |= ProjectDescriptor\Settings::VISIBILITY_PUBLIC;
                        break;
                    case 'protected':
                        $visibility |= ProjectDescriptor\Settings::VISIBILITY_PROTECTED;
                        break;
                    case 'private':
                        $visibility |= ProjectDescriptor\Settings::VISIBILITY_PRIVATE;
                        break;
                }
            }
            if ($visibility === null) {
                $visibility = ProjectDescriptor\Settings::VISIBILITY_DEFAULT;
            }
            if ($input->getOption('parseprivate')) {
                $visibility = $visibility | ProjectDescriptor\Settings::VISIBILITY_INTERNAL;
            }
            $projectDescriptor->getSettings()->setVisibility($visibility);

            $this->getParser()->parse($builder, $files);
        } catch (FilesNotFoundException $e) {
            throw new \Exception($this->__('PPCPP:EXC-NOFILES'));
        } catch (\Exception $e) {
            throw new \Exception($e->getMessage(), 0, $e);
        }

        if ($progress) {
            $progress->finish();
        }

        $projectDescriptor->setPartials($this->getService('partials'));

        $output->write($this->__('PPCPP:LOG-STORECACHE', (array) $this->getCache()->getOptions()->getCacheDir()));
        $projectDescriptor->getSettings()->clearModifiedFlag();
        $mapper->save($projectDescriptor);

        $output->writeln($this->__('PPCPP:LOG-OK'));

        return 0;
    }
153544
public function execute(InputInterface $input, OutputInterface $output)
    {
        try {
            $output->writeln(
                '<comment>Setting Entity '
                . $input->getOption(static::OPT_ENTITY)
                . ' has Embeddable ' . $input->getOption(static::OPT_EMBEDDABLE)
                . '</comment>'
            );
            $this->checkOptions($input);
            $this->embeddableSetter
                ->setPathToProjectRoot($input->getOption(self::OPT_PROJECT_ROOT_PATH))
                ->setProjectRootNamespace($input->getOption(self::OPT_PROJECT_ROOT_NAMESPACE))
                ->setEntityHasEmbeddable(
                    $input->getOption(static::OPT_ENTITY),
                    $input->getOption(static::OPT_EMBEDDABLE)
                );
            $output->writeln('<info>completed</info>');
        } catch (\Exception $e) {
            throw new DoctrineStaticMetaException(
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
    }
1224456
protected function interact(InputInterface $input, OutputInterface $output)
    {
        $questionHelper = $this->getHelper('question');
        $formatter = $this->getHelper('formatter');
        $rootDir = $this->getRootDir();
        $fs = new Filesystem();
        $appPath = explode('/', $rootDir);
        $appName = $appPath[count($appPath) - 2];

        $this->initConfig($fs, $rootDir);
        $output->writeln([$formatter->formatSection('SETUP', 'Project settings'), '']);

        $deployData = $this->configureDeploy($input, $output, $questionHelper, $appName);
        $deploy = new DeployGenerator($deployData, $rootDir);
        $this->generate($deploy);

        $output->writeln(['', " > generating <comment>{$appName}/config/deploy.rb</comment>"]);
        $output->writeln(['<info>Successfully created.</info>', '']);
        $output->writeln([$formatter->formatSection('PRODUCTION', 'Remote server / SSH settings'), '']);

        $sshProps = $this->configureSSH($input, $output, $questionHelper, $deployData);
        $staging = new StagingGenerator($sshProps, $this->getCapistranoDeployDir());
        $yamlStaging = new YamlStagingGenerator($sshProps, $this->getStagingsConfigDir());

        $this->generateMany([$staging, $yamlStaging]);

        return $output->writeln('<comment>Remote server successfully configured</comment>');
    }
1306135
protected function execute( InputInterface $input, OutputInterface $output ) {
		Log::instance()->setOutput( $output );

		$snapshot_id = $input->getArgument( 'snapshot_id' );

		if ( empty( $snapshot_id ) ) {
			$repository = RepositoryManager::instance()->setup( $input->getOption( 'repository' ) );

			if ( ! $repository ) {
				Log::instance()->write( 'Could not setup repository.', 0, 'error' );
				return 1;
			}

			$path = $input->getOption( 'path' );

			if ( empty( $path ) ) {
				$path = getcwd();
			}

			$path = Utils\normalize_path( $path );

			$helper = $this->getHelper( 'question' );

			$verbose = $input->getOption( 'verbose' );

			$project_question = new Question( 'Project Slug (letters, numbers, _, and - only): ' );
			$project_question->setValidator( '\WPSnapshots\Utils\slug_validator' );

			$project = $helper->ask( $input, $output, $project_question );

			$description_question = new Question( 'Snapshot Description (e.g. Local environment): ' );
			$description_question->setValidator( '\WPSnapshots\Utils\not_empty_validator' );

			$description = $helper->ask( $input, $output, $description_question );

			$exclude = $input->getOption( 'exclude' );

			if ( ! empty( $input->getOption( 'exclude_uploads' ) ) ) {
				$exclude[] = './uploads';
			}

			$snapshot = Snapshot::create(
				[
					'path'        => $path,
					'db_host'     => $input->getOption( 'db_host' ),
					'db_name'     => $input->getOption( 'db_name' ),
					'db_user'     => $input->getOption( 'db_user' ),
					'db_password' => $input->getOption( 'db_password' ),
					'project'     => $project,
					'description' => $description,
					'no_scrub'    => $input->getOption( 'no_scrub' ),
					'exclude'     => $exclude,
					'repository'  => $repository->getName(),
				], $output, $verbose
			);
		} else {
			if ( ! Utils\is_snapshot_cached( $snapshot_id ) ) {
				Log::instance()->write( 'Snapshot not found locally.', 0, 'error' );

				return 1;
			}

			$snapshot = Snapshot::get( $snapshot_id );
		}

		if ( ! is_a( $snapshot, '\WPSnapshots\Snapshot' ) ) {
			return 1;
		}

		if ( $snapshot->push() ) {
			Log::instance()->write( 'Push finished!' . ( empty( $snapshot_id ) ? ' Snapshot ID is ' . $snapshot->id : '' ), 0, 'success' );
		}
	}
638884
protected function execute(InputInterface $input, OutputInterface $output): void
    {
        try {
            $this->checkOptions($input);
            $output->writeln(
                '<comment>Starting generation for ' . $input->getOption(self::OPT_FQN) . '</comment>'
            );
            $idType =
                (true !== $input->getOption(self::OPT_INT_PRIMARY_KEY)) ?
                    IdTrait::UUID_FIELD_TRAIT : IdTrait::INTEGER_ID_FIELD_TRAIT;
            $this->entityGenerator
                ->setPathToProjectRoot($input->getOption(AbstractCommand::OPT_PROJECT_ROOT_PATH))
                ->setProjectRootNamespace($input->getOption(AbstractCommand::OPT_PROJECT_ROOT_NAMESPACE))
                ->setPrimaryKeyType($idType);
            $this->entityGenerator->generateEntity(
                $input->getOption(self::OPT_FQN),
                $input->getOption(self::OPT_ENTITY_SPECIFIC_SAVER)
            );
            $output->writeln('<info>completed</info>');
        } catch (\Exception $e) {
            throw new DoctrineStaticMetaException(
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
    }
306081
protected function execute(InputInterface $input, OutputInterface $output)
  {
    $hash = $input->getOption('hash');
    $length = $input->getOption('length');
    $key = $this->newKey($hash, $length);

    if ($this->setKey($key)) return $output->writeln("<info>Application key [{$key}] set successfully.</info>");

    $output->writeln("Can't set application key. Please check if .env file exists");
  }
1045532
public function createProjectByInput(InputInterface $input) : Project
    {
        $configFinder = new ConfigFinder();
        $configLoader = new ConfigLoader();

        /**
         * This section is just for finding the right values to work with in
         * this execution.
         *
         * $options array will have, after this block, all these values
         */
        $configPath = rtrim($input->getOption('config'), DIRECTORY_SEPARATOR);
        $configValues = $configLoader->loadConfigValues(
            $configFinder->findConfigFile($configPath)
        );

        $masterLanguage = $configValues['master_language'];
        $languages = $configValues['languages'];
        $filePaths = $configValues['paths'];

        return Project::create(
            $masterLanguage,
            $languages,
            $filePaths
        );
    }
21631
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->setup->getLocator()->setParams(
            array(
                'release' => $input->getArgument('release'),
                'path' => $input->getOption('path'),
                'scriptName' => $input->getOption('script')
            )
        );

        $queries = $this->setup($input);

        $this->display($input, $output, $queries);
    }
133478
protected function configureIO(InputInterface $input, OutputInterface $output)
    {
        if (true === $input->hasParameterOption(array('--ansi'), true)) {
            $output->setDecorated(true);
        } elseif (true === $input->hasParameterOption(array('--no-ansi'), true)) {
            $output->setDecorated(false);
        }

        if (true === $input->hasParameterOption(array('--no-interaction', '-n'), true)) {
            $input->setInteractive(false);
        } elseif (function_exists('posix_isatty')) {
            $inputStream = null;

            if ($input instanceof StreamableInputInterface) {
                $inputStream = $input->getStream();
            }

            // This check ensures that calling QuestionHelper::setInputStream() works
            // To be removed in 4.0 (in the same time as QuestionHelper::setInputStream)
            if (!$inputStream && $this->getHelperSet()->has('question')) {
                $inputStream = $this->getHelperSet()->get('question')->getInputStream(false);
            }

            if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
                $input->setInteractive(false);
            }
        }

        if (true === $input->hasParameterOption(array('--quiet', '-q'), true)) {
            $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
            $input->setInteractive(false);
        } else {
            if ($input->hasParameterOption('-vvv', true) || $input->hasParameterOption('--verbose=3', true) || $input->getParameterOption('--verbose', false, true) === 3) {
                $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
            } elseif ($input->hasParameterOption('-vv', true) || $input->hasParameterOption('--verbose=2', true) || $input->getParameterOption('--verbose', false, true) === 2) {
                $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
            } elseif ($input->hasParameterOption('-v', true) || $input->hasParameterOption('--verbose=1', true) || $input->hasParameterOption('--verbose', true) || $input->getParameterOption('--verbose', false, true)) {
                $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
            }
        }
    }
323992
protected function execute(InputInterface $input, OutputInterface $output)
	{
		$this->setupEnvironment('site', $input, $output);

		$version = new \JVersion;

		if ($input->getOption('short'))
		{
			$result = $version->getShortVersion();
		}
		elseif ($input->getOption('release'))
		{
			$result = $version->RELEASE;
		}
		else
		{
			$result = $version->getLongVersion();
		}
		$output->writeln($result);
	}
906265
protected function updateProject(OutputInterface $output)
    {
        /** @var UpdateCommand $command */
        $command = $this->getApplication()->find('update');
        $arguments = [ 'command' => 'update' ];
        $requireInput = new ArrayInput($arguments);
        $returnCode = $command->run($requireInput, $output);

        // Flush modified composer object
        $this->resetComposer();
        return $returnCode;
    }
765115
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $container = $this->getContainer();
        $configBuilder = $container->get('admin.configuration.configbuilder');
        $pool = $container->get('admin.configuration.pool');
        foreach ($pool->getConfigurations() as $id => $attributes) {
            $config = $container->get($id);
            $config->build($configBuilder);
        }
    }