Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $sourceDirectory = $input->getArgument('source');
     $repositoryUrl = sprintf('https://%s@%s', getenv('GH_TOKEN'), getenv('GH_REF'));
     $targetBranch = $input->getOption('branch');
     $repository = new Project($sourceDirectory, getcwd() . '/.couscous/generated');
     // verify some env variables
     $travisBranch = getenv('TRAVIS_BRANCH');
     if ($travisBranch !== 'master') {
         $output->writeln('<comment>[NOT DEPLOYED] Deploying Couscous only for master branch</comment>');
         return;
     }
     $isPullRequest = (int) getenv('TRAVIS_PULL_REQUEST') > 0 ? true : false;
     if ($isPullRequest) {
         $output->writeln('<comment>[NOT DEPLOYED] Not deploying Couscous for pull requests</comment>');
         return;
     }
     // set git user data
     $output->writeln('<info>Setting up git user</info>');
     $this->commandRunner->run('git config --global user.name "${GIT_NAME}"');
     $this->commandRunner->run('git config --global user.email "${GIT_EMAIL}"');
     // getting current php version to only deploy once
     $currentPhpVersion = getenv('TRAVIS_PHP_VERSION');
     if ($input->getOption('php-version') != $currentPhpVersion) {
         $output->writeln('<comment>This version of the documentation is already deployed</comment>');
         return;
     }
     // Generate the website
     $this->generator->generate($repository, $output);
     $output->writeln('');
     // Deploy it
     $this->deployer->deploy($repository, $output, $repositoryUrl, $targetBranch);
 }
Exemplo n.º 2
0
 private function executeScript($sourceDirectory, $script)
 {
     $script = 'cd "' . $sourceDirectory . '" && ' . $script;
     $this->logger->notice('Executing {script}', ['script' => $script]);
     try {
         $this->commandRunner->run($script);
     } catch (CommandException $e) {
         throw new \RuntimeException("Error while running '{$script}':" . PHP_EOL . $e->getMessage());
     }
 }
Exemplo n.º 3
0
 public function __invoke(Project $project)
 {
     if ($project->regenerate || !$this->hasBowerJson($project)) {
         return;
     }
     $this->logger->notice('Executing "bower install"');
     $result = $this->commandRunner->run(sprintf('cd "%s" && bower install', $project->metadata['template.directory']));
     if ($result) {
         $this->logger->info($result);
     }
 }