Class: Babushka::SystemDetector
- Defined in:
- lib/babushka/system_detector.rb
Class Method Summary collapse
- .detect_debian_derivative ⇒ Object
- .detect_using_release_file ⇒ Object
- .detect_using_uname ⇒ Object
- .profile_for_host ⇒ Object
Class Method Details
.detect_debian_derivative ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/babushka/system_detector.rb', line 34 def self.detect_debian_derivative if File.exists?('/etc/lsb-release') && File.read('/etc/lsb-release')[/ubuntu/i] UbuntuSystemProfile elsif File.exists?('/etc/os-release') && File.read('/etc/os-release')[/ID=raspbian/] RaspbianSystemProfile else DebianSystemProfile end end |
.detect_using_release_file ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/babushka/system_detector.rb', line 18 def self.detect_using_release_file if File.exists?('/etc/debian_version') detect_debian_derivative elsif File.exists?('/etc/arch-release') ArchSystemProfile elsif File.exists?('/etc/fedora-release') FedoraSystemProfile elsif File.exists?('/etc/centos-release') CentOSSystemProfile elsif File.exists?('/etc/redhat-release') RedhatSystemProfile elsif File.exists?('/etc/SuSE-release') SuseSystemProfile end end |
.detect_using_uname ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/babushka/system_detector.rb', line 9 def self.detect_using_uname case ShellHelpers.shell('uname -s') when 'Darwin'; OSXSystemProfile when 'DragonFly'; DragonFlySystemProfile when 'FreeBSD'; FreeBSDSystemProfile when 'Linux'; detect_using_release_file || LinuxSystemProfile end end |
.profile_for_host ⇒ Object
3 4 5 |
# File 'lib/babushka/system_detector.rb', line 3 def self.profile_for_host (detect_using_uname || UnknownSystem).new end |