mac.rb 1.4 KB

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