From b512dd6ba4f8b809bba797ed9260b78f2ffe6822 Mon Sep 17 00:00:00 2001 From: Dmitri Gopkalo Date: Fri, 9 Aug 2019 00:07:46 +0300 Subject: - add ability get-binary command to skip the same version downloading --- bin/rr | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) mode change 100644 => 100755 bin/rr (limited to 'bin/rr') diff --git a/bin/rr b/bin/rr old mode 100644 new mode 100755 index 71670ff4..d0363601 --- a/bin/rr +++ b/bin/rr @@ -197,12 +197,20 @@ class RRHelper } if (is_file($finalFile)) { + $version = RRHelper::getVersion(); + $previousVersion = shell_exec($finalFile . ' | awk \'/\'Version:\'/ { gsub(/[^[:digit:]\.]+/, "", $2); printf $2}\''); $output->writeln('RoadRunner binary file already exists!'); $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('Current version: %s', $previousVersion)); + $question = new ConfirmationQuestion(sprintf('Skip update to the same version: %s ? [Y/n]', $version)); + if ($helper->ask($input, $output, $question)) { + return; + } + } else { + if (!$helper->ask($input, $output, new ConfirmationQuestion('Do you want overwrite it? [Y/n] '))) { + return; + } } } -- cgit v1.2.3