Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #167 from shtirlic/dry_run_transfer_fix

Fix transfer action to honor dry-run flag.
  • Loading branch information...
commit c20df286bd9e1883d87e476a144a29bd36452a8c 2 parents 9f3e1e1 + 2510dcd
@leehambley leehambley authored
View
9 lib/capistrano/configuration/actions/file_transfer.rb
@@ -12,7 +12,7 @@ def put(data, path, options={})
opts = options.dup
upload(StringIO.new(data), path, opts)
end
-
+
# Get file remote_path from FIRST server targeted by
# the current task and transfer it to local machine as path.
#
@@ -35,13 +35,12 @@ def download(from, to, options={}, &block)
end
def transfer(direction, from, to, options={}, &block)
+ if dry_run
+ return logger.debug "transfering: #{[direction, from, to] * ', '}"
+ end
execute_on_servers(options) do |servers|
targets = servers.map { |s| sessions[s] }
- if dry_run
- logger.debug "transfering: #{[direction, from, to, targets, options.merge(:logger => logger).inspect ] * ', '}"
- else
Transfer.process(direction, from, to, targets, options.merge(:logger => logger), &block)
- end
end
end
View
4 test/configuration/actions/invocation_test.rb
@@ -59,7 +59,7 @@ def test_put_wont_transfer_if_dry_run
config = make_config
config.dry_run = true
config.servers = %w[ foo ]
- config.expects(:sessions).returns({ 'foo-server' => 'bar' })
+ config.expects(:execute_on_servers).never
::Capistrano::Transfer.expects(:process).never
config.put "foo", "bar", :mode => 0644
end
@@ -203,7 +203,7 @@ def test_sudo_behavior_callback_should_defer_to_fallback_for_other_output
a = mock("channel", :called => true)
b = mock("stream", :called => true)
c = mock("data", :called => true)
-
+
callback[a, b, c]
end
Please sign in to comment.
Something went wrong with that request. Please try again.