Permalink
Browse files

Kumade now restarts Heroku app after db:migrate.

  • Loading branch information...
hoverlover committed Oct 16, 2011
1 parent c0d12cb commit 99a14b73fcb346ad5b466fdade729041cfa86af6
Showing with 40 additions and 0 deletions.
  1. +1 −0 lib/kumade/deployer.rb
  2. +5 −0 lib/kumade/heroku.rb
  3. +1 −0 spec/kumade/deployer_spec.rb
  4. +33 −0 spec/kumade/heroku_spec.rb
View
@@ -18,6 +18,7 @@ def deploy
pre_deploy
heroku.sync
heroku.migrate_database
+ heroku.restart_app
rescue => deploying_error
Kumade.configuration.outputter.error("#{deploying_error.class}: #{deploying_error.message}")
ensure
View
@@ -20,6 +20,11 @@ def migrate_database
Kumade.configuration.outputter.success("Migrated #{Kumade.configuration.environment}")
end
+ def restart_app
+ heroku("restart") unless Kumade.configuration.pretending?
+ Kumade.configuration.outputter.success("Restarted #{Kumade.configuration.environment}")
+ end
+
def delete_deploy_branch
git.delete(DEPLOY_BRANCH, @branch)
end
@@ -23,6 +23,7 @@
subject.expects(:pre_deploy)
subject.heroku.expects(:sync)
subject.heroku.expects(:migrate_database)
+ subject.heroku.expects(:restart_app)
subject.expects(:post_deploy)
subject.deploy
View
@@ -56,6 +56,39 @@
end
end
+describe Kumade::Heroku, "#restart_app", :with_mock_outputter do
+ let(:environment) { 'staging' }
+
+ before do
+ subject.stubs(:heroku)
+ force_add_heroku_remote(environment)
+ end
+
+ it "runs the heroku restart command" do
+ subject.restart_app
+
+ subject.should have_received(:heroku).with("restart")
+ end
+
+ it "prints a message" do
+ subject.restart_app
+
+ Kumade.configuration.outputter.should have_received(:success).with(regexp_matches(/Restarted #{environment}/))
+ end
+
+ context "when pretending" do
+ before do
+ Kumade.configuration.pretending = true
+ end
+
+ it "does not run the command" do
+ subject.restart_app
+
+ subject.should have_received(:heroku).never
+ end
+ end
+end
+
describe Kumade::Heroku, "#heroku", :with_mock_outputter do
let(:command_instance) { stub("Kumade::CommandLine instance", :run_or_error => true) }

0 comments on commit 99a14b7

Please sign in to comment.