Class: Kitchen::Platform
- Inherits:
-
Object
- Object
- Kitchen::Platform
- Defined in:
- lib/kitchen/platform.rb
Overview
A target operating system environment in which convergence integration will take place. This may represent a specific operating system, version, and machine architecture.
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
Logical name of this platform.
-
#os_type ⇒ String
readonly
Operating system type hint (default:
"unix"
). -
#shell_type ⇒ String
readonly
Shell command flavor hint (default:
"bourne"
).
Instance Method Summary collapse
-
#diagnose ⇒ Hash
Returns a Hash of configuration and other useful diagnostic information.
-
#initialize(options = {}) ⇒ Platform
constructor
Constructs a new platform.
- #windows?(options) ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ Platform
Constructs a new platform.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/kitchen/platform.rb', line 42 def initialize( = {}) @name = .fetch(:name) do raise ClientError, "Platform#new requires option :name" end @os_type = .fetch(:os_type) do windows?() ? "windows" : "unix" end @shell_type = .fetch(:shell_type) do windows?() ? "powershell" : "bourne" end end |
Instance Attribute Details
#name ⇒ String (readonly)
Returns logical name of this platform.
29 30 31 |
# File 'lib/kitchen/platform.rb', line 29 def name @name end |
#os_type ⇒ String (readonly)
Returns operating system type hint (default: "unix"
).
32 33 34 |
# File 'lib/kitchen/platform.rb', line 32 def os_type @os_type end |
#shell_type ⇒ String (readonly)
Returns shell command flavor hint (default: "bourne"
).
35 36 37 |
# File 'lib/kitchen/platform.rb', line 35 def shell_type @shell_type end |
Instance Method Details
#diagnose ⇒ Hash
Returns a Hash of configuration and other useful diagnostic information.
63 64 65 |
# File 'lib/kitchen/platform.rb', line 63 def diagnose { :os_type => os_type, :shell_type => shell_type } end |
#windows?(options) ⇒ Boolean
54 55 56 57 58 |
# File 'lib/kitchen/platform.rb', line 54 def windows?() @name.downcase =~ /^win/ || ( ![:transport].nil? && [:transport][:name] == "winrm" ) end |