Module: CommandKit::OS::Linux
Overview
Provides methods for determining the specific type of Linux.
Example
require 'command_kit/command'
require 'command_kit/os/linux'
class Command < CommandKit::Command
include CommandKit::OS::Linux
def run
if debian_linux?
# ...
elsif redhat_linux?
# ...
elsif suse_linux?
# ...
elsif arch_linux?
# ...
end
end
end
Defined Under Namespace
Modules: ClassMethods, ModuleMethods
Instance Attribute Summary collapse
-
#linux_distro ⇒ :fedora, ...
readonly
The Linux distro.
Instance Method Summary collapse
-
#arch_linux? ⇒ Boolean
Determines if the current OS is Arch Linux based distro.
-
#debian_linux? ⇒ Boolean
Determines if the current OS is Debian Linux based distro.
-
#fedora_linux? ⇒ Boolean
Determines if the current OS is Fedora Linux based distro.
-
#initialize(linux_distro: self.class.linux_distro, **kwargs) ⇒ Object
Initializes the command.
-
#redhat_linux? ⇒ Boolean
Determines if the current OS is RedHat Linux based distro.
-
#suse_linux? ⇒ Boolean
Determines if the current OS is SUSE Linux based distro.
Methods included from ModuleMethods
Instance Attribute Details
#linux_distro ⇒ :fedora, ... (readonly)
The Linux distro.
82 83 84 |
# File 'lib/command_kit/os/linux.rb', line 82 def linux_distro @linux_distro end |
Instance Method Details
#arch_linux? ⇒ Boolean
Determines if the current OS is Arch Linux based distro.
152 153 154 |
# File 'lib/command_kit/os/linux.rb', line 152 def arch_linux? @linux_distro == :arch end |
#debian_linux? ⇒ Boolean
Determines if the current OS is Debian Linux based distro.
130 131 132 |
# File 'lib/command_kit/os/linux.rb', line 130 def debian_linux? @linux_distro == :debian end |
#fedora_linux? ⇒ Boolean
Determines if the current OS is Fedora Linux based distro.
119 120 121 |
# File 'lib/command_kit/os/linux.rb', line 119 def fedora_linux? @linux_distro == :fedora end |
#initialize(linux_distro: self.class.linux_distro, **kwargs) ⇒ Object
Initializes the command.
95 96 97 98 99 |
# File 'lib/command_kit/os/linux.rb', line 95 def initialize(linux_distro: self.class.linux_distro, **kwargs) super(**kwargs) @linux_distro = linux_distro end |
#redhat_linux? ⇒ Boolean
Determines if the current OS is RedHat Linux based distro.
108 109 110 |
# File 'lib/command_kit/os/linux.rb', line 108 def redhat_linux? @linux_distro == :redhat end |
#suse_linux? ⇒ Boolean
Determines if the current OS is SUSE Linux based distro.
141 142 143 |
# File 'lib/command_kit/os/linux.rb', line 141 def suse_linux? @linux_distro == :suse end |