Преглед на файлове

refactor: use debian destro concept

Mark24 преди 2 години
родител
ревизия
7788070ec9
променени са 4 файла, в които са добавени 11 реда и са изтрити 14 реда
  1. 2 2
      installer.rb
  2. 2 2
      lib/config.rb
  3. 7 7
      os/DebianDistroLinux.rb
  4. 0 3
      os/UbuntuLinux.rb

+ 2 - 2
installer.rb

@@ -8,7 +8,7 @@ module OSPatch
     os_release_file = "/etc/os-release"
     if File.exist?(os_release_file)
       os_release = File.read(os_release_file)
-      ::RimeDeploy::OSDetect::DebianDistro.each do |distro|
+      ::RimeDeploy::DebianDistroLinux::DebianDistro.each do |distro|
         return true if os_release.include?(distro)
       end
     end
@@ -20,7 +20,7 @@ module OSPatch
       @osname = "MacOS"
     when /linux/
       if check_linux_debian_distro
-        @osname = "DebianLinux"
+        @osname = "DebianDistroLinux"
       else
         not_support_exit
       end

+ 2 - 2
lib/config.rb

@@ -1,6 +1,5 @@
 module RimeDeploy
   module OSDetect
-    DebianDistro = %w[debian ubuntu linuxmint linux-mint]
   end
   module Config
     RIME_CONFIG_REPO = "https://github.com/iDvel/rime-ice.git"
@@ -9,7 +8,8 @@ module RimeDeploy
       ConfigPath = "~/Library/Rime"
     end
 
-    class DebianLinux
+    class DebianDistroLinux
+      DebianDistro = %w[debian ubuntu linuxmint linux-mint]
       InstallCmd = "sudo apt install ibus-rime"
       ConfigPath = "~/.config/ibus/rime"
     end

+ 7 - 7
os/DebianLinux.rb → os/DebianDistroLinux.rb

@@ -1,10 +1,10 @@
 module RimeDeploy
-  module DebianLinux
+  module DebianDistroLinux
     class InstallRimeJob < Job
       def call
         puts intro
         puts "use Rime-ibus".yellow
-        system(Config::DebianLinux::InstallCmd)
+        system(Config::DebianDistroLinux::InstallCmd)
         sleep 1
         return :next
       end
@@ -14,7 +14,7 @@ module RimeDeploy
       def call
         puts intro
         system(
-          "mv #{Config::DebianLinux::ConfigPath} #{Config::DebianLinux::ConfigPath}.#{Time.now.to_i}.old"
+          "mv #{Config::DebianDistroLinux::ConfigPath} #{Config::DebianDistroLinux::ConfigPath}.#{Time.now.to_i}.old"
         )
         sleep 1
         return :next
@@ -25,7 +25,7 @@ module RimeDeploy
       def call
         puts intro
         system(
-          "git clone --depth=1 #{Config::RIME_CONFIG_REPO} #{Config::DebianLinux::ConfigPath}"
+          "git clone --depth=1 #{Config::RIME_CONFIG_REPO} #{Config::DebianDistroLinux::ConfigPath}"
         )
         sleep 1
         return :next
@@ -36,10 +36,10 @@ module RimeDeploy
       def call
         puts intro
         system(
-          "cp ./custom/default.custom.yaml #{Config::DebianLinux::ConfigPath}/"
+          "cp ./custom/default.custom.yaml #{Config::DebianDistroLinux::ConfigPath}/"
         )
         system(
-          "cp ./custom/squirrel.custom.yaml #{Config::DebianLinux::ConfigPath}/"
+          "cp ./custom/squirrel.custom.yaml #{Config::DebianDistroLinux::ConfigPath}/"
         )
         sleep 1
         return :next
@@ -55,7 +55,7 @@ module RimeDeploy
                "DEPLOY".yellow + " button."
         puts "Enjoy~ 🍻"
         puts "more info:".yellow
-        puts "Config path: #{Config::DebianLinux::ConfigPath}/"
+        puts "Config path: #{Config::DebianDistroLinux::ConfigPath}/"
         return :next
       end
     end

+ 0 - 3
os/UbuntuLinux.rb

@@ -1,3 +0,0 @@
-module RimeDeploy
-  alias UbuntuLinux DebianLinux
-end