diff --git a/Rakefile b/Rakefile index d898155..b58aab3 100644 --- a/Rakefile +++ b/Rakefile @@ -11,7 +11,6 @@ begin gem.homepage = "http://github.com/ngauthier/hydra" gem.authors = ["Nick Gauthier"] gem.add_development_dependency "shoulda", "= 2.10.3" - gem.add_dependency "net-ssh", "= 2.0.19" end Jeweler::GemcutterTasks.new rescue LoadError diff --git a/hydra.gemspec b/hydra.gemspec index 976b59e..2b6afc5 100644 --- a/hydra.gemspec +++ b/hydra.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Nick Gauthier"] - s.date = %q{2010-02-06} + s.date = %q{2010-02-09} s.description = %q{Spread your tests over multiple machines to test your code faster.} s.email = %q{nick@smartlogicsolutions.com} s.extra_rdoc_files = [ @@ -81,14 +81,11 @@ Gem::Specification.new do |s| if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_development_dependency(%q, ["= 2.10.3"]) - s.add_runtime_dependency(%q, ["= 2.0.19"]) else s.add_dependency(%q, ["= 2.10.3"]) - s.add_dependency(%q, ["= 2.0.19"]) end else s.add_dependency(%q, ["= 2.10.3"]) - s.add_dependency(%q, ["= 2.0.19"]) end end diff --git a/lib/hydra/master.rb b/lib/hydra/master.rb index e54413f..e6c295b 100644 --- a/lib/hydra/master.rb +++ b/lib/hydra/master.rb @@ -94,14 +94,17 @@ module Hydra #:nodoc: def boot_ssh_worker(worker) runners = worker.fetch('runners') { raise "You must specify the number of runners" } - connect = worker.fetch('connect') { raise "You must specify SSH connection options" } + connect = worker.fetch('connect') { raise "You must specify an SSH connection target" } + ssh_opts = worker.fetch('ssh_opts') { "" } directory = worker.fetch('directory') { raise "You must specify a remote directory" } command = worker.fetch('command') { "ruby -e \"require 'rubygems'; require 'hydra'; Hydra::Worker.new(:io => Hydra::Stdio.new, :runners => #{runners}, :verbose => #{@verbose});\"" } + trace "Synchronizing with #{connect} [NOT REALLY]" + trace "Booting SSH worker" - ssh = Hydra::SSH.new(connect, directory, command) + ssh = Hydra::SSH.new("#{ssh_opts} #{connect}", directory, command) return { :io => ssh, :idle => false, :type => :ssh } end diff --git a/lib/hydra/ssh.rb b/lib/hydra/ssh.rb index f0e1340..002f0da 100644 --- a/lib/hydra/ssh.rb +++ b/lib/hydra/ssh.rb @@ -17,18 +17,21 @@ module Hydra #:nodoc: include Open3 include Hydra::MessagingIO - # Initialize new SSH connection. The single parameters is passed - # directly to ssh for starting a connection. So you can do: - # Hydra::SSH.new('localhost') - # Hydra::SSH.new('user@server.com') - # Hydra::SSH.new('-p 3022 user@server.com') - # etc.. + # Initialize new SSH connection. + # The first parameter is passed directly to ssh for starting a connection. + # The second parameter is the directory to CD into once connected. + # The third parameter is the command to run + # So you can do: + # Hydra::SSH.new('-p 3022 user@server.com', '/home/user/Desktop', 'ls -l') + # To connect to server.com as user on port 3022, then CD to their desktop, then + # list all the files. def initialize(connection_options, directory, command) @writer, @reader, @error = popen3("ssh -tt #{connection_options}") @writer.write("cd #{directory}\n") @writer.write(command+"\n") end + # Close the SSH connection def close @writer.write "exit\n" super