Hello community, here is the log from the commit of package platformsh-cli for openSUSE:Factory checked in at 2017-07-07 10:17:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/platformsh-cli (Old) and /work/SRC/openSUSE:Factory/.platformsh-cli.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "platformsh-cli" Fri Jul 7 10:17:52 2017 rev:14 rq:508629 version:3.18.0 Changes: -------- --- /work/SRC/openSUSE:Factory/platformsh-cli/platformsh-cli.changes 2017-05-31 12:21:37.640433323 +0200 +++ /work/SRC/openSUSE:Factory/.platformsh-cli.new/platformsh-cli.changes 2017-07-07 10:17:54.182635680 +0200 @@ -1,0 +2,17 @@ +Thu Jul 06 19:51:47 UTC 2017 - [email protected] + +- Update to version 3.18.0: + * Promote "create" command + * Unused imports + * Make `create` command return project ID to stdout + * Allow subscription info to be updated (#607) + * Find SSH apps via the new pf:ssh: URLs in the API (#608) + * Add --all option to `ssh` command + * Fix BC for environments without pf:ssh: URLs + * Add/restore interactive choice of environments in `get` command + * ... only ask if >1 environment + * Fix: ssh --all needs new lines + * Leave "create" disabled by feature flag, until pricing estimation API improves + * Release v3.18.0 + +------------------------------------------------------------------- @@ -13,0 +31 @@ +- Include development files in source list. Old: ---- platformsh-cli-3.17.0.tar.xz New: ---- platformsh-cli-3.18.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ platformsh-cli.spec ++++++ --- /var/tmp/diff_new_pack.v4kowK/_old 2017-07-07 10:17:55.258483456 +0200 +++ /var/tmp/diff_new_pack.v4kowK/_new 2017-07-07 10:17:55.262482890 +0200 @@ -17,7 +17,7 @@ Name: platformsh-cli -Version: 3.17.0 +Version: 3.18.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.v4kowK/_old 2017-07-07 10:17:55.294478362 +0200 +++ /var/tmp/diff_new_pack.v4kowK/_new 2017-07-07 10:17:55.298477797 +0200 @@ -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.17.0</param> + <param name="revision">refs/tags/v3.18.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.v4kowK/_old 2017-07-07 10:17:55.314475533 +0200 +++ /var/tmp/diff_new_pack.v4kowK/_new 2017-07-07 10:17:55.314475533 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/platformsh/platformsh-cli.git</param> - <param name="changesrevision">d208570716b87cf061e296d346c0dd342aa3c1ba</param> + <param name="changesrevision">ad46216524679c51cf9c762ff428a1c323264fd7</param> </service> </servicedata> ++++++ licenses.txt ++++++ --- /var/tmp/diff_new_pack.v4kowK/_old 2017-07-07 10:17:55.354469874 +0200 +++ /var/tmp/diff_new_pack.v4kowK/_new 2017-07-07 10:17:55.354469874 +0200 @@ -15,7 +15,7 @@ guzzlehttp/streams 3.0.0 MIT padraic/humbug_get_contents 1.0.4 BSD-3-Clause padraic/phar-updater 1.0.3 BSD-3-Clause -platformsh/client v0.10.3 MIT +platformsh/client v0.11.2 MIT platformsh/console-form v0.0.10 MIT psr/log 1.0.2 MIT react/promise v2.5.1 MIT ++++++ platformsh-cli-3.17.0.tar.xz -> platformsh-cli-3.18.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.17.0/composer.json new/platformsh-cli-3.18.0/composer.json --- old/platformsh-cli-3.17.0/composer.json 2017-05-30 14:25:44.000000000 +0200 +++ new/platformsh-cli-3.18.0/composer.json 2017-07-05 20:36:52.000000000 +0200 @@ -8,7 +8,7 @@ "guzzlehttp/guzzle": "^5.3", "guzzlehttp/ringphp": "^1.1", "platformsh/console-form": "0.0.10", - "platformsh/client": "^0.10", + "platformsh/client": "^0.11", "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.17.0/composer.lock new/platformsh-cli-3.18.0/composer.lock --- old/platformsh-cli-3.17.0/composer.lock 2017-05-30 14:25:44.000000000 +0200 +++ new/platformsh-cli-3.18.0/composer.lock 2017-07-05 20:36:52.000000000 +0200 @@ -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": "2f96c4c4c7449d8115643ed6246dff2b", + "content-hash": "f957991eaff440eb45dfa0be23d53071", "packages": [ { "name": "cocur/slugify", @@ -593,16 +593,16 @@ }, { "name": "platformsh/client", - "version": "v0.10.3", + "version": "v0.11.2", "source": { "type": "git", "url": "https://github.com/platformsh/platformsh-client-php.git", - "reference": "a9f8d69635b72869ce2931c57cef4bd1c5cbea8f" + "reference": "3c8bb553b09665fec4bc42975c624d09d9971c97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/a9f8d69635b72869ce2931c57cef4bd1c5cbea8f", - "reference": "a9f8d69635b72869ce2931c57cef4bd1c5cbea8f", + "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/3c8bb553b09665fec4bc42975c624d09d9971c97", + "reference": "3c8bb553b09665fec4bc42975c624d09d9971c97", "shasum": "" }, "require": { @@ -638,7 +638,7 @@ } ], "description": "Platform.sh API client", - "time": "2017-05-30T10:45:57+00:00" + "time": "2017-07-01T15:17:33+00:00" }, { "name": "platformsh/console-form", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.17.0/config.yaml new/platformsh-cli-3.18.0/config.yaml --- old/platformsh-cli-3.17.0/config.yaml 2017-05-30 14:25:44.000000000 +0200 +++ new/platformsh-cli-3.18.0/config.yaml 2017-07-05 20:36:52.000000000 +0200 @@ -1,7 +1,7 @@ # Metadata about the CLI application itself. application: name: 'Platform.sh CLI' - version: '3.17.0' + version: '3.18.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.17.0/src/Command/CommandBase.php new/platformsh-cli-3.18.0/src/Command/CommandBase.php --- old/platformsh-cli-3.17.0/src/Command/CommandBase.php 2017-05-30 14:25:44.000000000 +0200 +++ new/platformsh-cli-3.18.0/src/Command/CommandBase.php 2017-07-05 20:36:52.000000000 +0200 @@ -665,38 +665,26 @@ * * @param InputInterface $input * The user input object. - * @param callable|null $filter - * A filter callback that takes one argument: a LocalApplication object. * * @return string|null * The application name, or null if it could not be found. */ - protected function selectApp(InputInterface $input, callable $filter = null) + protected function selectApp(InputInterface $input) { $appName = $input->getOption('app'); if ($appName) { return $appName; } - $projectRoot = $this->getProjectRoot(); - if (!$projectRoot || !$this->selectedProjectIsCurrent()) { - return null; - } - - $this->debug('Searching for applications in local repository'); - /** @var LocalApplication[] $apps */ - $apps = LocalApplication::getApplications($projectRoot, $this->config()); - - if ($filter) { - $apps = array_filter($apps, $filter); - } - if (count($apps) > 1 && $input->isInteractive()) { + $environment = $this->getSelectedEnvironment(); + $apps = array_keys($environment->getSshUrls()); + $this->debug('Found app(s): ' . implode(',', $apps)); + if (count($apps) === 1) { + $appName = reset($apps); + } elseif ($input->isInteractive()) { /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ $questionHelper = $this->getService('question_helper'); - $choices = []; - foreach ($apps as $app) { - $choices[$app->getName()] = $app->getName(); - } + $choices = array_combine($apps, $apps); $appName = $questionHelper->choose($choices, 'Enter a number to choose an app:'); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.17.0/src/Command/Environment/EnvironmentDrushCommand.php new/platformsh-cli-3.18.0/src/Command/Environment/EnvironmentDrushCommand.php --- old/platformsh-cli-3.17.0/src/Command/Environment/EnvironmentDrushCommand.php 2017-05-30 14:25:44.000000000 +0200 +++ new/platformsh-cli-3.18.0/src/Command/Environment/EnvironmentDrushCommand.php 2017-07-05 20:36:52.000000000 +0200 @@ -61,9 +61,7 @@ $drushCommand .= " --quiet"; } - $appName = $this->selectApp($input, function (LocalApplication $app) { - return Drupal::isDrupal($app->getRoot()); - }); + $appName = $this->selectApp($input); $selectedEnvironment = $this->getSelectedEnvironment(); $sshUrl = $selectedEnvironment->getSshUrl($appName); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.17.0/src/Command/Environment/EnvironmentSshCommand.php new/platformsh-cli-3.18.0/src/Command/Environment/EnvironmentSshCommand.php --- old/platformsh-cli-3.17.0/src/Command/Environment/EnvironmentSshCommand.php 2017-05-30 14:25:44.000000000 +0200 +++ new/platformsh-cli-3.18.0/src/Command/Environment/EnvironmentSshCommand.php 2017-07-05 20:36:52.000000000 +0200 @@ -21,6 +21,7 @@ ->setAliases(['ssh']) ->addArgument('cmd', InputArgument::OPTIONAL, 'A command to run on the environment.') ->addOption('pipe', null, InputOption::VALUE_NONE, 'Output the SSH URL only.') + ->addOption('all', null, InputOption::VALUE_NONE, 'Output all SSH URLs (for every app).') ->setDescription('SSH to the current environment'); $this->addProjectOption() ->addEnvironmentOption() @@ -33,9 +34,15 @@ protected function execute(InputInterface $input, OutputInterface $output) { $this->validateInput($input); + $environment = $this->getSelectedEnvironment(); - $sshUrl = $this->getSelectedEnvironment() - ->getSshUrl($this->selectApp($input)); + if ($input->getOption('all')) { + $output->writeln(array_values($environment->getSshUrls())); + + return 0; + } + + $sshUrl = $environment->getSshUrl($this->selectApp($input)); if ($input->getOption('pipe')) { $output->write($sshUrl); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.17.0/src/Command/Project/ProjectCreateCommand.php new/platformsh-cli-3.18.0/src/Command/Project/ProjectCreateCommand.php --- old/platformsh-cli-3.17.0/src/Command/Project/ProjectCreateCommand.php 2017-05-30 14:25:44.000000000 +0200 +++ new/platformsh-cli-3.18.0/src/Command/Project/ProjectCreateCommand.php 2017-07-05 20:36:52.000000000 +0200 @@ -125,6 +125,9 @@ } $this->stdErr->writeln("The project is now ready!"); + $output->writeln($subscription->project_id); + $this->stdErr->writeln(''); + $this->stdErr->writeln(" Region: <info>{$subscription->project_region}</info>"); $this->stdErr->writeln(" Project ID: <info>{$subscription->project_id}</info>"); $this->stdErr->writeln(" Project title: <info>{$subscription->project_title}</info>"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.17.0/src/Command/Project/ProjectCurlCommand.php new/platformsh-cli-3.18.0/src/Command/Project/ProjectCurlCommand.php --- old/platformsh-cli-3.17.0/src/Command/Project/ProjectCurlCommand.php 2017-05-30 14:25:44.000000000 +0200 +++ new/platformsh-cli-3.18.0/src/Command/Project/ProjectCurlCommand.php 2017-07-05 20:36:52.000000000 +0200 @@ -5,7 +5,6 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Output\OutputInterface; class ProjectCurlCommand extends CommandBase diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.17.0/src/Command/Project/ProjectGetCommand.php new/platformsh-cli-3.18.0/src/Command/Project/ProjectGetCommand.php --- old/platformsh-cli-3.17.0/src/Command/Project/ProjectGetCommand.php 2017-05-30 14:25:44.000000000 +0200 +++ new/platformsh-cli-3.18.0/src/Command/Project/ProjectGetCommand.php 2017-07-05 20:36:52.000000000 +0200 @@ -210,19 +210,13 @@ $project = $this->selectProject($projectId, $host); - if (!$environmentId) { - $environments = $this->api()->getEnvironments($project); - $environmentId = isset($environments['master']) ? 'master' : key($environments); - } - - $this->selectEnvironment($environmentId); + /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ + $questionHelper = $this->getService('question_helper'); $directory = $input->getArgument('directory'); if (empty($directory)) { $slugify = new Slugify(); $directory = $project->title ? $slugify->slugify($project->title) : $project->id; - /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ - $questionHelper = $this->getService('question_helper'); $directory = $questionHelper->askInput('Directory', $directory, [$directory, $projectId]); } @@ -239,6 +233,16 @@ throw new InvalidArgumentException("Not a directory: " . dirname($directory)); } $this->projectRoot = $parent . '/' . basename($directory); + + if (!$environmentId) { + $environments = $this->api()->getEnvironments($project); + $environmentId = isset($environments['master']) ? 'master' : key($environments); + if (count($environments) > 1) { + $environmentId = $questionHelper->askInput('Environment', $environmentId, array_keys($environments)); + } + } + + $this->selectEnvironment($environmentId); } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.17.0/src/Command/SubscriptionInfoCommand.php new/platformsh-cli-3.18.0/src/Command/SubscriptionInfoCommand.php --- old/platformsh-cli-3.17.0/src/Command/SubscriptionInfoCommand.php 2017-05-30 14:25:44.000000000 +0200 +++ new/platformsh-cli-3.18.0/src/Command/SubscriptionInfoCommand.php 2017-07-05 20:36:52.000000000 +0200 @@ -25,6 +25,7 @@ $this ->setName('subscription:info') ->addArgument('property', InputArgument::OPTIONAL, 'The name of the property') + ->addArgument('value', InputArgument::OPTIONAL, 'Set a new value for the property') ->setDescription('Read subscription properties'); PropertyFormatter::configureInput($this->getDefinition()); Table::configureInput($this->getDefinition()); @@ -54,6 +55,11 @@ return $this->listProperties($subscription); } + $value = $input->getArgument('value'); + if ($value !== null) { + return $this->setProperty($property, $value, $subscription); + } + switch ($property) { case 'url': $value = $subscription->getUri(true); @@ -87,4 +93,72 @@ return 0; } + + /** + * @param string $property + * @param string $value + * @param Subscription $subscription + * + * @return int + */ + protected function setProperty($property, $value, Subscription $subscription) + { + $type = $this->getType($property); + if (!$type) { + $this->stdErr->writeln("Property not writable: <error>$property</error>"); + return 1; + } + if ($type === 'boolean' && $value === 'false') { + $value = false; + } + settype($value, $type); + $currentValue = $subscription->getProperty($property); + if ($currentValue === $value) { + $this->stdErr->writeln( + "Property <info>$property</info> already set as: " . $this->formatter->format($value, $property) + ); + + return 0; + } + + /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ + $questionHelper = $this->getService('question_helper'); + $confirmMessage = sprintf( + "Are you sure you want to change property '%s' from <comment>%s</comment> to <comment>%s</comment>?", + $property, + $this->formatter->format($currentValue, $property), + $this->formatter->format($value, $property) + ); + $warning = sprintf( + '<comment>This action may %s the cost of your subscription.</comment>', + is_numeric($value) && $value > $currentValue ? 'increase' : 'change' + ); + $confirmMessage = $warning . "\n" . $confirmMessage; + if (!$questionHelper->confirm($confirmMessage)) { + return 1; + } + + $subscription->update([$property => $value]); + $this->stdErr->writeln(sprintf( + 'Property <info>%s</info> set to: %s', + $property, + $this->formatter->format($value, $property) + )); + + return 0; + } + + /** + * Get the type of a writable property. + * + * @param string $property + * + * @return string|false + */ + protected function getType($property) + { + $writableProperties = ['plan' => 'string', 'environments' => 'int', 'storage' => 'int']; + + return isset($writableProperties[$property]) ? $writableProperties[$property] : false; + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.17.0/src/Local/BuildFlavor/Drupal.php new/platformsh-cli-3.18.0/src/Local/BuildFlavor/Drupal.php --- old/platformsh-cli-3.17.0/src/Local/BuildFlavor/Drupal.php 2017-05-30 14:25:44.000000000 +0200 +++ new/platformsh-cli-3.18.0/src/Local/BuildFlavor/Drupal.php 2017-07-05 20:36:52.000000000 +0200 @@ -4,7 +4,6 @@ use Platformsh\Cli\Service\Drush; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Finder\Finder; class Drupal extends BuildFlavorBase ++++++ 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 2017-05-30 16:18:50.145942530 +0200 +++ new/vendor/autoload.php 2017-07-06 21:51:51.280562438 +0200 @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit2b8af07a6bcb5c85efd6d055d31a81f6::getLoader(); +return ComposerAutoloaderInit1b142da1e54741a648482d7b2a715fea::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 2017-05-30 16:18:50.145942530 +0200 +++ new/vendor/composer/autoload_real.php 2017-07-06 21:51:51.280562438 +0200 @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit2b8af07a6bcb5c85efd6d055d31a81f6 +class ComposerAutoloaderInit1b142da1e54741a648482d7b2a715fea { private static $loader; @@ -19,15 +19,15 @@ return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit2b8af07a6bcb5c85efd6d055d31a81f6', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit1b142da1e54741a648482d7b2a715fea', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit2b8af07a6bcb5c85efd6d055d31a81f6', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit1b142da1e54741a648482d7b2a715fea', '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\ComposerStaticInit2b8af07a6bcb5c85efd6d055d31a81f6::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit1b142da1e54741a648482d7b2a715fea::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\ComposerStaticInit2b8af07a6bcb5c85efd6d055d31a81f6::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit1b142da1e54741a648482d7b2a715fea::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire2b8af07a6bcb5c85efd6d055d31a81f6($fileIdentifier, $file); + composerRequire1b142da1e54741a648482d7b2a715fea($fileIdentifier, $file); } return $loader; } } -function composerRequire2b8af07a6bcb5c85efd6d055d31a81f6($fileIdentifier, $file) +function composerRequire1b142da1e54741a648482d7b2a715fea($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 2017-05-30 16:18:50.145942530 +0200 +++ new/vendor/composer/autoload_static.php 2017-07-06 21:51:51.280562438 +0200 @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit2b8af07a6bcb5c85efd6d055d31a81f6 +class ComposerStaticInit1b142da1e54741a648482d7b2a715fea { public static $files = array ( '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', @@ -183,9 +183,9 @@ public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit2b8af07a6bcb5c85efd6d055d31a81f6::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit2b8af07a6bcb5c85efd6d055d31a81f6::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit2b8af07a6bcb5c85efd6d055d31a81f6::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit1b142da1e54741a648482d7b2a715fea::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit1b142da1e54741a648482d7b2a715fea::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit1b142da1e54741a648482d7b2a715fea::$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 2017-05-30 16:18:49.969940825 +0200 +++ new/vendor/composer/installed.json 2017-07-06 21:51:50.680556183 +0200 @@ -656,17 +656,17 @@ }, { "name": "platformsh/client", - "version": "v0.10.3", - "version_normalized": "0.10.3.0", + "version": "v0.11.2", + "version_normalized": "0.11.2.0", "source": { "type": "git", "url": "https://github.com/platformsh/platformsh-client-php.git", - "reference": "a9f8d69635b72869ce2931c57cef4bd1c5cbea8f" + "reference": "3c8bb553b09665fec4bc42975c624d09d9971c97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/a9f8d69635b72869ce2931c57cef4bd1c5cbea8f", - "reference": "a9f8d69635b72869ce2931c57cef4bd1c5cbea8f", + "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/3c8bb553b09665fec4bc42975c624d09d9971c97", + "reference": "3c8bb553b09665fec4bc42975c624d09d9971c97", "shasum": "" }, "require": { @@ -679,7 +679,7 @@ "require-dev": { "phpunit/phpunit": "~4.5" }, - "time": "2017-05-30T10:45:57+00:00", + "time": "2017-07-01T15:17:33+00:00", "type": "library", "extra": { "patches": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/platformsh/client/.travis.yml new/vendor/platformsh/client/.travis.yml --- old/vendor/platformsh/client/.travis.yml 2017-05-30 12:45:57.000000000 +0200 +++ new/vendor/platformsh/client/.travis.yml 2017-07-01 17:17:33.000000000 +0200 @@ -1,6 +1,8 @@ language: php +dist: trusty sudo: false php: + - 7.1 - 7.0 - 5.6 - 5.5 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 2017-05-30 12:45:57.000000000 +0200 +++ new/vendor/platformsh/client/src/Model/Environment.php 2017-07-01 17:17:33.000000000 +0200 @@ -55,25 +55,80 @@ * @param string $app An application name. * * @throws EnvironmentStateException + * @throws OperationUnavailableException * * @return string */ public function getSshUrl($app = '') { + $urls = $this->getSshUrls(); + if (isset($urls[$app])) { + return $urls[$app]; + } + + return $this->constructLegacySshUrl($app); + } + + /** + * Get the SSH URL via the legacy 'ssh' link. + * + * @param string $app + * + * @return string + */ + private function constructLegacySshUrl($app) + { if (!$this->hasLink('ssh')) { $id = $this->data['id']; - throw new EnvironmentStateException("The environment '$id' does not have an SSH URL. It may be currently inactive, or you may not have permission to SSH.", $this); + if (!$this->isActive()) { + throw new EnvironmentStateException("No SSH URL found for environment '$id'. It is not currently active.", $this); + } + throw new OperationUnavailableException("No SSH URL found for environment '$id'. You may not have permission to SSH."); } - $sshUrl = parse_url($this->getLink('ssh')); - $host = $sshUrl['host']; - $user = $sshUrl['user']; + $suffix = $app ? '--' . $app : ''; - if ($app) { - $user .= '--' . $app; + return $this->convertSshUrl($this->getLink('ssh'), $suffix); + } + + /** + * Convert a full SSH URL (with schema) into a normal SSH connection string. + * + * @param string $url The URL (starting with ssh://). + * @param string $username_suffix A suffix to append to the username. + * + * @return string + */ + private function convertSshUrl($url, $username_suffix = '') + { + $parsed = parse_url($url); + if (!$parsed) { + throw new \InvalidArgumentException('Invalid URL: ' . $url); + } + + return $parsed['user'] . $username_suffix . '@' . $parsed['host']; + } + + /** + * Returns a list of SSH URLs, keyed by app name. + * + * @return string[] + */ + public function getSshUrls() + { + $prefix = 'pf:ssh:'; + $prefixLength = strlen($prefix); + $sshUrls = []; + foreach ($this->data['_links'] as $rel => $link) { + if (strpos($rel, $prefix) === 0 && isset($link['href'])) { + $sshUrls[substr($rel, $prefixLength)] = $this->convertSshUrl($link['href']); + } + } + if (empty($sshUrls) && $this->hasLink('ssh')) { + $sshUrls[''] = $this->convertSshUrl($this->getLink('ssh')); } - return $user . '@' . $host; + return $sshUrls; } /** @@ -90,7 +145,10 @@ { if (!$this->hasLink('public-url')) { $id = $this->data['id']; - throw new EnvironmentStateException("The environment '$id' does not have a public URL. It may be inactive.", $this); + if (!$this->isActive()) { + throw new EnvironmentStateException("No public URL found for environment '$id'. It is not currently active.", $this); + } + throw new OperationUnavailableException("No public URL found for environment '$id'."); } return $this->getLink('public-url');
