installer.rb 714 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env ruby
  2. require "./lib/core"
  3. require "./lib/config"
  4. require "./share/upgrade"
  5. module OSPatch
  6. def check_os
  7. case RUBY_PLATFORM.downcase
  8. when /darwin/
  9. @osname = "MacOS"
  10. when /linux/
  11. @osname = "LinuxDistro"
  12. when /mswin|win32|mingw|cygwin/
  13. @osname = "Windows"
  14. else
  15. not_support_exit
  16. end
  17. end
  18. end
  19. module RimeDeploy
  20. class Installer
  21. include OSPatch
  22. def initialize
  23. @osname = nil
  24. check_os
  25. run
  26. end
  27. def not_support_exit
  28. puts "Not support this system. Bye~"
  29. exit 0
  30. end
  31. def run
  32. require "./os/#{@osname}"
  33. instance_eval("#{@osname}JobGroup.new.call")
  34. end
  35. end
  36. end
  37. RimeDeploy::Installer.new