diff options
author | Anton Titov <[email protected]> | 2019-08-12 11:09:05 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2019-08-12 11:09:05 +0300 |
commit | eef69c2d4018f7224b9744b76afd550f4e72c85f (patch) | |
tree | 98e9995e939ea2e32583d3c24aa7aa72d32119dc | |
parent | 97d6b6b0d52918ef253e7cb65e50e7b51f4fe28d (diff) | |
parent | 79f7983f1a8f2e0c4743cfcecd8d14c3aa0a6c4d (diff) |
Merge pull request #178 from drefixs/get-skip-the-same-version
- add ability get-binary command to skip the same version downloading
-rwxr-xr-x[-rw-r--r--] | bin/rr | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -197,12 +197,25 @@ class RRHelper } if (is_file($finalFile)) { + $version = RRHelper::getVersion(); + $previousVersion = + preg_match('#Version:.+(\d+\.\d+\.\d+)#', (string)shell_exec($finalFile), $mathes) ? + $mathes[1] : ""; $output->writeln('<error>RoadRunner binary file already exists!</error>'); $helper = $this->getHelper('question'); - $question = new ConfirmationQuestion('Do you want overwrite it? [Y/n] '); - - if (!$helper->ask($input, $output, $question)) { - return; + if (version_compare($previousVersion, $version) === 0) { + $output->writeln(sprintf('<info>Current version: %s</info>', $previousVersion)); + $question = new ConfirmationQuestion( + sprintf('Skip update to the same version: %s ? [Y/n]', $version) + ); + if ($helper->ask($input, $output, $question)) { + return; + } + } else { + $question = new ConfirmationQuestion('Do you want overwrite it? [Y/n]'); + if (!$helper->ask($input, $output, $question)) { + return; + } } } |