Module: Dory::Os
- Defined in:
- lib/dory/os.rb
Class Method Summary collapse
- .arch? ⇒ Boolean
- .arch_cmd ⇒ Object
- .bash(command) ⇒ Object
- .fedora? ⇒ Boolean
- .fedora_cmd ⇒ Object
- .macos? ⇒ Boolean
- .ubuntu? ⇒ Boolean
- .ubuntu_cmd ⇒ Object
Class Method Details
.arch? ⇒ Boolean
15 16 17 |
# File 'lib/dory/os.rb', line 15 def self.arch? self.bash(self.arch_cmd) end |
.arch_cmd ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/dory/os.rb', line 43 def self.arch_cmd %q( if $(which lsb_release >/dev/null 2>&1); then lsb_release -d | grep --color=auto "Arch" > /dev/null else uname -a | grep --color=auto "ARCH" > /dev/null fi ) end |
.bash(command) ⇒ Object
3 4 5 |
# File 'lib/dory/os.rb', line 3 def self.bash(command) system("bash -c '#{command}'") end |
.fedora? ⇒ Boolean
11 12 13 |
# File 'lib/dory/os.rb', line 11 def self.fedora? self.bash(self.fedora_cmd) end |
.fedora_cmd ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/dory/os.rb', line 33 def self.fedora_cmd %q( if $(which lsb_release >/dev/null 2>&1); then lsb_release -d | grep --color=auto "Fedora" > /dev/null else uname -r | grep --color=auto "fc" > /dev/null fi ) end |
.macos? ⇒ Boolean
19 20 21 |
# File 'lib/dory/os.rb', line 19 def self.macos? self.bash('uname -a | grep "Darwin" > /dev/null') end |
.ubuntu? ⇒ Boolean
7 8 9 |
# File 'lib/dory/os.rb', line 7 def self.ubuntu? self.bash(self.ubuntu_cmd) end |
.ubuntu_cmd ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/dory/os.rb', line 23 def self.ubuntu_cmd %q( if $(which lsb_release >/dev/null 2>&1); then lsb_release -d | grep --color=auto "Ubuntu" > /dev/null else uname -a | grep --color=auto "Ubuntu" > /dev/null fi ) end |