Class: Specinfra::CommandFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/beaker-rspec/helpers/serverspec.rb

Class Method Summary collapse

Class Method Details

.get_windows_cmd(meth, *args) ⇒ Object

Force creation of a windows command



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/beaker-rspec/helpers/serverspec.rb', line 88

def get_windows_cmd(meth, *args)

  action, resource_type, subaction = breakdown(meth)
  method =  action
  method += "_#{subaction}" if subaction

  common_class = Specinfra::Command
  base_class = common_class.const_get('Base')
  os_class = common_class.const_get('Windows')
  version_class = os_class.const_get('Base')
  command_class = version_class.const_get(resource_type.to_camel_case)

  command_class = command_class.create
  if command_class.respond_to?(method)
    command_class.send(method, *args)
  else
    raise NotImplementedError.new("#{method} is not implemented in #{command_class}")
  end
end