init
This commit is contained in:
commit
b3dba4542f
44 changed files with 1596 additions and 0 deletions
35
lib/system.rb
Normal file
35
lib/system.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
|
||||
module System
|
||||
def self.detect_os
|
||||
case RUBY_PLATFORM
|
||||
when /darwin/
|
||||
:macos
|
||||
when /linux/
|
||||
if File.exist?('/etc/debian_version')
|
||||
:debian
|
||||
else
|
||||
:linux_other
|
||||
end
|
||||
else
|
||||
:unknown
|
||||
end
|
||||
end
|
||||
|
||||
OS = detect_os
|
||||
|
||||
case OS
|
||||
|
||||
when :macos
|
||||
require_relative './system/macos'
|
||||
extend MacOSSystem
|
||||
when :debian
|
||||
require_relative './system/debian'
|
||||
extend DebianSystem
|
||||
else
|
||||
raise "Operating system not supported"
|
||||
end
|
||||
|
||||
def self.os_info
|
||||
puts os_name
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue