/**
  * {@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);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $sourceDirectory = $input->getArgument('source');
     $repositoryUrl = $input->getOption('repository');
     $targetBranch = $input->getOption('branch');
     $project = new Project($sourceDirectory, getcwd() . '/.couscous/generated');
     // Generate the website
     $this->generator->generate($project, $output);
     $output->writeln('');
     // Deploy it
     $this->deployer->deploy($project, $output, $repositoryUrl, $targetBranch);
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $sourceDirectory = $input->getArgument('source');
     $repositoryUrl = $input->getOption('repository');
     $targetBranch = $input->getOption('branch');
     $project = new Project($sourceDirectory, getcwd() . '/.couscous/generated');
     // Generate the website
     $this->generator->generate($project, $output);
     // If no branch was provided, use the configured one or the default
     if (!$targetBranch) {
         $targetBranch = isset($project->metadata['branch']) ? $project->metadata['branch'] : 'gh-pages';
     }
     $output->writeln('');
     // Deploy it
     $this->deployer->deploy($project, $output, $repositoryUrl, $targetBranch);
 }