Commit ad514e4dbbed1a6a0e989000ba49ebf5e48ca467

Thomas de Grivel 2023-02-26T03:15:27

rbpkg_ci_mux

diff --git a/bin/rbpkg_ci_mux b/bin/rbpkg_ci_mux
index 8675d38..a33f9b3 100755
--- a/bin/rbpkg_ci_mux
+++ b/bin/rbpkg_ci_mux
@@ -31,43 +31,27 @@ def usage()
   exit 1
 end
 
+def pop_arg
+  case $ARGS[0]
+  when "--clean"
+    rbpkg_ci_mux_clean
+  when "-h"
+    usage
+  when "--help"
+    usage
+  when "--install"
+    rbpkg_ci_mux_install
+  when "--no-remote"
+    Rbpkg.ci_mux
+    Rbpkg::Log.ok_all
+    exit 0
+  when "--upgrade"
+    rbpkg_ci_mux_upgrade
+  end
+end
+
 def rbpkg_ci_mux
-  clean = false
-  upgrade = false
-  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.()
+  while pop_arg
     true
   end
   repo = shift
@@ -87,6 +71,41 @@ def rbpkg_ci_mux
   Rbpkg.ci_mux
 end
 
+def rbpkg_ci_mux_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
+end
+
+def rbpkg_ci_mux_install
+  shift
+  hosts = $ARGS
+  hosts.each do |host|
+    cmd! "ssh #{sh_quote(host)} git clone https://git.kmx.io/kmx.io/rbpkg.git"
+  end
+  Rbpkg::Log.ok_all
+  exit 0
+end
+
+def rbpkg_ci_mux_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
+
 begin
   rbpkg_ci_mux
   Rbpkg::Log.ok_all
diff --git a/lib/rbpkg/log.rb b/lib/rbpkg/log.rb
index 4037cd4..e60b604 100644
--- a/lib/rbpkg/log.rb
+++ b/lib/rbpkg/log.rb
@@ -181,7 +181,7 @@ class String
       "<" => "&lt;",
       ">" => "&gt;"
     }
-    s = clone
+    s = "#{self}"
     substitution.each do |k, v|
       s.gsub!(k, v)
     end