Commit d09b2d10fd1d26765c9e9f22317be64d821872bb

Thomas de Grivel 2023-02-26T02:59:01

rbpkg_ci_mux

diff --git a/bin/rbpkg_ci b/bin/rbpkg_ci
index 3723cca..0e2ff49 100755
--- a/bin/rbpkg_ci
+++ b/bin/rbpkg_ci
@@ -37,6 +37,7 @@ def rbpkg_ci
     cmd = "rm -rf #{sh_quote(Rbpkg.ci_dir)}"
     verbose(1, cmd)
     raise "command failed: #{cmd.inspect}" unless system(cmd)
+    Rbpkg.ci_init
     Rbpkg::Log.ok_all
     exit 0
   when "-h"
diff --git a/bin/rbpkg_ci_mux b/bin/rbpkg_ci_mux
index ff822a1..8675d38 100755
--- a/bin/rbpkg_ci_mux
+++ b/bin/rbpkg_ci_mux
@@ -34,37 +34,40 @@ end
 def rbpkg_ci_mux
   clean = false
   upgrade = false
-  while (case $ARGS[0]
-         when "--clean"
-           shift
-           cmd = "rm -rf #{sh_quote(Rbpkg.ci_dir)}"
-           verbose(1, cmd)
-           raise "command failed: #{cmd.inspect}" unless system(cmd)
-           Rbpkg.ci_init
-           hosts = $ARGS
-           hosts.each do |host|
-             cmd! "ssh #{sh_quote(host)} rbpkg/bin/rbpkg_ci --clean"
-           end
-           Rbpkg::Log.ok_all
-           exit 0
-         when "-h"
-           usage
-         when "--help"
-           usage
-         when "--no-remote"
-           Rbpkg.ci_mux
-           Rbpkg::Log.ok_all
-           exit 0
-         when "--upgrade"
-           Rbpkg.upgrade_self
-           shift
-           hosts = $ARGS
-           hosts.each do |host|
-             cmd! "ssh #{sh_quote(host)} rbpkg/bin/rbpkg upgrade"
-           end
-           Rbpkg::Log.ok_all
-           exit 0
-         end)
+  pop_arg = proc {
+    case $ARGS[0]
+    when "--clean"
+      shift
+      cmd = "rm -rf #{sh_quote(Rbpkg.ci_dir)}"
+      verbose(1, cmd)
+      raise "command failed: #{cmd.inspect}" unless system(cmd)
+      Rbpkg.ci_init
+      hosts = $ARGS
+      hosts.each do |host|
+        cmd! "ssh #{sh_quote(host)} rbpkg/bin/rbpkg_ci --clean"
+      end
+      Rbpkg::Log.ok_all
+      exit 0
+    when "-h"
+      usage
+    when "--help"
+      usage
+    when "--no-remote"
+      Rbpkg.ci_mux
+      Rbpkg::Log.ok_all
+      exit 0
+    when "--upgrade"
+      Rbpkg.upgrade_self
+      shift
+      hosts = $ARGS
+      hosts.each do |host|
+        cmd! "ssh #{sh_quote(host)} rbpkg/bin/rbpkg upgrade"
+      end
+      Rbpkg::Log.ok_all
+      exit 0
+    end
+  }
+  while pop_arg.()
     true
   end
   repo = shift