Module: Serverspec::Helper::DetectOS

Defined in:
lib/serverspec/helper/detect_os.rb

Instance Method Summary collapse

Instance Method Details

#commandsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/serverspec/helper/detect_os.rb', line 4

def commands
  property[:os_type] = {} if ! property[:os_type]
  host = RSpec.configuration.ssh ? RSpec.configuration.ssh.host : 'localhost'

  if property[:os_type][host]
    os = property[:os_type][host]
  else
    os = backend(Serverspec::Commands::Base).check_os
    property[:os_type][host] = os
  end

  self.class.const_get('Serverspec').const_get('Commands').const_get(os).new
end