Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fixed the CLI to exit with a non-zero status whenever deployment fails #84

Merged
merged 3 commits into from

3 participants

@tansengming

Previously kumade would exit with 0 even with deployment failures

@mike-burns mike-burns commented on the diff
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
@mike-burns Owner

Solid. I like this change.

Thanks Mike. Scratched an itch that I had with Kumade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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])
@mike-burns Owner

I don't understand this change.

My bad, this should've been a separate pull request. Its to account for the fact that cli.rb no longer has CLI.run. I'm guessing all that code's been moved to the initializer instead.

Update: I've reverted changes to this file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@gabebw gabebw merged commit 779d67c into thoughtbot:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 16, 2012
  1. @tansengming
Commits on Jan 17, 2012
  1. @tansengming

    fixes broken rake task

    tansengming authored
Commits on Jan 30, 2012
  1. @tansengming
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 5 deletions.
  1. +1 −0  lib/kumade/cli.rb
  2. +10 −5 spec/kumade/cli_spec.rb
View
1  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
@mike-burns Owner

Solid. I like this change.

Thanks Mike. Scratched an itch that I had with Kumade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
ensure
$stdout = real_stdout
end
View
15 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
Something went wrong with that request. Please try again.