module Dory::Os

Public Class Methods

arch?() click to toggle source
# File lib/dory/os.rb, line 15
def self.arch?
  self.bash(self.arch_cmd)
end
arch_cmd() click to toggle source
# 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) click to toggle source
# File lib/dory/os.rb, line 3
def self.bash(command)
  system("bash -c '#{command}'")
end
fedora?() click to toggle source
# File lib/dory/os.rb, line 11
def self.fedora?
  self.bash(self.fedora_cmd)
end
fedora_cmd() click to toggle source
# 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?() click to toggle source
# File lib/dory/os.rb, line 19
def self.macos?
  self.bash('uname -a | grep "Darwin" > /dev/null')
end
ubuntu?() click to toggle source
# File lib/dory/os.rb, line 7
def self.ubuntu?
  self.bash(self.ubuntu_cmd)
end
ubuntu_cmd() click to toggle source
# 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