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.
84 85 86 |
# File 'lib/command_kit/os/linux.rb', line 84 def linux_distro @linux_distro end |
Instance Method Details
#arch_linux? ⇒ Boolean
Determines if the current OS is Arch Linux based distro.
154 155 156 |
# File 'lib/command_kit/os/linux.rb', line 154 def arch_linux? @linux_distro == :arch end |
#debian_linux? ⇒ Boolean
Determines if the current OS is Debian Linux based distro.
132 133 134 |
# File 'lib/command_kit/os/linux.rb', line 132 def debian_linux? @linux_distro == :debian end |
#fedora_linux? ⇒ Boolean
Determines if the current OS is Fedora Linux based distro.
121 122 123 |
# File 'lib/command_kit/os/linux.rb', line 121 def fedora_linux? @linux_distro == :fedora end |
#initialize(linux_distro: self.class.linux_distro, **kwargs) ⇒ Object
Initializes the command.
97 98 99 100 101 |
# File 'lib/command_kit/os/linux.rb', line 97 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.
110 111 112 |
# File 'lib/command_kit/os/linux.rb', line 110 def redhat_linux? @linux_distro == :redhat end |
#suse_linux? ⇒ Boolean
Determines if the current OS is SUSE Linux based distro.
143 144 145 |
# File 'lib/command_kit/os/linux.rb', line 143 def suse_linux? @linux_distro == :suse end |