Class: Uberinstaller::Platform
- Inherits:
-
Object
- Object
- Uberinstaller::Platform
- Includes:
- Loggable
- Defined in:
- lib/uberinstaller/platform.rb
Overview
Instance Attribute Summary collapse
-
#architecture ⇒ Object
readonly
OS architecture information.
-
#lsb ⇒ Object
readonly
LSB module information.
-
#uname ⇒ Object
readonly
Returns the value of attribute uname.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Platform
constructor
Get platform, detect ubuntu, detect ubuntu version, save lsb params.
-
#is_32bit? ⇒ Boolean
Reverse of is_64bit?.
-
#is_64bit? ⇒ Boolean
Check if system is running 64 bit OS.
-
#is_not_ubuntu? ⇒ Boolean
Reverse of is_ubuntu?.
-
#is_ubuntu? ⇒ Boolean
Check if platform is Ubuntu.
Methods included from Loggable
configure_logger_for, #logger, logger_for
Constructor Details
#initialize(opts = {}) ⇒ Platform
Get platform, detect ubuntu, detect ubuntu version, save lsb params
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/uberinstaller/platform.rb', line 24 def initialize(opts = {}) @opts = opts.keyword_args(:lsb => '/etc/lsb-release') @lsb = nil @uname = nil get_lsb_informations get_arch_informations @architecture = @uname[:machine] end |
Instance Attribute Details
#architecture ⇒ Object (readonly)
OS architecture information
18 19 20 |
# File 'lib/uberinstaller/platform.rb', line 18 def architecture @architecture end |
#lsb ⇒ Object (readonly)
LSB module information
18 |
# File 'lib/uberinstaller/platform.rb', line 18 attr_reader :architecture, :lsb, :uname |
#uname ⇒ Object (readonly)
Returns the value of attribute uname.
18 |
# File 'lib/uberinstaller/platform.rb', line 18 attr_reader :architecture, :lsb, :uname |
Instance Method Details
#is_32bit? ⇒ Boolean
Reverse of is_64bit?
49 50 51 |
# File 'lib/uberinstaller/platform.rb', line 49 def is_32bit? !is_64bit? end |
#is_64bit? ⇒ Boolean
Check if system is running 64 bit OS
54 55 56 57 58 |
# File 'lib/uberinstaller/platform.rb', line 54 def is_64bit? return @uname[:machine] == 'x86_64' if @uname[:machine] logger.fatal 'uname is not set, impossible to get machine information' false end |
#is_not_ubuntu? ⇒ Boolean
Reverse of is_ubuntu?
44 45 46 |
# File 'lib/uberinstaller/platform.rb', line 44 def is_not_ubuntu? !is_ubuntu? end |
#is_ubuntu? ⇒ Boolean
Check if platform is Ubuntu
37 38 39 40 41 |
# File 'lib/uberinstaller/platform.rb', line 37 def is_ubuntu? return @lsb[:id] == 'Ubuntu' if @lsb[:id] logger.fatal 'lsb is not set, impossible to get OS information' false end |