Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Kumade now restarts Heroku app after db:migrate.

  • Loading branch information...
commit 99a14b73fcb346ad5b466fdade729041cfa86af6 1 parent c0d12cb
Chad Boyd authored
1  lib/kumade/deployer.rb
@@ -18,6 +18,7 @@ def deploy
18 18
         pre_deploy
19 19
         heroku.sync
20 20
         heroku.migrate_database
  21
+        heroku.restart_app
21 22
       rescue => deploying_error
22 23
         Kumade.configuration.outputter.error("#{deploying_error.class}: #{deploying_error.message}")
23 24
       ensure
5  lib/kumade/heroku.rb
@@ -20,6 +20,11 @@ def migrate_database
20 20
       Kumade.configuration.outputter.success("Migrated #{Kumade.configuration.environment}")
21 21
     end
22 22
 
  23
+    def restart_app
  24
+      heroku("restart") unless Kumade.configuration.pretending?
  25
+      Kumade.configuration.outputter.success("Restarted #{Kumade.configuration.environment}")
  26
+    end
  27
+
23 28
     def delete_deploy_branch
24 29
       git.delete(DEPLOY_BRANCH, @branch)
25 30
     end
1  spec/kumade/deployer_spec.rb
@@ -23,6 +23,7 @@
23 23
     subject.expects(:pre_deploy)
24 24
     subject.heroku.expects(:sync)
25 25
     subject.heroku.expects(:migrate_database)
  26
+    subject.heroku.expects(:restart_app)
26 27
     subject.expects(:post_deploy)
27 28
 
28 29
     subject.deploy
33  spec/kumade/heroku_spec.rb
@@ -56,6 +56,39 @@
56 56
   end
57 57
 end
58 58
 
  59
+describe Kumade::Heroku, "#restart_app", :with_mock_outputter do
  60
+  let(:environment) { 'staging' }
  61
+
  62
+  before do
  63
+    subject.stubs(:heroku)
  64
+    force_add_heroku_remote(environment)
  65
+  end
  66
+
  67
+  it "runs the heroku restart command" do
  68
+    subject.restart_app
  69
+
  70
+    subject.should have_received(:heroku).with("restart")
  71
+  end
  72
+
  73
+  it "prints a message" do
  74
+    subject.restart_app
  75
+
  76
+    Kumade.configuration.outputter.should have_received(:success).with(regexp_matches(/Restarted #{environment}/))
  77
+  end
  78
+
  79
+  context "when pretending" do
  80
+    before do
  81
+      Kumade.configuration.pretending = true
  82
+    end
  83
+
  84
+    it "does not run the command" do
  85
+      subject.restart_app
  86
+
  87
+      subject.should have_received(:heroku).never
  88
+    end
  89
+  end
  90
+end
  91
+
59 92
 describe Kumade::Heroku, "#heroku", :with_mock_outputter do
60 93
   let(:command_instance) { stub("Kumade::CommandLine instance", :run_or_error => true) }
61 94
 

0 notes on commit 99a14b7

Please sign in to comment.
Something went wrong with that request. Please try again.