Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcdawkins committed Oct 23, 2015
2 parents 7f77baa + 674be95 commit fd46f75
Show file tree
Hide file tree
Showing 32 changed files with 338 additions and 251 deletions.
20 changes: 15 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
language: php

sudo: false

php:
- 5.4
- 5.5
- 5.6
- hhvm
- 7.0

matrix:
allow_failures:
- php: 7.0
fast_finish: true
sudo: false
allow_failures:
- php: 7.0
fast_finish: true

env:
- COMPOSER_LOWEST=0
- COMPOSER_LOWEST=1

cache:
directories:
- $HOME/.composer/cache

install:
- composer install --no-interaction
- travis_wait composer update --prefer-lowest --no-interaction
- if [ "$COMPOSER_LOWEST" = 1 ]; then travis_wait composer update --prefer-lowest --no-interaction; fi

script:
- ./vendor/bin/phpunit -c ./phpunit.xml --coverage-text
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"license": "MIT",
"require": {
"doctrine/cache": "~1.4.2",
"guzzlehttp/ringphp": "^1.1",
"platformsh/console-form": "0.0.4",
"platformsh/client": "0.1.31",
"platformsh/client": "0.2.1",
"symfony/console": "~2.5 >=2.5.2",
"symfony/yaml": "~2.5",
"symfony/finder": "~2.5",
Expand Down
36 changes: 18 additions & 18 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion platform
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

define('CLI_ROOT', __DIR__);

error_reporting(getenv('PLATFORMSH_CLI_DEBUG') ? E_ALL : false);
// Ensure that errors are only reported once.
ini_set('display_errors', 1);
ini_set('log_errors', 0);

if (file_exists(CLI_ROOT . '/vendor/autoload.php')) {
require CLI_ROOT . '/vendor/autoload.php';
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Activity/ActivityLogCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
protected function displayLog(Activity $activity, OutputInterface $output, $poll = true, $interval = 1)
{
$logger = function ($log) use ($output) {
$output->write($log);
$output->write(preg_replace('/^/m', ' ', $log));
};
if (!$poll) {
$logger($activity['log']);
Expand Down
16 changes: 1 addition & 15 deletions src/Command/Auth/LoginCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$this->stdErr->writeln("Please log in using your <info>Platform.sh</info> account\n");
$this->configureAccount($input, $this->stdErr);
$this->clearCache();
$this->stdErr->writeln("\n<info>Thank you, you are all set.</info>\n");
}

Expand All @@ -53,21 +54,6 @@ function ($answer) {
$question->setMaxAttempts(5);
$email = $helper->ask($input, $output, $question);

$userExists = true;
if (!$userExists) {
$createAccountText = "\nThis email address is not associated with a Platform.sh account. \n";
$createAccountText .= 'Would you like to create a new account?';
$createAccount = $helper->confirm($createAccountText, $input, $output);
if ($createAccount) {
// @todo
} else {
// Start from the beginning.
$this->configureAccount($input, $output);

return;
}
}

$pendingInvitation = false;
if ($pendingInvitation) {
$resendInviteText = "\nThis email address is associated with a Platform.sh account, \n";
Expand Down
13 changes: 8 additions & 5 deletions src/Command/Domain/DomainAddCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
namespace Platformsh\Cli\Command\Domain;

use GuzzleHttp\Exception\ClientException;
use Platformsh\Cli\Util\ActivityUtil;
use Platformsh\Client\Model\Activity;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

Expand All @@ -16,7 +18,7 @@ protected function configure()
$this
->setName('domain:add')
->setDescription('Add a new domain to the project');
$this->addProjectOption();
$this->addProjectOption()->addNoWaitOption();
$this->addDomainOptions();
$this->setHelp('See https://docs.platform.sh/use-platform/going-live.html#1-domains');
$this->addExample('Add the domain example.com', 'example.com');
Expand All @@ -38,7 +40,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

try {
$domain = $this->getSelectedProject()
$this->stdErr->writeln("Adding the domain <info>{$this->domainName}</info>");
$activity = $this->getSelectedProject()
->addDomain($this->domainName, $this->sslOptions);
}
catch (ClientException $e) {
Expand All @@ -53,9 +56,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
throw $e;
}

$this->stdErr->writeln("The domain <info>{$this->domainName}</info> was successfully added to the project.");

$this->displayDomain($domain, $this->stdErr);
if ($activity instanceof Activity && !$input->getOption('no-wait')) {
ActivityUtil::waitAndLog($activity, $this->stdErr);
}

return 0;
}
Expand Down
10 changes: 8 additions & 2 deletions src/Command/Domain/DomainDeleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
namespace Platformsh\Cli\Command\Domain;

use Platformsh\Cli\Command\PlatformCommand;
use Platformsh\Cli\Util\ActivityUtil;
use Platformsh\Client\Model\Activity;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -17,7 +19,7 @@ protected function configure()
->setName('domain:delete')
->setDescription('Delete a domain from the project')
->addArgument('name', InputArgument::REQUIRED, 'The domain name');
$this->addProjectOption();
$this->addProjectOption()->addNoWaitOption();
$this->addExample('Delete the domain example.com', 'example.com');
}

Expand All @@ -43,10 +45,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 0;
}

$domain->delete();
$activity = $domain->delete();

$this->stdErr->writeln("The domain <info>$name</info> has been deleted.");

if ($activity instanceof Activity && !$input->getOption('no-wait')) {
ActivityUtil::waitAndLog($activity, $this->stdErr);
}

return 0;
}
}
12 changes: 3 additions & 9 deletions src/Command/Domain/DomainListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Platformsh\Client\Model\Domain;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class DomainListCommand extends PlatformCommand
Expand All @@ -19,13 +18,8 @@ protected function configure()
$this
->setName('domain:list')
->setAliases(array('domains'))
->setDescription('Get a list of all domains')
->addOption(
'project',
null,
InputOption::VALUE_REQUIRED,
'The project ID'
);
->setDescription('Get a list of all domains');
$this->addProjectOption();
}

