photocopier 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -42,7 +42,6 @@ module Photocopier
42
42
  host = opts.delete(:host)
43
43
  user = opts.delete(:user)
44
44
  opts.delete(:gateway)
45
- opts.delete(:sshpass)
46
45
  @session ||= if gateway_options.any?
47
46
  gateway.ssh(host, user, opts)
48
47
  else
@@ -75,7 +74,7 @@ module Photocopier
75
74
 
76
75
  def rsync(source, destination, exclude = [])
77
76
  command = [
78
- "rsync", "--progress", "-e", rsh_arguments, "--archive", "--compress",
77
+ "rsync", "--progress", "-e", rsh_arguments, "-rlpt", "--compress",
79
78
  "--omit-dir-times", "--delete"
80
79
  ]
81
80
 
@@ -93,18 +92,18 @@ module Photocopier
93
92
  def rsh_arguments
94
93
  arguments = []
95
94
  if gateway_options.any?
96
- arguments << ssh_command(gateway_options, options[:sshpass])
95
+ arguments << ssh_command(gateway_options)
97
96
  end
98
- arguments << ssh_command(options, gateway_options[:sshpass])
97
+ arguments << ssh_command(options)
99
98
  arguments.join(" ")
100
99
  end
101
100
 
102
- def ssh_command(opts, use_sshpass=true)
101
+ def ssh_command(opts)
103
102
  command = "ssh "
104
103
  command << "-p #{opts[:port]} " if opts[:port].present?
105
104
  command << "#{opts[:user]}@" if opts[:user].present?
106
105
  command << opts[:host]
107
- if opts[:password] && use_sshpass
106
+ if opts[:password]
108
107
  command = "sshpass -p #{opts[:password]} #{command}"
109
108
  end
110
109
  command
@@ -114,7 +113,6 @@ module Photocopier
114
113
  opts = gateway_options
115
114
  host = opts.delete(:host)
116
115
  user = opts.delete(:user)
117
- opts.delete(:sshpass)
118
116
  @gateway ||= Net::SSH::Gateway.new(host, user, opts)
119
117
  end
120
118
 
@@ -1,3 +1,3 @@
1
1
  module Photocopier
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
data/spec/ssh_spec.rb CHANGED
@@ -57,31 +57,23 @@ describe Photocopier::SSH do
57
57
  context "given a password" do
58
58
  let(:options) do { :host => "host", :password => "password" } end
59
59
 
60
- context "sshpass is enabled" do
61
- it "should be added to the command" do
62
- ssh.send(:ssh_command, options, true).should == "sshpass -p password ssh host"
63
- end
64
- end
65
-
66
- context "sshpass is disabled" do
67
- it "should not change the command" do
68
- ssh.send(:ssh_command, options, false).should == "ssh host"
69
- end
60
+ it "sshpass should be added to the command" do
61
+ ssh.send(:ssh_command, options).should == "sshpass -p password ssh host"
70
62
  end
71
63
  end
72
64
  end
73
65
 
74
66
  context "#rsh_arguments" do
75
67
  it "should build arguments for rsync" do
76
- ssh.should_receive(:ssh_command).with(options, anything)
68
+ ssh.should_receive(:ssh_command).with(options)
77
69
  ssh.send(:rsh_arguments)
78
70
  end
79
71
 
80
72
  context "given a gateway" do
81
73
  let(:options) { options_with_gateway }
82
74
  it "should include gateway options" do
83
- ssh.should_receive(:ssh_command).with(gateway_config, anything)
84
- ssh.should_receive(:ssh_command).with(options, anything)
75
+ ssh.should_receive(:ssh_command).with(gateway_config)
76
+ ssh.should_receive(:ssh_command).with(options)
85
77
  ssh.send(:rsh_arguments)
86
78
  end
87
79
  end
@@ -98,7 +90,7 @@ describe Photocopier::SSH do
98
90
  --progress
99
91
  -e
100
92
  rsh_arguments
101
- --archive
93
+ -rlpt
102
94
  --compress
103
95
  --omit-dir-times
104
96
  --delete
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: photocopier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-18 00:00:00.000000000 Z
12
+ date: 2013-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -132,6 +132,7 @@ extensions: []
132
132
  extra_rdoc_files: []
133
133
  files:
134
134
  - .gitignore
135
+ - .rspec
135
136
  - .rvmrc
136
137
  - Gemfile
137
138
  - Gemfile.lock
@@ -178,4 +179,3 @@ test_files:
178
179
  - spec/ftp_spec.rb
179
180
  - spec/shared_examples_for_adapter.rb
180
181
  - spec/ssh_spec.rb
181
- has_rdoc: