Hello community, here is the log from the commit of package platformsh-cli for openSUSE:Factory checked in at 2017-04-20 20:57:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/platformsh-cli (Old) and /work/SRC/openSUSE:Factory/.platformsh-cli.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "platformsh-cli" Thu Apr 20 20:57:27 2017 rev:7 rq:488982 version:3.14.5 Changes: -------- --- /work/SRC/openSUSE:Factory/platformsh-cli/platformsh-cli.changes 2017-04-11 09:45:18.955786401 +0200 +++ /work/SRC/openSUSE:Factory/.platformsh-cli.new/platformsh-cli.changes 2017-04-20 20:57:29.688434459 +0200 @@ -1,0 +2,23 @@ +Mon Apr 17 19:55:10 UTC 2017 - [email protected] + +- Update to version 3.14.5: + * Fix wrong QuestionHelper argument in "get" command + * Remove two other non-type-hinted uses of getService() + * Use ConsoleOutputInterface for stderr feature detection + * Ensure target is realpath in symlink() + * Release v3.14.5 + +------------------------------------------------------------------- +Sun Apr 16 00:01:19 UTC 2017 - [email protected] + +- Update to version 3.14.4: + * Further improved timeout in project:create (blocking) + * Move orphan logic up into buildEnvironmentTree + * List 10 activities by default + * More info with verbose output for a successful db:dump + * Issue #585: Don't add bashisms to .profile + * Make available plans/regions configurable + * Fix URL opening on OS X (#586) + * Release v3.14.4 + +------------------------------------------------------------------- Old: ---- platformsh-cli-3.14.3.tar.xz New: ---- platformsh-cli-3.14.5.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ platformsh-cli.spec ++++++ --- /var/tmp/diff_new_pack.gEwBDb/_old 2017-04-20 20:57:30.388335480 +0200 +++ /var/tmp/diff_new_pack.gEwBDb/_new 2017-04-20 20:57:30.388335480 +0200 @@ -17,7 +17,7 @@ Name: platformsh-cli -Version: 3.14.3 +Version: 3.14.5 Release: 0 Summary: The unified tool for managing your Platform.sh services from the command line. # See licenses.txt for dependency licenses. ++++++ _service ++++++ --- /var/tmp/diff_new_pack.gEwBDb/_old 2017-04-20 20:57:30.424330390 +0200 +++ /var/tmp/diff_new_pack.gEwBDb/_new 2017-04-20 20:57:30.424330390 +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.14.3</param> + <param name="revision">refs/tags/v3.14.5</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.gEwBDb/_old 2017-04-20 20:57:30.444327562 +0200 +++ /var/tmp/diff_new_pack.gEwBDb/_new 2017-04-20 20:57:30.448326996 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/platformsh/platformsh-cli.git</param> - <param name="changesrevision">58be68721d54f4d64eb7ee73f6f3b1309450906c</param> + <param name="changesrevision">83d450528b0f2bc0dd108a8ed1e526a620f916fe</param> </service> </servicedata> ++++++ platformsh-cli-3.14.3.tar.xz -> platformsh-cli-3.14.5.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/config.yaml new/platformsh-cli-3.14.5/config.yaml --- old/platformsh-cli-3.14.3/config.yaml 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/config.yaml 2017-04-17 17:47:07.000000000 +0200 @@ -1,7 +1,7 @@ # Metadata about the CLI application itself. application: name: 'Platform.sh CLI' - version: '3.14.3' + version: '3.14.5' executable: 'platform' phar: 'platform.phar' package_name: 'platformsh/cli' @@ -33,6 +33,14 @@ project_config_dir: '.platform' docs_url: 'https://docs.platform.sh' accounts_url: 'https://accounts.platform.sh' + available_regions: + - eu.platform.sh + - us.platform.sh + available_plans: + - development + - standard + - medium + - large # Configuration relating to API calls. # This can be overridden in the user config file. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/dist/installer.php new/platformsh-cli-3.14.5/dist/installer.php --- old/platformsh-cli-3.14.3/dist/installer.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/dist/installer.php 2017-04-17 17:47:07.000000000 +0200 @@ -388,16 +388,12 @@ { $candidates = array( $home . '/.bash_profile', - $home . '/.profile', $home . '/.bashrc', ); $shell = str_replace('/bin/', '', getenv('SHELL')); if ($shell === 'zsh') { array_unshift($candidates, $home . '/.zshrc'); array_unshift($candidates, $home . '/.zprofile'); - } elseif ($shell === 'tcsh') { - array_unshift($candidates, $home . '/.cshrc'); - array_unshift($candidates, $home . '/.tcshrc'); } foreach ($candidates as $candidate) { if (file_exists($candidate)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Command/Activity/ActivityListCommand.php new/platformsh-cli-3.14.5/src/Command/Activity/ActivityListCommand.php --- old/platformsh-cli-3.14.3/src/Command/Activity/ActivityListCommand.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Command/Activity/ActivityListCommand.php 2017-04-17 17:47:07.000000000 +0200 @@ -20,7 +20,7 @@ ->setName('activity:list') ->setAliases(['activities']) ->addOption('type', null, InputOption::VALUE_REQUIRED, 'Filter activities by type') - ->addOption('limit', null, InputOption::VALUE_REQUIRED, 'Limit the number of results displayed', 5) + ->addOption('limit', null, InputOption::VALUE_REQUIRED, 'Limit the number of results displayed', 10) ->addOption('start', null, InputOption::VALUE_REQUIRED, 'Only activities created before this date will be listed') ->addOption('all', 'a', InputOption::VALUE_NONE, 'Check activities on all environments') ->setDescription('Get a list of activities for an environment or project'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Command/CommandBase.php new/platformsh-cli-3.14.5/src/Command/CommandBase.php --- old/platformsh-cli-3.14.3/src/Command/CommandBase.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Command/CommandBase.php 2017-04-17 17:47:07.000000000 +0200 @@ -780,6 +780,28 @@ } /** + * Offer the user an interactive choice of projects. + * + * @param Project[] $projects + * @param string $text + * + * @return string + * The chosen project ID. + */ + protected function offerProjectChoice(array $projects, $text = 'Enter a number to choose a project:') + { + $projectList = []; + foreach ($projects as $project) { + $projectList[$project->id] = $this->api()->getProjectLabel($project, false); + } + + /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ + $questionHelper = $this->getService('question_helper'); + + return $questionHelper->choose($projectList, $text); + } + + /** * @param InputInterface $input * @param bool $envNotRequired */ @@ -998,6 +1020,14 @@ * Services are configured in services.yml, and loaded via the Symfony * Dependency Injection component. * + * When using this method, always store the result in a temporary variable, + * so that the service's type can be hinted in a variable docblock (allowing + * IDEs and other analysers to check subsequent code). For example: + * <code> + * /** @var \Platformsh\Cli\Service\Filesystem $fs *\/ + * $fs = $this->getService('fs'); + * </code> + * * @param string $name The service name. See services.yml for a list. * * @return object The associated service object. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Command/Db/DbDumpCommand.php new/platformsh-cli-3.14.5/src/Command/Db/DbDumpCommand.php --- old/platformsh-cli-3.14.3/src/Command/Db/DbDumpCommand.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Command/Db/DbDumpCommand.php 2017-04-17 17:47:07.000000000 +0200 @@ -4,6 +4,7 @@ use Platformsh\Cli\Command\CommandBase; use Platformsh\Cli\Service\Ssh; use Platformsh\Cli\Service\Relationships; +use Symfony\Component\Console\Helper\Helper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -174,10 +175,19 @@ } // Execute the SSH command. + $start = microtime(true); /** @var \Platformsh\Cli\Service\Shell $shell */ $shell = $this->getService('shell'); $exitCode = $shell->executeSimple($command); + if ($exitCode === 0) { + $this->stdErr->writeln('The dump completed successfully', OutputInterface::VERBOSITY_VERBOSE); + $this->stdErr->writeln(sprintf(' Time: %ss', number_format(microtime(true) - $start, 2)), OutputInterface::VERBOSITY_VERBOSE); + if ($dumpFile && ($size = filesize($dumpFile)) !== false) { + $this->stdErr->writeln(sprintf(' Size: %s', Helper::formatMemory($size)), OutputInterface::VERBOSITY_VERBOSE); + } + } + // If a dump file exists, check that it's excluded in the project's // .gitignore configuration. if ($dumpFile && file_exists($dumpFile) && isset($projectRoot) && strpos($dumpFile, $projectRoot) === 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Command/Environment/EnvironmentListCommand.php new/platformsh-cli-3.14.5/src/Command/Environment/EnvironmentListCommand.php --- old/platformsh-cli-3.14.3/src/Command/Environment/EnvironmentListCommand.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Command/Environment/EnvironmentListCommand.php 2017-04-17 17:47:07.000000000 +0200 @@ -38,16 +38,22 @@ /** * Build a tree out of a list of environments. * - * @param Environment[] $environments - * @param string $parent + * @param Environment[] $environments The list of environments, keyed by ID. + * @param string|null $parent The parent environment for which to + * build a tree. * - * @return array + * @return Environment[] A list of the children of $parent, keyed by ID. + * Children of all environments are stored in the + * property $this->children. */ protected function buildEnvironmentTree(array $environments, $parent = null) { $children = []; foreach ($environments as $environment) { - if ($environment->parent === $parent) { + // Root nodes are both the environments whose parent is null, and + // environments whose parent does not exist. + if ($environment->parent === $parent + || ($parent === null && !isset($environments[$environment->parent]))) { $this->children[$environment->id] = $this->buildEnvironmentTree( $environments, $environment->id @@ -151,15 +157,6 @@ $tree = $this->buildEnvironmentTree($environments); - // Add orphaned environments (those whose parents do not exist) and - // their children to the tree. - foreach ($environments as $id => $environment) { - if (!isset($tree[$id]) && !empty($environment->parent) && !isset($environments[$environment->parent])) { - $tree[$id] = $environment; - $this->children[$id] = $this->buildEnvironmentTree($environments, $id); - } - } - // To make the display nicer, we move all the children of master // to the top level. if (isset($this->children['master'])) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Command/Local/LocalDrushAliasesCommand.php new/platformsh-cli-3.14.5/src/Command/Local/LocalDrushAliasesCommand.php --- old/platformsh-cli-3.14.3/src/Command/Local/LocalDrushAliasesCommand.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Command/Local/LocalDrushAliasesCommand.php 2017-04-17 17:47:07.000000000 +0200 @@ -4,6 +4,7 @@ use Platformsh\Cli\Command\CommandBase; use Platformsh\Cli\Exception\RootNotFoundException; use Platformsh\Cli\Local\BuildFlavor\Drupal; +use Platformsh\Cli\Service\Filesystem; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -85,7 +86,7 @@ $drush->createAliases($project, $projectRoot, $environments, $current_group); if ($new_group != $current_group) { - $drushDir = $this->getService('fs')->getHomeDirectory() . '/.drush'; + $drushDir = Filesystem::getHomeDirectory() . '/.drush'; $oldFile = $drushDir . '/' . $current_group . '.aliases.drushrc.php'; if (file_exists($oldFile)) { if ($questionHelper->confirm("Delete old Drush alias group <info>@$current_group</info>?")) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Command/Project/ProjectCreateCommand.php new/platformsh-cli-3.14.5/src/Command/Project/ProjectCreateCommand.php --- old/platformsh-cli-3.14.3/src/Command/Project/ProjectCreateCommand.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Command/Project/ProjectCreateCommand.php 2017-04-17 17:47:07.000000000 +0200 @@ -5,7 +5,6 @@ use GuzzleHttp\Exception\ConnectException; use Platformsh\Cli\Command\CommandBase; use Platformsh\Cli\Console\Bot; -use Platformsh\Client\Model\Subscription; use Platformsh\ConsoleForm\Field\Field; use Platformsh\ConsoleForm\Field\OptionsField; use Platformsh\ConsoleForm\Form; @@ -90,12 +89,17 @@ $bot = new Bot($this->stdErr); $timedOut = false; - $start = time(); + $start = $lastCheck = time(); while ($subscription->isPending() && !$timedOut) { $bot->render(); - if (!isset($lastCheck) || time() - $lastCheck >= 2) { + // Attempt to check the subscription every 3 seconds. This also + // waits 3 seconds before the first check, which allows the server + // a little more leeway to act on the initial request. + if (time() - $lastCheck >= 3) { try { - $subscription->refresh(['timeout' => 10, 'exceptions' => false]); + // Each request can only last up to 3 seconds (otherwise the + // animation would be blocked). + $subscription->refresh(['timeout' => 3, 'exceptions' => false]); $lastCheck = time(); } catch (ConnectException $e) { if (strpos($e->getMessage(), 'timed out') !== false) { @@ -105,6 +109,7 @@ } } } + // Time out after 15 minutes. $timedOut = time() - $start > 900; } $this->stdErr->writeln(''); @@ -130,7 +135,8 @@ /** * Return a list of plans. * - * The default list (from the API client) can be overridden by user config. + * The default list is in the config `service.available_plans`. This can be + * overridden by the user config `experimental.available_plans`. * * @return string[] */ @@ -141,13 +147,14 @@ return $config->get('experimental.available_plans'); } - return Subscription::$availablePlans; + return $config->get('service.available_plans'); } /** * Return a list of regions. * - * The default list (from the API client) can be overridden by user config. + * The default list is in the config `service.available_regions`. This can + * be overridden by the user config `experimental.available_regions`. * * @return string[] */ @@ -158,7 +165,7 @@ return $config->get('experimental.available_regions'); } - return Subscription::$availableRegions; + return $config->get('service.available_regions'); } /** @@ -183,7 +190,7 @@ 'optionName' => 'plan', 'description' => 'The subscription plan', 'options' => $this->getAvailablePlans(), - 'default' => 'development', + 'default' => in_array('development', $this->getAvailablePlans()) ? 'development' : null, ]), 'environments' => new Field('Environments', [ 'optionName' => 'environments', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Command/Project/ProjectGetCommand.php new/platformsh-cli-3.14.5/src/Command/Project/ProjectGetCommand.php --- old/platformsh-cli-3.14.3/src/Command/Project/ProjectGetCommand.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Command/Project/ProjectGetCommand.php 2017-04-17 17:47:07.000000000 +0200 @@ -187,25 +187,6 @@ } /** - * @param Project[] $projects - * @param InputInterface $input - * - * @return string - * The chosen project ID. - */ - protected function offerProjectChoice(array $projects, InputInterface $input) - { - $projectList = []; - foreach ($projects as $project) { - $projectList[$project->id] = $this->api()->getProjectLabel($project, false); - } - $text = "Enter a number to choose which project to clone:"; - - return $this->getService('question_helper') - ->choose($projectList, $text, $input, $this->stdErr); - } - - /** * {@inheritdoc} */ protected function validateInput(InputInterface $input, $envNotRequired = false) @@ -218,7 +199,7 @@ $host = $input->getOption('host'); if (empty($projectId)) { if ($input->isInteractive() && ($projects = $this->api()->getProjects(true))) { - $projectId = $this->offerProjectChoice($projects, $input); + $projectId = $this->offerProjectChoice($projects, 'Enter a number to choose which project to clone:'); } else { throw new InvalidArgumentException('No project specified'); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Command/Server/ServerCommandBase.php new/platformsh-cli-3.14.5/src/Command/Server/ServerCommandBase.php --- old/platformsh-cli-3.14.3/src/Command/Server/ServerCommandBase.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Command/Server/ServerCommandBase.php 2017-04-17 17:47:07.000000000 +0200 @@ -2,6 +2,7 @@ namespace Platformsh\Cli\Command\Server; use Platformsh\Cli\Command\CommandBase; +use Platformsh\Cli\Util\OsUtil; use Platformsh\Cli\Util\PortUtil; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\StreamOutput; @@ -246,7 +247,7 @@ $this->showSecurityWarning(); - $arguments[] = $this->getService('shell')->resolveCommand('php'); + $arguments[] = 'php'; foreach ($this->getServerPhpConfig() as $item => $value) { $arguments[] = sprintf('-d %s="%s"', $item, $value); @@ -261,7 +262,7 @@ ]); // An 'exec' is needed to stop creating two processes on some OSs. - if (strpos(PHP_OS, 'WIN') === false) { + if (!OsUtil::isWindows()) { array_unshift($arguments, 'exec'); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Command/Tunnel/TunnelCommandBase.php new/platformsh-cli-3.14.5/src/Command/Tunnel/TunnelCommandBase.php --- old/platformsh-cli-3.14.3/src/Command/Tunnel/TunnelCommandBase.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Command/Tunnel/TunnelCommandBase.php 2017-04-17 17:47:07.000000000 +0200 @@ -2,6 +2,7 @@ namespace Platformsh\Cli\Command\Tunnel; use Platformsh\Cli\Command\CommandBase; +use Platformsh\Cli\Util\OsUtil; use Platformsh\Cli\Util\PortUtil; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -226,7 +227,7 @@ protected function createTunnelProcess($url, $remoteHost, $remotePort, $localPort, array $extraArgs = []) { $args = ['ssh', '-n', '-N', '-L', implode(':', [$localPort, $remoteHost, $remotePort]), $url]; - if (strpos(PHP_OS, 'WIN') === false) { + if (!OsUtil::isWindows()) { array_unshift($args, 'exec'); } $args = array_merge($args, $extraArgs); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Local/DependencyInstaller.php new/platformsh-cli-3.14.5/src/Local/DependencyInstaller.php --- old/platformsh-cli-3.14.3/src/Local/DependencyInstaller.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Local/DependencyInstaller.php 2017-04-17 17:47:07.000000000 +0200 @@ -2,6 +2,7 @@ namespace Platformsh\Cli\Local; use Platformsh\Cli\Service\Shell; +use Platformsh\Cli\Util\OsUtil; use Symfony\Component\Console\Output\OutputInterface; class DependencyInstaller @@ -33,7 +34,7 @@ } $paths = array_filter(array_map('realpath', $paths)); if (!empty($paths)) { - $pathVariable = stripos(PHP_OS, 'WIN') === 0 ? 'Path' : 'PATH'; + $pathVariable = OsUtil::isWindows() ? 'Path' : 'PATH'; $env[$pathVariable] = implode(':', $paths); if (getenv($pathVariable)) { $env[$pathVariable] .= ':' . getenv($pathVariable); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Local/LocalBuild.php new/platformsh-cli-3.14.5/src/Local/LocalBuild.php --- old/platformsh-cli-3.14.3/src/Local/LocalBuild.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Local/LocalBuild.php 2017-04-17 17:47:07.000000000 +0200 @@ -6,6 +6,7 @@ use Platformsh\Cli\Service\Git; use Platformsh\Cli\Service\Shell; use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Finder\Finder; @@ -57,7 +58,7 @@ ) { $this->config = $config ?: new Config(); $this->output = $output ?: new ConsoleOutput(); - if ($this->output instanceof ConsoleOutput) { + if ($this->output instanceof ConsoleOutputInterface) { $this->output = $this->output->getErrorOutput(); } $this->shellHelper = $shell ?: new Shell($this->output); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Service/ActivityMonitor.php new/platformsh-cli-3.14.5/src/Service/ActivityMonitor.php --- old/platformsh-cli-3.14.3/src/Service/ActivityMonitor.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Service/ActivityMonitor.php 2017-04-17 17:47:07.000000000 +0200 @@ -5,7 +5,7 @@ use Platformsh\Client\Model\Activity; use Platformsh\Client\Model\Project; use Symfony\Component\Console\Helper\ProgressBar; -use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Console\Output\OutputInterface; @@ -38,7 +38,7 @@ */ protected function getStdErr() { - return $this->output instanceof ConsoleOutput ? $this->output->getErrorOutput() : $this->output; + return $this->output instanceof ConsoleOutputInterface ? $this->output->getErrorOutput() : $this->output; } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Service/Filesystem.php new/platformsh-cli-3.14.5/src/Service/Filesystem.php --- old/platformsh-cli-3.14.3/src/Service/Filesystem.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Service/Filesystem.php 2017-04-17 17:47:07.000000000 +0200 @@ -2,6 +2,7 @@ namespace Platformsh\Cli\Service; +use Platformsh\Cli\Util\OsUtil; use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem; @@ -46,7 +47,7 @@ public function setRelativeLinks($relative = true) { // This is not possible on Windows. - if ($this->isWindows()) { + if (OsUtil::isWindows()) { $relative = false; } $this->relative = $relative; @@ -214,8 +215,8 @@ /** * Create a symbolic link to a file or directory. * - * @param string $target - * @param string $link + * @param string $target The target to link to (must already exist). + * @param string $link The name of the symbolic link. */ public function symlink($target, $link) { @@ -223,7 +224,7 @@ throw new \InvalidArgumentException('Target not found: ' . $target); } if ($this->relative) { - $target = rtrim($this->fs->makePathRelative($target, dirname($link)), '/'); + $target = rtrim($this->fs->makePathRelative(realpath($target), dirname($link)), '/'); } $this->fs->symlink($target, $link, $this->copyOnWindows); } @@ -385,7 +386,7 @@ */ protected function fixTarPath($path) { - if ($this->isWindows()) { + if (OsUtil::isWindows()) { $path = preg_replace_callback( '#^([A-Z]):/#i', function (array $matches) { @@ -411,12 +412,4 @@ } throw new \RuntimeException("Tar command not found"); } - - /** - * @return bool - */ - protected function isWindows() - { - return stripos(PHP_OS, 'WIN') === 0; - } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Service/Relationships.php new/platformsh-cli-3.14.5/src/Service/Relationships.php --- old/platformsh-cli-3.14.3/src/Service/Relationships.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Service/Relationships.php 2017-04-17 17:47:07.000000000 +0200 @@ -5,7 +5,7 @@ use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; class Relationships implements InputConfiguringInterface @@ -40,7 +40,7 @@ */ public function chooseDatabase($sshUrl, InputInterface $input, OutputInterface $output) { - $stdErr = $output instanceof ConsoleOutput ? $output->getErrorOutput() : $output; + $stdErr = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output; $relationships = $this->getRelationships($sshUrl); // Filter to find database (mysql and pgsql) relationships. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Service/Shell.php new/platformsh-cli-3.14.5/src/Service/Shell.php --- old/platformsh-cli-3.14.3/src/Service/Shell.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Service/Shell.php 2017-04-17 17:47:07.000000000 +0200 @@ -2,6 +2,7 @@ namespace Platformsh\Cli\Service; +use Platformsh\Cli\Util\OsUtil; use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Console\Output\OutputInterface; @@ -226,7 +227,7 @@ $result[$command] = $command; } else { $args = ['command', '-v', $command]; - if (strpos(PHP_OS, 'WIN') !== false) { + if (OsUtil::isWindows()) { $args = ['where', $command]; } $result[$command] = $this->execute($args, null, false, true); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Service/Url.php new/platformsh-cli-3.14.5/src/Service/Url.php --- old/platformsh-cli-3.14.3/src/Service/Url.php 2017-04-03 11:47:22.000000000 +0200 +++ new/platformsh-cli-3.14.5/src/Service/Url.php 2017-04-17 17:47:07.000000000 +0200 @@ -2,6 +2,7 @@ namespace Platformsh\Cli\Service; +use Platformsh\Cli\Util\OsUtil; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -13,12 +14,16 @@ protected $input; protected $shell; protected $output; + protected $stdErr; public function __construct(Shell $shell, InputInterface $input, OutputInterface $output) { $this->shell = $shell; $this->input = $input; $this->output = $output; + $this->stdErr = $this->output instanceof ConsoleOutputInterface + ? $this->output->getErrorOutput() + : $this->output; } /** @@ -47,45 +52,50 @@ */ public function openUrl($url) { - $stdErr = $this->output instanceof ConsoleOutputInterface - ? $this->output->getErrorOutput() - : $this->output; + if ($browser = $this->getBrowser()) { + $this->shell->executeSimple($browser . ' ' . escapeshellarg($url)); + } + + $this->output->writeln($url); + } + + /** + * Finds the browser to use. + * + * @return string|false A browser command, or false if no browser can or + * should be used. + */ + protected function getBrowser() + { $browser = $this->input->hasOption('browser') ? $this->input->getOption('browser') : null; + // If the user wants to pipe the output to another command, stop here. if ($this->input->hasOption('pipe') && $this->input->getOption('pipe')) { - $this->output->writeln($url); - return; - } - - if (!getenv('DISPLAY') && strpos(PHP_OS, 'WIN') === false) { - if ($browser !== '0' && $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { - $stdErr->writeln(sprintf('Not opening URL %s (no display found)', $url)); - } - return; + return false; } + // Check if the user has requested not to use a browser. if ($browser === '0') { - // The user has requested not to use a browser. - $browser = false; - } elseif (empty($browser)) { - // Find a default browser to use. - $browser = $this->getDefaultBrowser(); - } elseif (!$this->shell->commandExists($browser)) { - // The user has specified a browser, but it can't be found. - $stdErr->writeln("<error>Browser not found: $browser</error>"); - $browser = false; + return false; } - if ($browser) { - $opened = $this->shell->execute(array($browser, $url)); - if ($opened) { - $stdErr->writeln("Opened: $url"); + // Check for a display (if not on Windows or OS X). + if (!getenv('DISPLAY') && !OsUtil::isWindows() && !OsUtil::isOsX()) { + $this->stdErr->writeln('Not opening URL (no display found)', OutputInterface::VERBOSITY_VERBOSE); + return false; + } - return; + if (!empty($browser)) { + list($command, ) = explode(' ', $browser, 2); + if (!$this->shell->commandExists($command)) { + $this->stdErr->writeln(sprintf('Command not found: <error>%s</error>', $command)); + return false; } + + return $browser; } - $this->output->writeln($url); + return $this->getDefaultBrowser(); } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.14.3/src/Util/OsUtil.php new/platformsh-cli-3.14.5/src/Util/OsUtil.php --- old/platformsh-cli-3.14.3/src/Util/OsUtil.php 1970-01-01 01:00:00.000000000 +0100 +++ new/platformsh-cli-3.14.5/src/Util/OsUtil.php 2017-04-17 17:47:07.000000000 +0200 @@ -0,0 +1,22 @@ +<?php + +namespace Platformsh\Cli\Util; + +class OsUtil +{ + /** + * @return bool + */ + public static function isWindows() + { + return defined('PHP_WINDOWS_VERSION_BUILD'); + } + + /** + * @return bool + */ + public static function isOsX() + { + return stripos(PHP_OS, 'Darwin') !== false; + } +} ++++++ 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-04-05 02:03:59.954280895 +0200 +++ new/vendor/autoload.php 2017-04-17 21:55:12.125530733 +0200 @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitacf2ba94a9accb74314baf070e9b3c54::getLoader(); +return ComposerAutoloaderInit59f49ba76a04edda4e14e6e75ac6892a::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-04-05 02:03:59.954280895 +0200 +++ new/vendor/composer/autoload_real.php 2017-04-17 21:55:12.125530733 +0200 @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitacf2ba94a9accb74314baf070e9b3c54 +class ComposerAutoloaderInit59f49ba76a04edda4e14e6e75ac6892a { private static $loader; @@ -19,15 +19,15 @@ return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitacf2ba94a9accb74314baf070e9b3c54', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit59f49ba76a04edda4e14e6e75ac6892a', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitacf2ba94a9accb74314baf070e9b3c54', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit59f49ba76a04edda4e14e6e75ac6892a', '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\ComposerStaticInitacf2ba94a9accb74314baf070e9b3c54::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit59f49ba76a04edda4e14e6e75ac6892a::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\ComposerStaticInitacf2ba94a9accb74314baf070e9b3c54::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit59f49ba76a04edda4e14e6e75ac6892a::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequireacf2ba94a9accb74314baf070e9b3c54($fileIdentifier, $file); + composerRequire59f49ba76a04edda4e14e6e75ac6892a($fileIdentifier, $file); } return $loader; } } -function composerRequireacf2ba94a9accb74314baf070e9b3c54($fileIdentifier, $file) +function composerRequire59f49ba76a04edda4e14e6e75ac6892a($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-04-05 02:03:59.954280895 +0200 +++ new/vendor/composer/autoload_static.php 2017-04-17 21:55:12.125530733 +0200 @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitacf2ba94a9accb74314baf070e9b3c54 +class ComposerStaticInit59f49ba76a04edda4e14e6e75ac6892a { 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 = ComposerStaticInitacf2ba94a9accb74314baf070e9b3c54::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitacf2ba94a9accb74314baf070e9b3c54::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitacf2ba94a9accb74314baf070e9b3c54::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit59f49ba76a04edda4e14e6e75ac6892a::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit59f49ba76a04edda4e14e6e75ac6892a::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit59f49ba76a04edda4e14e6e75ac6892a::$classMap; }, null, ClassLoader::class); }
