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


99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/beaker-rspec/helpers/serverspec.rb', line 99

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