lib/specinfra/helper/backend.rb in specinfra-0.0.8 vs lib/specinfra/helper/backend.rb in specinfra-0.0.9
- old
+ new
@@ -1,8 +1,8 @@
module SpecInfra
module Helper
- ['Exec', 'Ssh', 'Cmd', 'WinRM', 'ShellScript'].each do |backend|
+ ['Exec', 'Ssh', 'Cmd', 'WinRM', 'ShellScript', 'Dockerfile'].each do |backend|
eval <<-EOF
module #{backend}
def backend(commands_object=nil)
if ! respond_to?(:commands)
commands_object = SpecInfra::Command::Base.new
@@ -15,14 +15,12 @@
EOF
end
module Backend
def backend_for(type)
- if ! respond_to?(:commands)
- commands_object = SpecInfra::Command::Base.new
- end
instance = self.class.const_get('SpecInfra').const_get('Backend').const_get(type.to_s.capitalize).instance
- instance.set_commands(commands_object || commands)
+ commands = self.class.const_get('SpecInfra').const_get('Command').const_get(instance.check_os[:family]).new
+ instance.set_commands(commands)
instance
end
end
end
end