summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitri Gopkalo <[email protected]>2019-08-09 00:07:46 +0300
committerDmitri Gopkalo <[email protected]>2019-08-09 01:36:34 +0300
commitb512dd6ba4f8b809bba797ed9260b78f2ffe6822 (patch)
tree63380c4cb1f9dbb4d0ce3a9581c9d337717597e8
parent97d6b6b0d52918ef253e7cb65e50e7b51f4fe28d (diff)
- add ability get-binary command to skip the same version downloading
-rwxr-xr-x[-rw-r--r--]bin/rr16
-rw-r--r--cmd/rr/cmd/root.go2
2 files changed, 13 insertions, 5 deletions
diff --git a/bin/rr b/bin/rr
index 71670ff4..d0363601 100644..100755
--- 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('<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 {
+ if (!$helper->ask($input, $output, new ConfirmationQuestion('Do you want overwrite it? [Y/n] '))) {
+ return;
+ }
}
}
diff --git a/cmd/rr/cmd/root.go b/cmd/rr/cmd/root.go
index d6929473..3c2cb8b0 100644
--- a/cmd/rr/cmd/root.go
+++ b/cmd/rr/cmd/root.go
@@ -52,7 +52,7 @@ var (
SilenceErrors: true,
SilenceUsage: true,
Short: util.Sprintf(
- "<green>RoadRunner</reset>, PHP Application Server\nVersion: <yellow+hb>%s</reset>, %s",
+ "<green>RoadRunner</reset>, PHP Application Server\nVersion: %s, %s",
Version,
BuildTime,
),