mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Ensure that the default run options are mixed into the command options when executing a command from the cap shell (closes #11348)
git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@9025 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
9e07fd2a23
commit
526782f55d
3 changed files with 30 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Ensure that the default run options are mixed into the command options when executing a command from the cap shell [Ken Collins]
|
||||
|
||||
* Added :none SCM module for deploying a specific directory's contents [Jamis Buck]
|
||||
|
||||
* Improved "copy" strategy supports local caching and pattern exclusion (via :copy_cache and :copy_exclude variables) [Jamis Buck]
|
||||
|
|
|
@ -169,7 +169,8 @@ HELP
|
|||
command = command.gsub(/\bsudo\b/, "sudo -p '#{configuration.sudo_prompt}'")
|
||||
processor = configuration.sudo_behavior_callback(Configuration.default_io_proc)
|
||||
sessions = servers.map { |server| configuration.sessions[server] }
|
||||
cmd = Command.new(command, sessions, :logger => configuration.logger, &processor)
|
||||
options = configuration.add_default_command_options({})
|
||||
cmd = Command.new(command, sessions, options.merge(:logger => configuration.logger), &processor)
|
||||
previous = trap("INT") { cmd.stop! }
|
||||
cmd.process!
|
||||
rescue Capistrano::Error => error
|
||||
|
|
|
@ -61,4 +61,30 @@ class ShellTest < Test::Unit::TestCase
|
|||
@shell.expects(:process_command).with("on", "app,db", "hello world")
|
||||
assert @shell.read_and_execute
|
||||
end
|
||||
|
||||
def test_task_command_with_bang_gets_processed_by_exec_tasks
|
||||
while_testing_post_exec_commands do
|
||||
@shell.expects(:read_line).returns("!deploy")
|
||||
@shell.expects(:exec_tasks).with(["deploy"])
|
||||
assert @shell.read_and_execute
|
||||
end
|
||||
end
|
||||
|
||||
def test_normal_command_gets_processed_by_exec_command
|
||||
while_testing_post_exec_commands do
|
||||
@shell.expects(:read_line).returns("uptime")
|
||||
@shell.expects(:exec_command).with("uptime",nil)
|
||||
@shell.expects(:connect)
|
||||
assert @shell.read_and_execute
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def while_testing_post_exec_commands(&block)
|
||||
@shell.instance_variable_set(:@mutex,Mutex.new)
|
||||
yield
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue