Module: CSD::Extensions::Gem::Platform
- Included in:
- Gem::Platform
- Defined in:
- lib/csd/extensions/gem/platform.rb
Overview
This module comprises extensions to the Array object.
Instance Method Summary collapse
-
#debian? ⇒ Boolean
Determines whether the OS is Debian or Ubuntu.
-
#humanize ⇒ Object
This method returns a human-readable string for the current OS and CPU architecture.
-
#kernel_release ⇒ Object
On linux systems, this method returns the current kernel release.
-
#kernel_version ⇒ Object
On linux systems, this method returns the current kernel version.
-
#ubuntu? ⇒ Boolean
Determines whether the OS is Ubuntu.
-
#ubuntu_10? ⇒ Boolean
Determines whether the OS is Ubuntu 10.
Instance Method Details
#debian? ⇒ Boolean
Determines whether the OS is Debian or Ubuntu. Returns true or false.
21 22 23 |
# File 'lib/csd/extensions/gem/platform.rb', line 21 def debian? kernel_version and kernel_version =~ /Debian|Ubuntu/ end |
#humanize ⇒ Object
This method returns a human-readable string for the current OS and CPU architecture.
14 15 16 17 |
# File 'lib/csd/extensions/gem/platform.rb', line 14 def humanize version_string = version ? ", version #{version}" : '' "#{os} (#{cpu}#{version_string})" end |
#kernel_release ⇒ Object
On linux systems, this method returns the current kernel release.
45 46 47 |
# File 'lib/csd/extensions/gem/platform.rb', line 45 def kernel_release Cmd.run('uname --kernel-release', :internal => true, :force_in_reveal => true).output.to_s.chop if os == 'linux' end |
#kernel_version ⇒ Object
On linux systems, this method returns the current kernel version.
39 40 41 |
# File 'lib/csd/extensions/gem/platform.rb', line 39 def kernel_version Cmd.run('uname --kernel-version', :internal => true, :force_in_reveal => true).output.to_s.chop if os == 'linux' end |
#ubuntu? ⇒ Boolean
Determines whether the OS is Ubuntu. Returns true or false.
27 28 29 |
# File 'lib/csd/extensions/gem/platform.rb', line 27 def ubuntu? kernel_version and kernel_version =~ /Ubuntu/ end |
#ubuntu_10? ⇒ Boolean
Determines whether the OS is Ubuntu 10. Returns true or false.
33 34 35 |
# File 'lib/csd/extensions/gem/platform.rb', line 33 def ubuntu_10? ubuntu? and %w{ 2.6.32-21-generic 2.6.32-22-generic }.include?(kernel_release) end |