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



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/beaker-rspec/helpers/serverspec.rb', line 92

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
  unless command_class.respond_to?(method)
    raise NotImplementedError,
          "#{method} is not implemented in #{command_class}"
  end

  command_class.send(method, *args)
end