Skip to content
This repository has been archived by the owner on Jun 8, 2019. It is now read-only.

Commit

Permalink
Kumade now restarts Heroku app after db:migrate.
Browse files Browse the repository at this point in the history
  • Loading branch information
hoverlover committed Oct 16, 2011
1 parent c0d12cb commit 99a14b7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/kumade/deployer.rb
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions lib/kumade/heroku.rb
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions spec/kumade/deployer_spec.rb
Expand Up @@ -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
Expand Down
33 changes: 33 additions & 0 deletions spec/kumade/heroku_spec.rb
Expand Up @@ -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) }

Expand Down

0 comments on commit 99a14b7

Please sign in to comment.