diff --git a/CHANGELOG b/CHANGELOG index 5fd3019d..9d4e2817 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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] diff --git a/lib/capistrano/shell.rb b/lib/capistrano/shell.rb index 2015946b..f6f4f788 100644 --- a/lib/capistrano/shell.rb +++ b/lib/capistrano/shell.rb @@ -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 diff --git a/test/shell_test.rb b/test/shell_test.rb index 80b18897..e877e113 100644 --- a/test/shell_test.rb +++ b/test/shell_test.rb @@ -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