protected function execute(InputInterface $input, OutputInterface $output) { // Ask for an app and environment. $this->getApp($input, $output); $this->getEnvironment($input, $output); // Get desired version. $question = new Question('What version would you like to deploy? This can be any git ref. (branch, tag, or sha) ', ''); $git_ref = $this->getAnswer($input, $output, $question, 'git_ref'); // Notify user. $output->writeln("Deploying App <info>{$this->app->name}</info> environment <comment>{$this->environment->name}</comment> to version <question> {$git_ref} </question> ..."); // Ask for confirmation. $helper = $this->getHelper('question'); $question = new ConfirmationQuestion("Are you sure? This will checkout the version and run the deploy hooks in .terra.yml [y\\N] ", false); if (!$helper->ask($input, $output, $question)) { $output->writeln('<error>Deploy Cancelled</error>'); return; } // Run the deployment. $environment = new EnvironmentFactory($this->environment, $this->app); $this->environment->version = $environment->deploy($git_ref); // Save the new version to the config. $this->getApplication()->getTerra()->getConfig()->add('apps', array($this->app->name, 'environments', $this->environment->name), (array) $this->environment); $this->getApplication()->getTerra()->getConfig()->save(); }