vagrant/lib/hobo/ssh.rb

22 lines
513 B
Ruby
Raw Normal View History

2010-01-26 08:01:17 +00:00
module Hobo
class SSH
SCRIPT = File.join(File.dirname(__FILE__), '..', '..', 'script', 'hobo-ssh-expect.sh')
def self.connect(opts={})
Kernel.exec "#{SCRIPT} #{uname(opts)} #{pass(opts)} #{host(opts)} #{port(opts)}".strip
end
2010-01-26 08:01:17 +00:00
private
module ClassMethods
2010-01-26 08:01:17 +00:00
private
[:port, :host, :pass, :uname].each do |method|
define_method(method) do |opts|
opts[method] || Hobo.config[:ssh][method]
end
2010-01-26 08:01:17 +00:00
end
end
extend ClassMethods
2010-01-26 08:01:17 +00:00
end
end