/**
Expand Down Expand Up @@ -62,7 +56,7 @@ protected function buildDomainRows(array $tree)
foreach ($tree as $domain) {
$rows[] = array(
$domain['id'],
$formatter->format((bool) $domain['has_certificate']),
$formatter->format((bool) $domain['ssl']['has_certificate']),
$formatter->format($domain['created_at'], 'created_at'),
);
}
Expand Down
7 changes: 3 additions & 4 deletions src/Command/Environment/EnvironmentActivateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Platformsh\Client\Model\Environment;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class EnvironmentActivateCommand extends PlatformCommand
Expand All @@ -17,10 +16,10 @@ protected function configure()
$this
->setName('environment:activate')
->setDescription('Activate an environment')
->addArgument('environment', InputArgument::IS_ARRAY, 'The environment(s) to activate')
->addOption('no-wait', null, InputOption::VALUE_NONE, 'Do not wait for the operation to complete');
->addArgument('environment', InputArgument::IS_ARRAY, 'The environment(s) to activate');
$this->addProjectOption()
->addEnvironmentOption();
->addEnvironmentOption()
->addNoWaitOption();
$this->addExample('Activate the environments "develop" and "stage"', 'develop stage');
}

Expand Down
10 changes: 3 additions & 7 deletions src/Command/Environment/EnvironmentBranchCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,15 @@ protected function configure()
InputOption::VALUE_NONE,
"Create the new environment even if the branch cannot be checked out locally"
)
->addOption(
'no-wait',
null,
InputOption::VALUE_NONE,
'Do not wait for the Platform.sh branch to be created'
)
->addOption(
'build',
null,
InputOption::VALUE_NONE,
"Build the new environment locally"
);
$this->addProjectOption()
->addEnvironmentOption();
->addEnvironmentOption()
->addNoWaitOption("Do not wait for the environment to be branched");
$this->addExample('Create a new branch "sprint-2", based on "develop"', 'sprint-2 develop');
}

Expand Down Expand Up @@ -167,6 +162,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$remoteSuccess = true;
if (!$input->getOption('no-wait')) {
$this->stdErr->writeln('Waiting for the environment to be branched...');
$remoteSuccess = ActivityUtil::waitAndLog(
$activity,
$this->stdErr,
Expand Down
6 changes: 3 additions & 3 deletions src/Command/Environment/EnvironmentDeleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ protected function configure()
->setDescription('Delete an environment')
->addArgument('environment', InputArgument::IS_ARRAY, 'The environment(s) to delete')
->addOption('inactive', null, InputOption::VALUE_NONE, 'Delete all inactive environments')
->addOption('merged', null, InputOption::VALUE_NONE, 'Delete all merged environments')
->addOption('no-wait', null, InputOption::VALUE_NONE, 'Do not wait for the operation to complete');
->addOption('merged', null, InputOption::VALUE_NONE, 'Delete all merged environments');
$this->addProjectOption()
->addEnvironmentOption();
->addEnvironmentOption()
->addNoWaitOption();
$this->addExample('Delete the environments "test" and "example-1"', 'test example-1');
$this->addExample('Delete all inactive environments', '--inactive');
$this->addExample('Delete all environments merged with "master"', '--merged master');
Expand Down
Loading

0 comments on commit fd46f75

Please sign in to comment.