Hello community, here is the log from the commit of package platformsh-cli for openSUSE:Factory checked in at 2018-03-02 21:12:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/platformsh-cli (Old) and /work/SRC/openSUSE:Factory/.platformsh-cli.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "platformsh-cli" Fri Mar 2 21:12:26 2018 rev:38 rq:581863 version:3.30.0 Changes: -------- --- /work/SRC/openSUSE:Factory/platformsh-cli/platformsh-cli.changes 2018-02-21 14:13:15.762319076 +0100 +++ /work/SRC/openSUSE:Factory/.platformsh-cli.new/platformsh-cli.changes 2018-03-02 21:12:28.371290861 +0100 @@ -1,0 +2,17 @@ +Fri Mar 02 01:34:38 UTC 2018 - [email protected] + +- Update to version 3.30.0: + * Release v3.30.0 + * [self:release] Support editing the changelog [skip changelog] + * Format activity descriptions + * Print questions even when non-interactive + * Add --wait option and shouldWait() cron/hook detection + * Update redeploy warning + * Add redeploy command + * [self:install] Ensure directory exists when creating shell-config.rc + * Ensure GitLab/GitHub hooks have the right events (#687) + * [activity:get] do not require an environment with --all and a partial ID + * [login] Mention --force option + * Fix release SHA-256 hash + +------------------------------------------------------------------- Old: ---- platformsh-cli-3.29.2.tar.xz New: ---- platformsh-cli-3.30.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ platformsh-cli.spec ++++++ --- /var/tmp/diff_new_pack.nfvHrL/_old 2018-03-02 21:12:29.263258785 +0100 +++ /var/tmp/diff_new_pack.nfvHrL/_new 2018-03-02 21:12:29.263258785 +0100 @@ -17,7 +17,7 @@ Name: platformsh-cli -Version: 3.29.2 +Version: 3.30.0 Release: 0 Summary: Tool for managing Platform.sh services from the command line # See licenses.txt for dependency licenses. ++++++ _service ++++++ --- /var/tmp/diff_new_pack.nfvHrL/_old 2018-03-02 21:12:29.299257492 +0100 +++ /var/tmp/diff_new_pack.nfvHrL/_new 2018-03-02 21:12:29.303257348 +0100 @@ -2,7 +2,7 @@ <service name="tar_scm" mode="disabled"> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> - <param name="revision">refs/tags/v3.29.2</param> + <param name="revision">refs/tags/v3.30.0</param> <param name="url">git://github.com/platformsh/platformsh-cli.git</param> <param name="scm">git</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.nfvHrL/_old 2018-03-02 21:12:29.319256772 +0100 +++ /var/tmp/diff_new_pack.nfvHrL/_new 2018-03-02 21:12:29.319256772 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/platformsh/platformsh-cli.git</param> - <param name="changesrevision">c78d88937a158468e41cd0c8d5038305c93e596e</param> + <param name="changesrevision">5090df77d2e6441e25c5dc01c37f323e0f5f5dc7</param> </service> </servicedata> ++++++ licenses.txt ++++++ --- /var/tmp/diff_new_pack.nfvHrL/_old 2018-03-02 21:12:29.359255334 +0100 +++ /var/tmp/diff_new_pack.nfvHrL/_new 2018-03-02 21:12:29.359255334 +0100 @@ -17,7 +17,7 @@ padraic/humbug_get_contents 1.1.2 BSD-3-Clause padraic/phar-updater v1.0.5 BSD-3-Clause paragonie/random_compat v2.0.11 MIT -platformsh/client v0.15.0 MIT +platformsh/client v0.16.2 MIT platformsh/console-form v0.0.16 MIT psr/container 1.0.0 MIT psr/log 1.0.2 MIT ++++++ platformsh-cli-3.29.2.tar.xz -> platformsh-cli-3.30.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/composer.json new/platformsh-cli-3.30.0/composer.json --- old/platformsh-cli-3.29.2/composer.json 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/composer.json 2018-03-01 12:53:28.000000000 +0100 @@ -8,7 +8,7 @@ "guzzlehttp/guzzle": "^5.3", "guzzlehttp/ringphp": "^1.1", "platformsh/console-form": ">=0.0.16 <2.0", - "platformsh/client": ">=0.15.0 <2.0", + "platformsh/client": ">=0.16.2 <2.0", "symfony/console": "^3.0 !=3.2.5 !=3.2.6", "symfony/yaml": "^3.0 || ^2.6", "symfony/finder": "^3.0", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/composer.lock new/platformsh-cli-3.30.0/composer.lock --- old/platformsh-cli-3.29.2/composer.lock 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/composer.lock 2018-03-01 12:53:28.000000000 +0100 @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "61139468c3903d4897f8fcfece451e34", + "content-hash": "3ec46d331a98339b614a5b1d879727fc", "packages": [ { "name": "cocur/slugify", @@ -711,16 +711,16 @@ }, { "name": "platformsh/client", - "version": "v0.15.0", + "version": "v0.16.2", "source": { "type": "git", "url": "https://github.com/platformsh/platformsh-client-php.git", - "reference": "1ab0bd8d229dda78b4a545379fd107de4ead872c" + "reference": "d148ca8d4c3239ada8441515a4d8a02067037c96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/1ab0bd8d229dda78b4a545379fd107de4ead872c", - "reference": "1ab0bd8d229dda78b4a545379fd107de4ead872c", + "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/d148ca8d4c3239ada8441515a4d8a02067037c96", + "reference": "d148ca8d4c3239ada8441515a4d8a02067037c96", "shasum": "" }, "require": { @@ -756,7 +756,7 @@ } ], "description": "Platform.sh API client", - "time": "2018-02-12T10:31:29+00:00" + "time": "2018-03-01T00:18:35+00:00" }, { "name": "platformsh/console-form", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/config.yaml new/platformsh-cli-3.30.0/config.yaml --- old/platformsh-cli-3.29.2/config.yaml 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/config.yaml 2018-03-01 12:53:28.000000000 +0100 @@ -1,7 +1,7 @@ # Metadata about the CLI application itself. application: name: 'Platform.sh CLI' - version: '3.29.2' + version: '3.30.0' executable: 'platform' package_name: 'platformsh/cli' installer_url: 'https://platform.sh/cli/installer' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/dist/manifest.json new/platformsh-cli-3.30.0/dist/manifest.json --- old/platformsh-cli-3.29.2/dist/manifest.json 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/dist/manifest.json 2018-03-01 12:53:28.000000000 +0100 @@ -1,10 +1,10 @@ [ { "name": "platform.phar", - "sha1": "9bac0042061ac37dba58fdf727ba9e63026bc134", - "sha256": "b45c9bdeacd6aac78da9e16c3c564db64100374681ed193bad70a2cf3f9ff09f", - "url": "https://github.com/platformsh/platformsh-cli/releases/download/v3.29.2/platform.phar", - "version": "3.29.2", + "sha1": "07479a9542234c5231787fe9694ba0e9f27dc342", + "sha256": "559d1d9c8ca7d7364e5d77858d43e401aae2a31b1e2c4ebaee96ed3a66c6f998", + "url": "https://github.com/platformsh/platformsh-cli/releases/download/v3.30.0/platform.phar", + "version": "3.30.0", "php": { "min": "5.5.9" }, @@ -107,6 +107,11 @@ "notes": "* [user:add] Improve `user:add` command to allow setting roles on all environments (aliased to `user:update`)\n* [user:get] Add `user:get` command (aliased to and deprecating `user:role`)\n* [db:dump] Remove --no-autocommit and simplify mysqldump args (#683)\n* Expand redeploy warning to recommend `vset`\n* [activity:get] Check for empty started_at when calculating duration\n* [redis] Recommend \"redis info\" command", "show from": "3.28.0", "hide from": "3.29.0" + }, + { + "notes": "* Add `redeploy` command (available on projects with newer API versions).\n* [activity:list] Format activity descriptions where possible.\n* Print question text even when in automatic non-interactive mode.\n* Add --wait option to all commands, and emit a warning if nothing is specified\n when running inside a Platform.sh build/cron/deploy hook.\n* [integration:add] [integration:update] Ensure GitLab/GitHub hooks have the\n right events selected, and update them if not.\n* [self:install] Ensure directory exists when creating shell-config.rc\n* [activity:get] do not require an environment with --all and a partial ID\n* [login] Mention --force option, if running when already logged in.", + "show from": "3.29.0", + "hide from": "3.30.0" } ] } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Application.php new/platformsh-cli-3.30.0/src/Application.php --- old/platformsh-cli-3.29.2/src/Application.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Application.php 2018-03-01 12:53:28.000000000 +0100 @@ -123,6 +123,7 @@ $commands[] = new Command\Environment\EnvironmentInitCommand(); $commands[] = new Command\Environment\EnvironmentMergeCommand(); $commands[] = new Command\Environment\EnvironmentPushCommand(); + $commands[] = new Command\Environment\EnvironmentRedeployCommand(); $commands[] = new Command\Environment\EnvironmentRelationshipsCommand(); $commands[] = new Command\Environment\EnvironmentSshCommand(); $commands[] = new Command\Environment\EnvironmentSynchronizeCommand(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Activity/ActivityGetCommand.php new/platformsh-cli-3.30.0/src/Command/Activity/ActivityGetCommand.php --- old/platformsh-cli-3.29.2/src/Command/Activity/ActivityGetCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Activity/ActivityGetCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -43,9 +43,7 @@ $activity = $this->getSelectedProject() ->getActivity($id); if (!$activity) { - $activities = $this->getSelectedEnvironment() - ->getActivities(0, $input->getOption('type')); - $activity = $this->api()->matchPartialId($id, $activities, 'Activity'); + $activity = $this->api()->matchPartialId($id, $this->getActivities($input), 'Activity'); if (!$activity) { $this->stdErr->writeln("Activity not found: <error>$id</error>"); @@ -53,13 +51,7 @@ } } } else { - if ($this->hasSelectedEnvironment() && !$input->getOption('all')) { - $activities = $this->getSelectedEnvironment() - ->getActivities(1, $input->getOption('type')); - } else { - $activities = $this->getSelectedProject() - ->getActivities(1, $input->getOption('type')); - } + $activities = $this->getActivities($input, 1); /** @var Activity $activity */ $activity = reset($activities); if (!$activity) { @@ -76,10 +68,7 @@ $properties = $activity->getProperties(); - // Add the activity "description" as a property. - if (!isset($properties['description'])) { - $properties['description'] = $activity->getDescription(); - } + $properties['description'] = $activity->getDescription(false); // Calculate the duration of the activity. if (!isset($properties['duration'])) { @@ -128,4 +117,23 @@ return 0; } + + /** + * Get activities on the project or environment. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param int $limit + * + * @return \Platformsh\Client\Model\Activity[] + */ + private function getActivities(InputInterface $input, $limit = 0) + { + if ($this->hasSelectedEnvironment() && !$input->getOption('all')) { + return $this->getSelectedEnvironment() + ->getActivities($limit, $input->getOption('type')); + } + + return $this->getSelectedProject() + ->getActivities($limit, $input->getOption('type')); + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Activity/ActivityListCommand.php new/platformsh-cli-3.30.0/src/Command/Activity/ActivityListCommand.php --- old/platformsh-cli-3.29.2/src/Command/Activity/ActivityListCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Activity/ActivityListCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -97,7 +97,7 @@ $row = [ new AdaptiveTableCell($activity->id, ['wrap' => false]), $formatter->format($activity['created_at'], 'created_at'), - $activity->getDescription(), + ActivityMonitor::getFormattedDescription($activity), $activity->getCompletionPercent() . '%', ActivityMonitor::formatState($activity->state), ActivityMonitor::formatResult($activity->result, !$table->formatIsMachineReadable()), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Activity/ActivityLogCommand.php new/platformsh-cli-3.30.0/src/Command/Activity/ActivityLogCommand.php --- old/platformsh-cli-3.29.2/src/Command/Activity/ActivityLogCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Activity/ActivityLogCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -77,7 +77,7 @@ $this->stdErr->writeln([ sprintf('<info>Activity ID: </info>%s', $activity->id), - sprintf('<info>Description: </info>%s', $activity->getDescription()), + sprintf('<info>Description: </info>%s', ActivityMonitor::getFormattedDescription($activity)), sprintf('<info>Created: </info>%s', $formatter->format($activity->created_at, 'created_at')), sprintf('<info>State: </info>%s', ActivityMonitor::formatState($activity->state)), '<info>Log: </info>', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Auth/BrowserLoginCommand.php new/platformsh-cli-3.30.0/src/Command/Auth/BrowserLoginCommand.php --- old/platformsh-cli-3.29.2/src/Command/Auth/BrowserLoginCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Auth/BrowserLoginCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -54,6 +54,8 @@ $connector = $this->api()->getClient(false)->getConnector(); if (!$input->getOption('force') && $connector->isLoggedIn()) { $this->stdErr->writeln('You are already logged in.'); + // USE THE FORCE + $this->stdErr->writeln('Use the <comment>--force</comment> (<comment>-f</comment>) option to log in again.'); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Certificate/CertificateAddCommand.php new/platformsh-cli-3.30.0/src/Command/Certificate/CertificateAddCommand.php --- old/platformsh-cli-3.29.2/src/Command/Certificate/CertificateAddCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Certificate/CertificateAddCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -19,7 +19,7 @@ ->addOption('key', null, InputOption::VALUE_REQUIRED, 'The path to the certificate private key file') ->addOption('chain', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'The path to the certificate chain file'); $this->addProjectOption(); - $this->addNoWaitOption(); + $this->addWaitOptions(); } protected function execute(InputInterface $input, OutputInterface $output) @@ -39,7 +39,7 @@ $result = $project->addCertificate($options['certificate'], $options['key'], $options['chain']); - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $activityMonitor->waitMultiple($result->getActivities(), $project); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Certificate/CertificateDeleteCommand.php new/platformsh-cli-3.30.0/src/Command/Certificate/CertificateDeleteCommand.php --- old/platformsh-cli-3.29.2/src/Command/Certificate/CertificateDeleteCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Certificate/CertificateDeleteCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -19,7 +19,7 @@ ->setDescription('Delete a certificate from the project') ->addArgument('id', InputArgument::REQUIRED, 'The certificate ID (or the start of it)'); $this->addProjectOption(); - $this->addNoWaitOption(); + $this->addWaitOptions(); } /** @@ -61,7 +61,7 @@ $this->stdErr->writeln(sprintf('The certificate <info>%s</info> has been deleted.', $certificate->id)); - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $activityMonitor->waitMultiple($result->getActivities(), $project); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/CommandBase.php new/platformsh-cli-3.30.0/src/Command/CommandBase.php --- old/platformsh-cli-3.29.2/src/Command/CommandBase.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/CommandBase.php 2018-03-01 12:53:28.000000000 +0100 @@ -557,14 +557,8 @@ $this->stdErr->writeln([ '', '<comment>The remote environment(s) must be redeployed for the change to take effect.</comment>', - "Use 'git push' with new commit(s) to trigger a redeploy.", + 'To redeploy an environment, run: <info>' . $this->config()->get('application.executable') . ' redeploy</info>', ]); - if (strpos($this->getName(), 'variable:') !== 0) { - $this->stdErr->writeln([ - 'Alternatively, add or change an environment variable, e.g.', - ' <comment>' . $this->config()->get('application.executable') . ' vset _redeploy "$(date)"</comment>' - ]); - } } /** @@ -603,16 +597,61 @@ } /** - * Add the --no-wait option. + * Add both the --no-wait and --wait options. + */ + protected function addWaitOptions() + { + $this->addOption('no-wait', 'W', InputOption::VALUE_NONE, 'Do not wait for the operation to complete'); + if ($this->detectRunningInHook()) { + $this->addOption('wait', null, InputOption::VALUE_NONE, 'Wait for the operation to complete'); + } else { + $this->addOption('wait', null, InputOption::VALUE_NONE, 'Wait for the operation to complete (default)'); + } + } + + /** + * Returns whether we should wait for an operation to complete. * - * @param string $description + * @param \Symfony\Component\Console\Input\InputInterface $input * - * @return CommandBase + * @return bool */ - protected function addNoWaitOption($description = 'Do not wait for the operation to complete') + protected function shouldWait(InputInterface $input) { - /** @noinspection PhpIncompatibleReturnTypeInspection */ - return $this->addOption('no-wait', 'W', InputOption::VALUE_NONE, $description); + if ($input->hasOption('no-wait') && $input->getOption('no-wait')) { + return false; + } + if ($input->hasOption('wait') && $input->getOption('wait')) { + return true; + } + if ($this->detectRunningInHook()) { + $serviceName = $this->config()->get('service.name'); + $message = "\n<comment>Warning:</comment> $serviceName hook environment detected: assuming <comment>--no-wait</comment> by default." + . "\nTo avoid ambiguity, please specify either --no-wait or --wait." + . "\n"; + $this->stdErr->writeln($message); + + return false; + } + + return true; + } + + /** + * Detects a Platform.sh non-terminal Dash environment; i.e. a hook. + * + * @return bool + */ + protected function detectRunningInHook() + { + $envPrefix = $this->config()->get('service.env_prefix'); + if (getenv($envPrefix . 'PROJECT') + && basename(getenv('SHELL')) === 'dash' + && !$this->isTerminal(STDIN)) { + return true; + } + + return false; } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Domain/DomainAddCommand.php new/platformsh-cli-3.30.0/src/Command/Domain/DomainAddCommand.php --- old/platformsh-cli-3.29.2/src/Command/Domain/DomainAddCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Domain/DomainAddCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -17,7 +17,7 @@ ->setName('domain:add') ->setDescription('Add a new domain to the project'); $this->addDomainOptions(); - $this->addProjectOption()->addNoWaitOption(); + $this->addProjectOption()->addWaitOptions(); $this->addExample('Add the domain example.com', 'example.com'); $this->addExample( 'Add the domain secure.example.com with SSL enabled', @@ -54,7 +54,7 @@ return 1; } - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $activityMonitor->waitMultiple($result->getActivities(), $project); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Domain/DomainDeleteCommand.php new/platformsh-cli-3.30.0/src/Command/Domain/DomainDeleteCommand.php --- old/platformsh-cli-3.29.2/src/Command/Domain/DomainDeleteCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Domain/DomainDeleteCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -17,7 +17,7 @@ ->setName('domain:delete') ->setDescription('Delete a domain from the project') ->addArgument('name', InputArgument::REQUIRED, 'The domain name'); - $this->addProjectOption()->addNoWaitOption(); + $this->addProjectOption()->addWaitOptions(); $this->addExample('Delete the domain example.com', 'example.com'); } @@ -48,7 +48,7 @@ $this->stdErr->writeln("The domain <info>$name</info> has been deleted."); - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $activityMonitor->waitMultiple($result->getActivities(), $project); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Domain/DomainUpdateCommand.php new/platformsh-cli-3.30.0/src/Command/Domain/DomainUpdateCommand.php --- old/platformsh-cli-3.29.2/src/Command/Domain/DomainUpdateCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Domain/DomainUpdateCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -16,7 +16,7 @@ ->setName('domain:update') ->setDescription('Update a domain'); $this->addDomainOptions(); - $this->addProjectOption()->addNoWaitOption(); + $this->addProjectOption()->addWaitOptions(); $this->addExample( 'Update the certificate for the domain example.com', 'example.com --cert secure-example-com.crt --key secure-example-com.key' @@ -60,7 +60,7 @@ $result = $domain->update(['ssl' => $this->sslOptions]); - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $activityMonitor->waitMultiple($result->getActivities(), $project); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentActivateCommand.php new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentActivateCommand.php --- old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentActivateCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentActivateCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -20,7 +20,7 @@ ->addOption('parent', null, InputOption::VALUE_REQUIRED, 'Set a new environment parent before activating'); $this->addProjectOption() ->addEnvironmentOption() - ->addNoWaitOption(); + ->addWaitOptions(); $this->addExample('Activate the environments "develop" and "stage"', 'develop stage'); } @@ -112,7 +112,7 @@ $success = $processed >= $count; if ($processed) { - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $result = $activityMonitor->waitMultiple($activities, $this->getSelectedProject()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentBranchCommand.php new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentBranchCommand.php --- old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentBranchCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentBranchCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -34,7 +34,7 @@ ); $this->addProjectOption() ->addEnvironmentOption() - ->addNoWaitOption("Do not wait for the environment to be branched"); + ->addWaitOptions(); Ssh::configureInput($this->getDefinition()); $this->addExample('Create a new branch "sprint-2", based on "develop"', 'sprint-2 develop'); } @@ -153,7 +153,7 @@ } $remoteSuccess = true; - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $remoteSuccess = $activityMonitor->waitAndLog( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentDeleteCommand.php new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentDeleteCommand.php --- old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentDeleteCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentDeleteCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -25,7 +25,7 @@ ->addOption('exclude', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Environments not to delete'); $this->addProjectOption() ->addEnvironmentOption() - ->addNoWaitOption(); + ->addWaitOptions(); $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'); @@ -201,7 +201,7 @@ if ($questionHelper->confirm("Are you sure you want to delete the environment <comment>$environmentId</comment>?")) { $deactivate[$environmentId] = $environment; if (!$input->getOption('no-delete-branch') - && !$input->getOption('no-wait') + && $this->shouldWait($input) && ($input->getOption('delete-branch') || ( $input->isInteractive() @@ -235,7 +235,7 @@ } } - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); if (!$activityMonitor->waitMultiple($deactivateActivities, $this->getSelectedProject())) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentHttpAccessCommand.php new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentHttpAccessCommand.php --- old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentHttpAccessCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentHttpAccessCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -37,7 +37,7 @@ ); $this->addProjectOption() ->addEnvironmentOption() - ->addNoWaitOption(); + ->addWaitOptions(); $this->addExample('Require a username and password', '--auth myname:mypassword'); $this->addExample('Restrict access to only one IP address', '--access deny:any --access allow:69.208.1.192'); $this->addExample('Remove the password requirement, keeping IP restrictions', '--auth 0'); @@ -197,7 +197,7 @@ $success = true; if (!$result->countActivities()) { $this->redeployWarning(); - } elseif (!$input->getOption('no-wait')) { + } elseif ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $success = $activityMonitor->waitMultiple($result->getActivities(), $this->getSelectedProject()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentInfoCommand.php new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentInfoCommand.php --- old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentInfoCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentInfoCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -31,7 +31,7 @@ Table::configureInput($this->getDefinition()); $this->addProjectOption() ->addEnvironmentOption() - ->addNoWaitOption(); + ->addWaitOptions(); $this->addExample('Read all environment properties') ->addExample("Show the environment's status", 'status') ->addExample('Show the date the environment was created', 'created_at') @@ -60,7 +60,7 @@ $value = $input->getArgument('value'); if ($value !== null) { - return $this->setProperty($property, $value, $environment, $input->getOption('no-wait')); + return $this->setProperty($property, $value, $environment, !$this->shouldWait($input)); } switch ($property) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentInitCommand.php new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentInitCommand.php --- old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentInitCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentInitCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -23,7 +23,7 @@ ->addOption('profile', null, InputOption::VALUE_REQUIRED, 'The name of the profile'); $this->addProjectOption() ->addEnvironmentOption() - ->addNoWaitOption(); + ->addWaitOptions(); } protected function execute(InputInterface $input, OutputInterface $output) @@ -58,7 +58,7 @@ $this->api()->clearEnvironmentsCache($environment->project); - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $activityMonitor->waitAndLog($activity); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentMergeCommand.php new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentMergeCommand.php --- old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentMergeCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentMergeCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -18,7 +18,7 @@ ->addArgument('environment', InputArgument::OPTIONAL, 'The environment to merge'); $this->addProjectOption() ->addEnvironmentOption() - ->addNoWaitOption(); + ->addWaitOptions(); $this->addExample('Merge the environment "sprint-2" into its parent', 'sprint-2'); $this->setHelp( 'This command will initiate a Git merge of the specified environment into its parent environment.' @@ -63,7 +63,7 @@ $this->api()->clearEnvironmentsCache($selectedEnvironment->project); $activity = $selectedEnvironment->merge(); - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $success = $activityMonitor->waitAndLog( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentPushCommand.php new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentPushCommand.php --- old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentPushCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentPushCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -26,7 +26,7 @@ ->addOption('set-upstream', 'u', InputOption::VALUE_NONE, 'Set the target environment as the upstream for the source branch') ->addOption('activate', null, InputOption::VALUE_NONE, 'Activate the environment after pushing') ->addOption('parent', null, InputOption::VALUE_REQUIRED, 'Set a new environment parent (only used with --activate)'); - $this->addNoWaitOption('After pushing, do not wait for build or deploy'); + $this->addWaitOptions(); $this->addProjectOption() ->addEnvironmentOption(); Ssh::configureInput($this->getDefinition()); @@ -145,7 +145,7 @@ $ssh = $this->getService('ssh'); $extraSshOptions = []; $env = []; - if ($input->getOption('no-wait')) { + if ($this->shouldWait($input)) { $extraSshOptions['SendEnv'] = 'PLATFORMSH_PUSH_NO_WAIT'; $env['PLATFORMSH_PUSH_NO_WAIT'] = '1'; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentRedeployCommand.php new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentRedeployCommand.php --- old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentRedeployCommand.php 1970-01-01 01:00:00.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentRedeployCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -0,0 +1,47 @@ +<?php +namespace Platformsh\Cli\Command\Environment; + +use Platformsh\Cli\Command\CommandBase; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class EnvironmentRedeployCommand extends CommandBase +{ + + protected function configure() + { + $this + ->setName('environment:redeploy') + ->setAliases(['redeploy']) + ->setDescription('Redeploy an environment'); + $this->addProjectOption() + ->addEnvironmentOption(); + $this->addWaitOptions(); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->validateInput($input); + + $environment = $this->getSelectedEnvironment(); + + /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ + $questionHelper = $this->getService('question_helper'); + if (!$questionHelper->confirm('Are you sure you want to redeploy the environment <comment>' . $environment->id . '</comment>?')) { + return 1; + } + + $activity = $environment->redeploy(); + + if ($this->shouldWait($input)) { + /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ + $activityMonitor = $this->getService('activity_monitor'); + $success = $activityMonitor->waitAndLog($activity); + if (!$success) { + return 1; + } + } + + return 0; + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentSynchronizeCommand.php new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentSynchronizeCommand.php --- old/platformsh-cli-3.29.2/src/Command/Environment/EnvironmentSynchronizeCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Environment/EnvironmentSynchronizeCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -20,7 +20,7 @@ ->addArgument('synchronize', InputArgument::IS_ARRAY, 'What to synchronize: "code", "data" or both'); $this->addProjectOption() ->addEnvironmentOption() - ->addNoWaitOption(); + ->addWaitOptions(); $this->setHelp(<<<EOT This command synchronizes to a child environment from its parent environment. @@ -92,7 +92,7 @@ $this->stdErr->writeln("Synchronizing environment <info>$environmentId</info>"); $activity = $selectedEnvironment->synchronize($syncData, $syncCode); - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $success = $activityMonitor->waitAndLog( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Integration/IntegrationAddCommand.php new/platformsh-cli-3.30.0/src/Command/Integration/IntegrationAddCommand.php --- old/platformsh-cli-3.29.2/src/Command/Integration/IntegrationAddCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Integration/IntegrationAddCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -16,7 +16,7 @@ ->setName('integration:add') ->setDescription('Add an integration to the project'); $this->getForm()->configureInputDefinition($this->getDefinition()); - $this->addProjectOption()->addNoWaitOption(); + $this->addProjectOption()->addWaitOptions(); $this->addExample( 'Add an integration with a GitHub repository', '--type github --repository myuser/example-repo --token 9218376e14c2797e0d06e8d2f918d45f --fetch-branches 0' @@ -54,7 +54,7 @@ $this->stdErr->writeln("Created integration <info>$integration->id</info> (type: {$values['type']})"); $success = true; - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $success = $activityMonitor->waitMultiple($result->getActivities(), $this->getSelectedProject()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Integration/IntegrationCommandBase.php new/platformsh-cli-3.30.0/src/Command/Integration/IntegrationCommandBase.php --- old/platformsh-cli-3.29.2/src/Command/Integration/IntegrationCommandBase.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Integration/IntegrationCommandBase.php 2018-03-01 12:53:28.000000000 +0100 @@ -273,7 +273,11 @@ 'Private-Token' => $integration->getProperty('token'), ], ]; - $payload = ['url' => $integration->getLink('#hook')]; + $payload = [ + 'url' => $integration->getLink('#hook'), + 'push_events' => true, + 'merge_requests_events' => true, + ]; $repoName = $baseUrl . '/' . $integration->getProperty('project'); } else { return; @@ -288,11 +292,26 @@ try { $hooks = $client->get($hooksApiUrl, $requestOptions)->json(); - if ($this->findWebHook($integration, $hooks)) { - $this->stdErr->writeln(' Valid configuration found'); - } else { + $hook = $this->findWebHook($integration, $hooks); + if (!$hook) { $this->stdErr->writeln(' Creating new webhook'); $client->post($hooksApiUrl, ['json' => $payload] + $requestOptions); + $this->stdErr->writeln(' Webhook created successfully'); + } + elseif ($this->arraysDiffer($hook, $payload)) { + // The GitLab API requires PUT for editing project hooks. The + // GitHub API requires PATCH. + $method = $integration->type === 'gitlab' ? 'put' : 'patch'; + $hookApiUrl = $hooksApiUrl . '/' . rawurlencode($hook['id']); + + $this->stdErr->writeln(' Updating webhook'); + $client->send( + $client->createRequest($method, $hookApiUrl, ['json' => $payload] + $requestOptions) + ); + $this->stdErr->writeln(' Webhook updated successfully'); + } + else { + $this->stdErr->writeln(' Valid configuration found'); } } catch (TransferException $e) { $this->stdErr->writeln(''); @@ -306,12 +325,45 @@ } /** + * Checks if $array2 has any values missing or different from $array1. + * + * Runs recursively for multidimensional arrays. + * + * @param array $array1 + * @param array $array2 + * + * @return bool + */ + private function arraysDiffer(array $array1, array $array2) + { + foreach ($array2 as $property => $value) { + if (!array_key_exists($property, $array1)) { + return true; + } + if (is_array($value)) { + if (!is_array($array1[$property])) { + return true; + } + if ($array1[$property] != $value && $this->arraysDiffer($array1[$property], $value)) { + return true; + } + continue; + } + if ($array1[$property] != $value) { + return true; + } + } + + return false; + } + + /** * Find if a valid webhook exists in a service's hooks list. * * @param \Platformsh\Client\Model\Integration $integration * @param array $jsonResult * - * @return bool + * @return array|false */ private function findWebHook(Integration $integration, array $jsonResult) { @@ -319,10 +371,10 @@ $hookUrl = $integration->getLink('#hook'); foreach ($jsonResult as $hook) { if ($type === 'github' && $hook['config']['url'] === $hookUrl) { - return true; + return $hook; } if ($type === 'gitlab' && $hook['url'] === $hookUrl) { - return true; + return $hook; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Integration/IntegrationDeleteCommand.php new/platformsh-cli-3.30.0/src/Command/Integration/IntegrationDeleteCommand.php --- old/platformsh-cli-3.29.2/src/Command/Integration/IntegrationDeleteCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Integration/IntegrationDeleteCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -17,7 +17,7 @@ ->setName('integration:delete') ->addArgument('id', InputArgument::REQUIRED, 'The integration ID') ->setDescription('Delete an integration from a project'); - $this->addProjectOption()->addNoWaitOption(); + $this->addProjectOption()->addWaitOptions(); } protected function execute(InputInterface $input, OutputInterface $output) @@ -48,7 +48,7 @@ $this->stdErr->writeln(sprintf('Deleted integration <info>%s</info>', $integration->id)); - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $activityMonitor->waitMultiple($result->getActivities(), $this->getSelectedProject()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Integration/IntegrationUpdateCommand.php new/platformsh-cli-3.30.0/src/Command/Integration/IntegrationUpdateCommand.php --- old/platformsh-cli-3.29.2/src/Command/Integration/IntegrationUpdateCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Integration/IntegrationUpdateCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -17,7 +17,7 @@ ->addArgument('id', InputArgument::REQUIRED, 'The ID of the integration to update') ->setDescription('Update an integration'); $this->getForm()->configureInputDefinition($this->getDefinition()); - $this->addProjectOption()->addNoWaitOption(); + $this->addProjectOption()->addWaitOptions(); $this->addExample( 'Switch on the "fetch branches" option for a specific integration', 'ZXhhbXBsZSB --fetch-branches 1' @@ -71,7 +71,7 @@ $this->displayIntegration($integration); - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $activityMonitor->waitMultiple($result->getActivities(), $this->getSelectedProject()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Project/ProjectInfoCommand.php new/platformsh-cli-3.30.0/src/Command/Project/ProjectInfoCommand.php --- old/platformsh-cli-3.29.2/src/Command/Project/ProjectInfoCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Project/ProjectInfoCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -29,7 +29,7 @@ ->setDescription('Read or set properties for a project'); PropertyFormatter::configureInput($this->getDefinition()); Table::configureInput($this->getDefinition()); - $this->addProjectOption()->addNoWaitOption(); + $this->addProjectOption()->addWaitOptions(); $this->addExample('Read all project properties') ->addExample("Show the project's Git URL", 'git') ->addExample("Change the project's title", 'title "My project"'); @@ -55,7 +55,7 @@ $value = $input->getArgument('value'); if ($value !== null) { - return $this->setProperty($property, $value, $project, $input->getOption('no-wait')); + return $this->setProperty($property, $value, $project, !$this->shouldWait($input)); } switch ($property) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Project/Variable/ProjectVariableDeleteCommand.php new/platformsh-cli-3.30.0/src/Command/Project/Variable/ProjectVariableDeleteCommand.php --- old/platformsh-cli-3.29.2/src/Command/Project/Variable/ProjectVariableDeleteCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Project/Variable/ProjectVariableDeleteCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -18,7 +18,7 @@ ->addArgument('name', InputArgument::REQUIRED, 'The variable name') ->setDescription('Delete a variable from a project'); $this->addProjectOption() - ->addNoWaitOption(); + ->addWaitOptions(); $this->addExample('Delete the variable "example"', 'example'); } @@ -64,7 +64,7 @@ $success = true; if (!$result->countActivities()) { $this->redeployWarning(); - } elseif (!$input->getOption('no-wait')) { + } elseif ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $success = $activityMonitor->waitMultiple($result->getActivities(), $this->getSelectedProject()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Project/Variable/ProjectVariableSetCommand.php new/platformsh-cli-3.30.0/src/Command/Project/Variable/ProjectVariableSetCommand.php --- old/platformsh-cli-3.29.2/src/Command/Project/Variable/ProjectVariableSetCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Project/Variable/ProjectVariableSetCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -24,7 +24,7 @@ ->addOption('no-visible-runtime', null, InputOption::VALUE_NONE, 'Do not expose this variable at runtime') ->setDescription('Set a variable for a project'); $this->addProjectOption() - ->addNoWaitOption(); + ->addWaitOptions(); $this->addExample('Set the variable "example" to the string "123"', 'example 123'); $this->addExample('Set the variable "example" to the Boolean TRUE', 'example --json true'); $this->addExample('Set the variable "example" to a list of values', 'example --json \'["value1", "value2"]\''); @@ -64,7 +64,7 @@ $success = true; if (!$result->countActivities()) { $this->redeployWarning(); - } elseif (!$input->getOption('no-wait')) { + } elseif ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $success = $activityMonitor->waitMultiple($result->getActivities(), $this->getSelectedProject()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Self/SelfInstallCommand.php new/platformsh-cli-3.30.0/src/Command/Self/SelfInstallCommand.php --- old/platformsh-cli-3.29.2/src/Command/Self/SelfInstallCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Self/SelfInstallCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -32,17 +32,14 @@ 'shell-config-bash.rc', ]; $rcDestination = $configDir . DIRECTORY_SEPARATOR . 'shell-config.rc'; + $fs = new \Symfony\Component\Filesystem\Filesystem(); foreach ($rcFiles as $rcFile) { if (($rcContents = file_get_contents(CLI_ROOT . '/' . $rcFile)) === false) { $this->stdErr->writeln(sprintf('Failed to read file: %s', CLI_ROOT . '/' . $rcFile)); return 1; } - if (file_put_contents($configDir . '/' . $rcFile, $rcContents) === false) { - $this->stdErr->writeln(sprintf('Failed to write file: %s', $configDir . '/' . $rcFile)); - - return 1; - } + $fs->dumpFile($configDir . '/' . $rcFile, $rcContents); } $shellConfigFile = $this->findShellConfigFile(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Self/SelfReleaseCommand.php new/platformsh-cli-3.30.0/src/Command/Self/SelfReleaseCommand.php --- old/platformsh-cli-3.29.2/src/Command/Self/SelfReleaseCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Self/SelfReleaseCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -6,6 +6,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Filesystem\Filesystem; class SelfReleaseCommand extends CommandBase { @@ -190,21 +191,20 @@ $pharPublicFilename = $this->config()->get('application.executable') . '.phar'; $this->stdErr->writeln(' Found latest version: v' . $lastVersion); - $changelog = $git->execute([ - 'log', - '--pretty=format:* %s', - '--no-merges', - '--invert-grep', - '--grep=(Release v|\[skip changelog\])', - '--perl-regexp', - '--regexp-ignore-case', - 'v' . $lastVersion . '...HEAD' - ], CLI_ROOT); - $changelog = is_string($changelog) ? $changelog : ''; + + $changelog = $this->getReleaseChangelog($lastVersion); + $questionText = "\nChangelog:\n\n" . $changelog . "\n\nIs this changelog correct?"; + /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ + $questionHelper = $this->getService('question_helper'); + if (!$questionHelper->confirm($questionText)) { + $this->stdErr->writeln('Update the file <comment>' . CLI_ROOT . '/release-changelog.md</comment> and re-run this command.'); + + return 1; + } $manifestItem['version'] = $newVersion; $manifestItem['sha1'] = sha1_file($pharFilename); - $manifestItem['sha256'] = hash('sha256', $pharFilename); + $manifestItem['sha256'] = hash_file('sha256', $pharFilename); $manifestItem['name'] = basename($pharPublicFilename); $manifestItem['url'] = 'https://github.com/' . $repoUrl . '/releases/download/' . $tagName . '/' . $pharPublicFilename; $manifestItem['php']['min'] = '5.5.9'; @@ -319,4 +319,51 @@ return 0; } + + /** + * @param string $lastVersion The last version number. + * + * @return string + */ + private function getReleaseChangelog($lastVersion) + { + $lastVersionTag = 'v' . ltrim($lastVersion, 'v'); + $filename = CLI_ROOT . '/release-changelog.md'; + if (file_exists($filename)) { + $contents = file_get_contents($filename); + if ($contents === false) { + throw new \RuntimeException('Failed to read file: ' . $filename); + } + $changelog = trim($contents); + } + if (empty($changelog)) { + $changelog = $this->getGitChangelog($lastVersionTag); + (new Filesystem())->dumpFile($filename, $changelog); + } + + return $changelog; + } + + /** + * @param string $since + * + * @return string + */ + private function getGitChangelog($since) + { + /** @var \Platformsh\Cli\Service\Git $git */ + $git = $this->getService('git'); + $changelog = $git->execute([ + 'log', + '--pretty=format:* %s', + '--no-merges', + '--invert-grep', + '--grep=(Release v|\[skip changelog\])', + '--perl-regexp', + '--regexp-ignore-case', + $since . '...HEAD' + ], CLI_ROOT); + + return is_string($changelog) ? $changelog : ''; + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Snapshot/SnapshotCreateCommand.php new/platformsh-cli-3.30.0/src/Command/Snapshot/SnapshotCreateCommand.php --- old/platformsh-cli-3.29.2/src/Command/Snapshot/SnapshotCreateCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Snapshot/SnapshotCreateCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -17,7 +17,7 @@ ->addArgument('environment', InputArgument::OPTIONAL, 'The environment'); $this->addProjectOption() ->addEnvironmentOption() - ->addNoWaitOption('Do not wait for the snapshot to complete'); + ->addWaitOptions(); $this->setHiddenAliases(['backup', 'environment:backup']); $this->addExample('Make a snapshot of the current environment'); $this->addExample('Request a snapshot (and exit quickly)', '--no-wait'); @@ -44,7 +44,7 @@ $this->stdErr->writeln("Creating a snapshot of <info>$environmentId</info>"); - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { $this->stdErr->writeln('Waiting for the snapshot to complete...'); // Strongly recommend using --no-wait in a cron job. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Snapshot/SnapshotRestoreCommand.php new/platformsh-cli-3.30.0/src/Command/Snapshot/SnapshotRestoreCommand.php --- old/platformsh-cli-3.29.2/src/Command/Snapshot/SnapshotRestoreCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Snapshot/SnapshotRestoreCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -18,7 +18,7 @@ ->addArgument('snapshot', InputArgument::OPTIONAL, 'The name of the snapshot. Defaults to the most recent one'); $this->addProjectOption() ->addEnvironmentOption() - ->addNoWaitOption(); + ->addWaitOptions(); $this->setHiddenAliases(['environment:restore']); $this->addExample('Restore the most recent snapshot'); $this->addExample('Restore a specific snapshot', '92c9a4b2aa75422efb3d'); @@ -85,7 +85,7 @@ $this->stdErr->writeln("Restoring snapshot <info>$name</info>"); $activity = $selectedActivity->restore(); - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { $this->stdErr->writeln('Waiting for the restore to complete...'); /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/User/UserAddCommand.php new/platformsh-cli-3.30.0/src/Command/User/UserAddCommand.php --- old/platformsh-cli-3.29.2/src/Command/User/UserAddCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/User/UserAddCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -25,7 +25,7 @@ ->addArgument('email', InputArgument::OPTIONAL, "The user's email address") ->addOption('role', 'r', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, "The user's role: 'admin' or 'viewer', or environment-specific role e.g. 'master:contributor' or 'stage:viewer'"); $this->addProjectOption(); - $this->addNoWaitOption(); + $this->addWaitOptions(); $this->addExample('Add Alice as a project admin', '[email protected] -r admin'); $this->addExample('Make Bob an admin on the "develop" and "stage" environments', '[email protected] -r develop:a,stage:a'); } @@ -280,7 +280,7 @@ } // Wait for activities to complete. - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); if (!$activityMonitor->waitMultiple($activities, $project)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/User/UserDeleteCommand.php new/platformsh-cli-3.30.0/src/Command/User/UserDeleteCommand.php --- old/platformsh-cli-3.29.2/src/Command/User/UserDeleteCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/User/UserDeleteCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -15,7 +15,7 @@ ->setName('user:delete') ->setDescription('Delete a user from the project') ->addArgument('email', InputArgument::REQUIRED, "The user's email address"); - $this->addProjectOption()->addNoWaitOption(); + $this->addProjectOption()->addWaitOptions(); $this->addExample('Delete Alice from the project', '[email protected]'); } @@ -53,7 +53,7 @@ $this->stdErr->writeln("User <info>$email</info> deleted"); - if (!$input->getOption('no-wait')) { + if ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $activityMonitor->waitMultiple($result->getActivities(), $project); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/User/UserRoleCommand.php new/platformsh-cli-3.30.0/src/Command/User/UserRoleCommand.php --- old/platformsh-cli-3.29.2/src/Command/User/UserRoleCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/User/UserRoleCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -22,7 +22,7 @@ ->addOption('pipe', null, InputOption::VALUE_NONE, 'Output the role to stdout (after making any changes)'); $this->addProjectOption() ->addEnvironmentOption() - ->addNoWaitOption(); + ->addWaitOptions(); // Backwards compatibility. $this->setHiddenAliases(['user:role']); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Variable/VariableDeleteCommand.php new/platformsh-cli-3.30.0/src/Command/Variable/VariableDeleteCommand.php --- old/platformsh-cli-3.29.2/src/Command/Variable/VariableDeleteCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Variable/VariableDeleteCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -19,7 +19,7 @@ ->setDescription('Delete a variable from an environment'); $this->addProjectOption() ->addEnvironmentOption() - ->addNoWaitOption(); + ->addWaitOptions(); $this->addExample('Delete the variable "example"', 'example'); } @@ -69,7 +69,7 @@ $success = true; if (!$result->countActivities()) { $this->redeployWarning(); - } elseif (!$input->getOption('no-wait')) { + } elseif ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $success = $activityMonitor->waitMultiple($result->getActivities(), $this->getSelectedProject()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Variable/VariableDisableCommand.php new/platformsh-cli-3.30.0/src/Command/Variable/VariableDisableCommand.php --- old/platformsh-cli-3.29.2/src/Command/Variable/VariableDisableCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Variable/VariableDisableCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -21,7 +21,7 @@ ->setDescription('Disable an enabled environment-level variable'); $this->addProjectOption() ->addEnvironmentOption() - ->addNoWaitOption(); + ->addWaitOptions(); } protected function execute(InputInterface $input, OutputInterface $output) @@ -54,7 +54,7 @@ $success = true; if (!$result->countActivities()) { $this->redeployWarning(); - } elseif (!$input->getOption('no-wait')) { + } elseif ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $success = $activityMonitor->waitMultiple($result->getActivities(), $this->getSelectedProject()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Variable/VariableEnableCommand.php new/platformsh-cli-3.30.0/src/Command/Variable/VariableEnableCommand.php --- old/platformsh-cli-3.29.2/src/Command/Variable/VariableEnableCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Variable/VariableEnableCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -21,7 +21,7 @@ ->setDescription('Enable a disabled environment-level variable'); $this->addProjectOption() ->addEnvironmentOption() - ->addNoWaitOption(); + ->addWaitOptions(); } protected function execute(InputInterface $input, OutputInterface $output) @@ -54,7 +54,7 @@ $success = true; if (!$result->countActivities()) { $this->redeployWarning(); - } elseif (!$input->getOption('no-wait')) { + } elseif ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $success = $activityMonitor->waitMultiple($result->getActivities(), $this->getSelectedProject()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Command/Variable/VariableSetCommand.php new/platformsh-cli-3.30.0/src/Command/Variable/VariableSetCommand.php --- old/platformsh-cli-3.29.2/src/Command/Variable/VariableSetCommand.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Command/Variable/VariableSetCommand.php 2018-03-01 12:53:28.000000000 +0100 @@ -25,7 +25,7 @@ ->setDescription('Set a variable for an environment'); $this->addProjectOption() ->addEnvironmentOption() - ->addNoWaitOption(); + ->addWaitOptions(); $this->addExample('Set the variable "example" to the string "123"', 'example 123'); $this->addExample('Set the variable "example" to the Boolean TRUE', 'example --json true'); $this->addExample('Set the variable "example" to a list of values', 'example --json \'["value1", "value2"]\''); @@ -66,7 +66,7 @@ $success = true; if (!$result->countActivities()) { $this->redeployWarning(); - } elseif (!$input->getOption('no-wait')) { + } elseif ($this->shouldWait($input)) { /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ $activityMonitor = $this->getService('activity_monitor'); $success = $activityMonitor->waitMultiple($result->getActivities(), $this->getSelectedProject()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Service/ActivityMonitor.php new/platformsh-cli-3.30.0/src/Service/ActivityMonitor.php --- old/platformsh-cli-3.29.2/src/Service/ActivityMonitor.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Service/ActivityMonitor.php 2018-03-01 12:53:28.000000000 +0100 @@ -70,7 +70,7 @@ $stdErr->writeln(sprintf( 'Waiting for the activity <info>%s</info> (%s):', $activity->id, - $activity->getDescription() + self::getFormattedDescription($activity) )); // The progress bar will show elapsed time and the activity's state. @@ -206,7 +206,7 @@ // Display success or failure messages for each activity. $success = true; foreach ($activities as $activity) { - $description = $activity->getDescription(); + $description = self::getFormattedDescription($activity); switch ($activity['result']) { case Activity::RESULT_SUCCESS: $stdErr->writeln(sprintf('Activity <info>%s</info> succeeded: %s', $activity->id, $description)); @@ -271,4 +271,24 @@ return new ProgressBar($progressOutput); } + + /** + * Get the formatted description of an activity. + * + * @param \Platformsh\Client\Model\Activity $activity + * + * @return string + */ + public static function getFormattedDescription(Activity $activity) + { + $value = $activity->hasProperty('description') + ? $activity->getProperty('description') + : $activity->getDescription(true); + + // Replace description HTML fields with underlined plain text. + $value = preg_replace('/<[^\/>]+>/', '<options=underscore>', $value); + $value = preg_replace('/<\/[^>]+>/', '</>', $value); + + return $value; + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.29.2/src/Service/QuestionHelper.php new/platformsh-cli-3.30.0/src/Service/QuestionHelper.php --- old/platformsh-cli-3.29.2/src/Service/QuestionHelper.php 2018-02-20 10:23:04.000000000 +0100 +++ new/platformsh-cli-3.30.0/src/Service/QuestionHelper.php 2018-03-01 12:53:28.000000000 +0100 @@ -56,6 +56,9 @@ } elseif ($no && !$yes) { $this->output->writeln($questionText . 'n'); return false; + } elseif (!$this->input->isInteractive()) { + $this->output->writeln($questionText . ($default ? 'y' : 'n')); + return $default; } $question = new ConfirmationQuestion($questionText, $default); ++++++ platformsh-cli-vendor.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/autoload.php new/vendor/autoload.php --- old/vendor/autoload.php 2018-02-20 21:08:52.380129790 +0100 +++ new/vendor/autoload.php 2018-03-02 02:34:43.143555839 +0100 @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitdee6653bdfce9d73ea95515dcebed31e::getLoader(); +return ComposerAutoloaderInit3cffc5631be129fcb36d114cc9a40b12::getLoader(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/autoload_real.php new/vendor/composer/autoload_real.php --- old/vendor/composer/autoload_real.php 2018-02-20 21:08:52.380129790 +0100 +++ new/vendor/composer/autoload_real.php 2018-03-02 02:34:43.143555839 +0100 @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitdee6653bdfce9d73ea95515dcebed31e +class ComposerAutoloaderInit3cffc5631be129fcb36d114cc9a40b12 { private static $loader; @@ -19,15 +19,15 @@ return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitdee6653bdfce9d73ea95515dcebed31e', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit3cffc5631be129fcb36d114cc9a40b12', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitdee6653bdfce9d73ea95515dcebed31e', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit3cffc5631be129fcb36d114cc9a40b12', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitdee6653bdfce9d73ea95515dcebed31e::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit3cffc5631be129fcb36d114cc9a40b12::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitdee6653bdfce9d73ea95515dcebed31e::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit3cffc5631be129fcb36d114cc9a40b12::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequiredee6653bdfce9d73ea95515dcebed31e($fileIdentifier, $file); + composerRequire3cffc5631be129fcb36d114cc9a40b12($fileIdentifier, $file); } return $loader; } } -function composerRequiredee6653bdfce9d73ea95515dcebed31e($fileIdentifier, $file) +function composerRequire3cffc5631be129fcb36d114cc9a40b12($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/autoload_static.php new/vendor/composer/autoload_static.php --- old/vendor/composer/autoload_static.php 2018-02-20 21:08:52.380129790 +0100 +++ new/vendor/composer/autoload_static.php 2018-03-02 02:34:43.143555839 +0100 @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitdee6653bdfce9d73ea95515dcebed31e +class ComposerStaticInit3cffc5631be129fcb36d114cc9a40b12 { public static $files = array ( '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', @@ -195,9 +195,9 @@ public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitdee6653bdfce9d73ea95515dcebed31e::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitdee6653bdfce9d73ea95515dcebed31e::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitdee6653bdfce9d73ea95515dcebed31e::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit3cffc5631be129fcb36d114cc9a40b12::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit3cffc5631be129fcb36d114cc9a40b12::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit3cffc5631be129fcb36d114cc9a40b12::$classMap; }, null, ClassLoader::class); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/installed.json new/vendor/composer/installed.json --- old/vendor/composer/installed.json 2018-02-20 21:08:51.796124539 +0100 +++ new/vendor/composer/installed.json 2018-03-02 02:34:42.195545857 +0100 @@ -778,17 +778,17 @@ }, { "name": "platformsh/client", - "version": "v0.15.0", - "version_normalized": "0.15.0.0", + "version": "v0.16.2", + "version_normalized": "0.16.2.0", "source": { "type": "git", "url": "https://github.com/platformsh/platformsh-client-php.git", - "reference": "1ab0bd8d229dda78b4a545379fd107de4ead872c" + "reference": "d148ca8d4c3239ada8441515a4d8a02067037c96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/1ab0bd8d229dda78b4a545379fd107de4ead872c", - "reference": "1ab0bd8d229dda78b4a545379fd107de4ead872c", + "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/d148ca8d4c3239ada8441515a4d8a02067037c96", + "reference": "d148ca8d4c3239ada8441515a4d8a02067037c96", "shasum": "" }, "require": { @@ -801,7 +801,7 @@ "require-dev": { "phpunit/phpunit": "~4.5" }, - "time": "2018-02-12T10:31:29+00:00", + "time": "2018-03-01T00:18:35+00:00", "type": "library", "extra": { "patches": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/platformsh/client/src/Model/Activity.php new/vendor/platformsh/client/src/Model/Activity.php --- old/vendor/platformsh/client/src/Model/Activity.php 2018-02-12 11:31:29.000000000 +0100 +++ new/vendor/platformsh/client/src/Model/Activity.php 2018-03-01 01:18:35.000000000 +0100 @@ -120,10 +120,22 @@ /** * Get a human-readable description of the activity. * + * @param bool $html Whether to include HTML in the output. + * + * @deprecated + * Use the "description" property instead, for a description wrapped in + * HTML tags. Or for plain text, just run it through strip_tags(). + * * @return string */ - public function getDescription() + public function getDescription($html = false) { + if ($this->hasProperty('description')) { + $description = $this->getProperty('description'); + + return $html ? $description : strip_tags($description); + } + $type = $this->getProperty('type'); $payload = $this->getProperty('payload'); switch ($type) { @@ -214,6 +226,13 @@ $payload['environment']['title'] ); + case 'environment.redeploy': + return sprintf( + '%s redeployed environment %s', + $payload['user']['display_name'], + $payload['environment']['title'] + ); + case 'environment.restore': return sprintf( '%s restored %s from snapshot %s', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/platformsh/client/src/Model/Environment.php new/vendor/platformsh/client/src/Model/Environment.php --- old/vendor/platformsh/client/src/Model/Environment.php 2018-02-12 11:31:29.000000000 +0100 +++ new/vendor/platformsh/client/src/Model/Environment.php 2018-03-01 01:18:35.000000000 +0100 @@ -519,4 +519,14 @@ return EnvironmentAccess::create($body, $this->getLink('#manage-access'), $this->client); } + + /** + * Redeploy the environment. + * + * @return Activity + */ + public function redeploy() + { + return $this->runLongOperation('redeploy'); + } }
