Class: AutomateIt::PlatformManager::Uname
- Inherits:
-
Struct
- Object
- Common
- AutomateIt::Plugin::Base
- AutomateIt::Plugin::Driver
- BaseDriver
- Struct
- AutomateIt::PlatformManager::Uname
- Defined in:
- lib/automateit/platform_manager/uname.rb
Overview
PlatformManager::Uname
A PlatformManager driver that uses the Unix uname
command to provide basic information about the platform.
Constant Summary
Constants inherited from AutomateIt::Plugin::Driver
AutomateIt::Plugin::Driver::BASE_DRIVER_NAME
Constants included from Constants
Constants::HELPERS_DIR, Constants::INSTALL_DIR, Constants::PERROR, Constants::PEXEC, Constants::PNOTE, Constants::WARNING_BOILERPLATE
Instance Attribute Summary
Attributes inherited from Struct
Attributes inherited from AutomateIt::Plugin::Driver
Attributes inherited from Common
Instance Method Summary collapse
-
#setup(opts = {}) ⇒ Object
:nodoc:.
-
#suitability(method, *args) ⇒ Object
:nodoc:.
Methods inherited from Struct
#query, #single_vendor?, #tags
Methods inherited from AutomateIt::Plugin::Driver
abstract_driver, #available?, base_driver, base_driver?, depends_on, inherited, manager_token
Methods inherited from AutomateIt::Plugin::Base
Methods inherited from Common
#initialize, #log, #nitpick, #noop, #noop=, #noop?, #preview, #preview=, #preview?, #preview_for, #superuser?, #writing, #writing=, #writing?
Constructor Details
This class inherits a constructor from AutomateIt::Common
Instance Method Details
#setup(opts = {}) ⇒ Object
:nodoc:
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/automateit/platform_manager/uname.rb', line 13 def setup(opts={}) # :nodoc: super(opts) if available? @struct[:os] ||= @@struct_cache[:os] ||= `uname -s`.chomp.downcase @struct[:arch] ||= @@struct_cache[:arch] ||= `uname -m`.chomp.downcase =begin # This method is 20% faster, but is it less portable because of the combined calls? @struct[:os] and @struct[:arch] or begin output = `uname -s -m`.chomp.downcase os, arch = output.split(/\s+/) @struct[:os] = @@struct_cache[:os] = os @struct[:arch] = @@struct_cache[:arch] = arch end =end end end |
#suitability(method, *args) ⇒ Object
:nodoc:
8 9 10 11 |
# File 'lib/automateit/platform_manager/uname.rb', line 8 def suitability(method, *args) # :nodoc: # Level must be greater than Struct's return available? ? 2 : 0 end |