installer.rb 688 B

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