Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add "start" recipe and before deploy hook #1

Merged
merged 1 commit into from

2 participants

@marceldegraaf
Collaborator

Also updated Ruby to p125 in .rvmrc and made sure the specs are green.

@iain iain merged commit cfbc170 into iain:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 5, 2012
  1. @marceldegraaf
This page is out of date. Refresh to see the latest.
View
2  .rvmrc
@@ -1 +1 @@
-rvm 1.9.3@capistrano-blaze
+rvm 1.9.3-p125@capistrano-blaze
View
4 lib/capistrano/blaze.rb
@@ -34,6 +34,10 @@ def speak(message)
end
end
+ def start(context)
+ speak "#{user} is deploying #{stage(context)}#{context.application}, via `#{command}`"
+ end
+
def failure(context, exception)
speak ":warning: #{user} failed to deploy #{stage(context)}#{context.application}, via `#{command}`: #{exception.to_s} (#{exception.class.inspect})"
end
View
5 lib/capistrano/blaze/recipes.rb
@@ -8,6 +8,10 @@
namespace :campfire do
+ task :start do
+ Capistrano::Blaze.start(self)
+ end
+
task :success do
Capistrano::Blaze.success(self)
end
@@ -19,6 +23,7 @@
end
+ before "deploy", "campfire:start"
after "deploy:restart", "campfire:success"
end
View
17 spec/camp_spec.rb
@@ -27,15 +27,21 @@
subject.stub(:user) { "iain" }
end
+ it "displays a start message" do
+ subject.should_receive(:speak).with("iain is deploying to the production stage of basecamp, via `#{command}`")
+ context = stub(:stage => "production", :application => "basecamp")
+ subject.start(context)
+ end
+
it "displays a failure message" do
- subject.should_receive(:speak).with(":warning: iain failed to deploy to the production stage of basecamp, via `cap #{ARGV.join(' ')}`: woops (RuntimeError)")
+ subject.should_receive(:speak).with(":warning: iain failed to deploy to the production stage of basecamp, via `#{command}`: woops (RuntimeError)")
context = stub(:stage => "production", :application => "basecamp")
exception = RuntimeError.new("woops")
subject.failure(context, exception)
end
it "displays success message" do
- subject.should_receive(:speak).with("iain succesfully deployed to the production stage of basecamp, via `cap #{ARGV.join(' ')}`")
+ subject.should_receive(:speak).with("iain succesfully deployed to the production stage of basecamp, via `#{command}`")
context = stub(:stage => "production", :application => "basecamp")
subject.success(context)
end
@@ -47,17 +53,20 @@
end
it "displays success message without a stage" do
- subject.should_receive(:speak).with("iain succesfully deployed basecamp, via `cap #{ARGV.join(' ')}`")
+ subject.should_receive(:speak).with("iain succesfully deployed basecamp, via `#{command}`")
context = stub(:application => "basecamp")
subject.success(context)
end
it "displays failure message without a stage" do
- subject.should_receive(:speak).with(":warning: iain failed to deploy basecamp, via `cap #{ARGV.join(' ')}`: woops (RuntimeError)")
+ subject.should_receive(:speak).with(":warning: iain failed to deploy basecamp, via `#{command}`: woops (RuntimeError)")
context = stub(:application => "basecamp")
exception = RuntimeError.new("woops")
subject.failure(context, exception)
end
+ def command
+ [ 'cap', ARGV ].flatten * ' '
+ end
end
Something went wrong with that request. Please try again.