lib/vagrant-unison2/ssh_command.rb in vagrant-unison2-1.1.0 vs lib/vagrant-unison2/ssh_command.rb in vagrant-unison2-1.2.0
- old
+ new
@@ -1,43 +1,46 @@
module VagrantPlugins
module Unison
class SshCommand
- def initialize(machine, unison_paths)
+ def initialize(machine)
@machine = machine
- @unison_paths = unison_paths
end
- def command
+ def ssh
%W(
- -p #{ssh_info[:port]}
+ ssh
+ vagrant@127.0.0.1
+ #{ssh_args}
+ ).compact.join(' ')
+ end
+
+ def ssh_args
+ %W(
+ -p #{@machine.ssh_info[:port]}
#{proxy_command}
-o StrictHostKeyChecking=no
-o UserKnownHostsFile=/dev/null
#{key_paths}
).compact.join(' ')
end
- def uri
- username = ssh_info[:username]
- host = ssh_info[:host]
+ def uri(unison_paths)
+ username = @machine.ssh_info[:username]
+ host = @machine.ssh_info[:host]
- "ssh://#{username}@#{host}/#{@unison_paths.guest}"
+ "ssh://#{username}@#{host}/#{unison_paths.guest}"
end
private
def proxy_command
- command = ssh_info[:proxy_command]
+ command = @machine.ssh_info[:proxy_command]
return nil unless command
"-o ProxyCommand='#{command}'"
end
- def ssh_info
- @machine.ssh_info
- end
-
def key_paths
- ssh_info[:private_key_path].map { |p| "-i #{p}" }.join(' ')
+ @machine.ssh_info[:private_key_path].map { |p| "-i #{p}" }.join(' ')
end
end
end
end