Module: Configspec::Helper::DetectOS

Defined in:
lib/configspec/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/configspec/helper/detect_os.rb', line 4

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

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

  self.class.const_get('Configspec').const_get('Commands').const_get(os[:family]).new
end