Class: Train::Extras::CommandWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/train/extras/command_wrapper.rb

Class Method Summary collapse

Class Method Details

.load(transport, options) ⇒ Object



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/train/extras/command_wrapper.rb', line 164

def self.load(transport, options)
  if transport.os.unix?
    return nil unless LinuxCommand.active?(options)
    res = LinuxCommand.new(transport, options)
    verification_res = res.verify
    if verification_res
      msg, reason = verification_res
      raise Train::UserError.new("Sudo failed: #{msg}", reason)
    end
    res
  elsif transport.os.windows?
    res = WindowsCommand.new(transport, options)
    res
  end
end