DebianLinux.rb 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. module RimeDeploy
  2. module DebianLinux
  3. class InstallRimeJob < Job
  4. def call
  5. puts intro
  6. puts "use Rime-ibus".yellow
  7. system(Config::DebianLinux::InstallCmd)
  8. sleep 1
  9. return :next
  10. end
  11. end
  12. class BackupRimeConfigJob < Job
  13. def call
  14. puts into
  15. system(
  16. "mv #{Config::DebianLinux::ConfigPath} #{Config::DebianLinux::ConfigPath}.#{Time.now.to_i}.old"
  17. )
  18. sleep 1
  19. return :next
  20. end
  21. end
  22. class CloneConfigJob < Job
  23. def call
  24. puts intro
  25. system(
  26. "git clone #{Config::RIME_CONFIG_REPO} #{Config::DebianLinux::ConfigPath}"
  27. )
  28. sleep 1
  29. return :next
  30. end
  31. end
  32. class CopyCustomConfigJob < Job
  33. def call
  34. puts intro
  35. system(
  36. "cp ./custom/default.custom.yaml #{Config::DebianLinux::ConfigPath}/"
  37. )
  38. system(
  39. "cp ./custom/squirrel.custom.yaml #{Config::DebianLinux::ConfigPath}/"
  40. )
  41. sleep 1
  42. return :next
  43. end
  44. end
  45. class FinishedJob < Job
  46. def call
  47. puts ""
  48. puts "Tips: When finished all jobs. You need to do follow:".yellow
  49. puts "1) Restart system."
  50. puts "2) open Rime input method setting pane and click " +
  51. "DEPLOY".yellow + " button."
  52. puts "Enjoy~ 🍻"
  53. puts "more info:".yellow
  54. puts "Config path: #{Config::DebianLinux::ConfigPath}/"
  55. return :next
  56. end
  57. end
  58. Jobs = [
  59. InstallRimeJob,
  60. BackupRimeConfigJob,
  61. CloneConfigJob,
  62. CopyCustomConfigJob
  63. ]
  64. FinishedHook = [FinishedJob]
  65. end
  66. end