From 0ee8a6469fb66365c945805fb672813df86d0fef Mon Sep 17 00:00:00 2001 From: SengMing Tan Date: Mon, 16 Jan 2012 20:12:26 +1100 Subject: [PATCH 1/3] cli exits with non-zero status when deploy fails --- lib/kumade/cli.rb | 1 + spec/kumade/cli_spec.rb | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/kumade/cli.rb b/lib/kumade/cli.rb index 784b0b3..67731ae 100644 --- a/lib/kumade/cli.rb +++ b/lib/kumade/cli.rb @@ -34,6 +34,7 @@ def self.swapping_stdout_for(io, print_output = false) rescue Kumade::DeploymentError io.rewind real_stdout.print(io.read) + exit 1 ensure $stdout = real_stdout end diff --git a/spec/kumade/cli_spec.rb b/spec/kumade/cli_spec.rb index b82244d..b7147c8 100644 --- a/spec/kumade/cli_spec.rb +++ b/spec/kumade/cli_spec.rb @@ -89,13 +89,18 @@ output.read.should == "Hello, you can't see me.\n" end - it 'dumps the output stash to real stdout when an error happens' do - Kumade::CLI.swapping_stdout_for(output) do - $stdout.puts "Hello, you can see me!" - raise Kumade::DeploymentError.new("error") + context 'when print_output is false' do + subject do + Kumade::CLI.swapping_stdout_for(output) do + $stdout.puts "Hello, you can see me!" + raise Kumade::DeploymentError.new("error") + end end - stdout.should have_received(:print).with("Hello, you can see me!\n") + it 'dumps the output stash to real stdout when an error happens, exits with non-zero status' do + expect { subject }.should raise_error SystemExit + stdout.should have_received(:print).with("Hello, you can see me!\n") + end end context "in print output mode" do From d42a3fdddb881685c14ca0f2634a84146d000063 Mon Sep 17 00:00:00 2001 From: SengMing Tan Date: Tue, 17 Jan 2012 12:31:36 +1100 Subject: [PATCH 2/3] fixes broken rake task --- lib/kumade/tasks/deploy.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/kumade/tasks/deploy.rake b/lib/kumade/tasks/deploy.rake index 860a7a3..6e58ba1 100644 --- a/lib/kumade/tasks/deploy.rake +++ b/lib/kumade/tasks/deploy.rake @@ -2,7 +2,7 @@ namespace :deploy do Kumade::Git.environments.each do |environment| desc "Deploy to #{environment} environment" task environment do - Kumade::CLI.run([environment]) + Kumade::CLI.new([environment]) end end end From 7e37d6129ce841fafa5295022c8f90a4c475a050 Mon Sep 17 00:00:00 2001 From: SengMing Tan Date: Mon, 30 Jan 2012 21:17:31 +1100 Subject: [PATCH 3/3] reverts fixes to deploy.rake for pull request --- lib/kumade/tasks/deploy.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/kumade/tasks/deploy.rake b/lib/kumade/tasks/deploy.rake index 6e58ba1..860a7a3 100644 --- a/lib/kumade/tasks/deploy.rake +++ b/lib/kumade/tasks/deploy.rake @@ -2,7 +2,7 @@ namespace :deploy do Kumade::Git.environments.each do |environment| desc "Deploy to #{environment} environment" task environment do - Kumade::CLI.new([environment]) + Kumade::CLI.run([environment]) end end end