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
  attr[:os_type] = {} if ! attr[:os_type]
  host = RSpec.configuration.ssh ? RSpec.configuration.ssh.host : 'localhost'

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

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