Skip to content

Commit

Permalink
Using version_compare to only deploy for php 5.5 sub build as it seem…
Browse files Browse the repository at this point in the history
…s to be the fastest on Travis
  • Loading branch information
wysow committed Jan 14, 2015
1 parent a2f146d commit bbdd6f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Couscous\Command;
namespace Couscous\Application\Cli;

use Couscous\Generator;
use Couscous\Model\Repository;
Expand Down Expand Up @@ -101,17 +101,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
shell_exec('git config user.name ${GIT_NAME}');
shell_exec('git config user.email ${GIT_EMAIL}');

$isAlreadyDeployed = (bool) getenv('TRAVIS_DEPLOYED');
if (!$isAlreadyDeployed) {
// getting current php version to only deploy once
if (version_compare(phpversion(), '5.5', '>') && version_compare(phpversion(), '5.6', '<')) {
// Generate the website
$this->generator->generate($repository, $output);

$output->writeln('');
// Deploy it
$this->deployer->deploy($repository, $output, $repositoryUrl, $targetBranch);

// setting env variable to disallow new deployment
shell_exec('EXPORT TRAVIS_DEPLOYED=true');
exit(1);
}

Expand Down
1 change: 1 addition & 0 deletions src/Application/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
$application->add($c->get('Couscous\Application\Cli\PreviewCommand'));
$application->add($c->get('Couscous\Application\Cli\DeployCommand'));
$application->add($c->get('Couscous\Application\Cli\ClearCommand'));
$application->add($c->get('Couscous\Application\Cli\TravisAutoDeployCommand'));

return $application;
}),
Expand Down

0 comments on commit bbdd6f1

Please sign in to comment.