kumade 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/features/kumade_executable.feature +1 -1
- data/lib/kumade/deployer.rb +10 -10
- data/lib/kumade/version.rb +1 -1
- data/spec/kumade/deployer_spec.rb +21 -21
- metadata +1 -1
@@ -19,7 +19,7 @@ Feature: Kumade executable
|
|
19
19
|
==> Packaged assets with Jammit
|
20
20
|
run git push origin master
|
21
21
|
==> Pushed master -> origin
|
22
|
-
run git push -f pretend-staging master
|
22
|
+
run git push -f pretend-staging deploy:master
|
23
23
|
==> Force pushed master -> pretend-staging
|
24
24
|
run bundle exec heroku rake db:migrate --app pretend-staging-app
|
25
25
|
==> Migrated pretend-staging-app
|
data/lib/kumade/deployer.rb
CHANGED
@@ -12,7 +12,7 @@ module Kumade
|
|
12
12
|
string_environment = environment.to_s
|
13
13
|
ensure_heroku_remote_exists_for(string_environment)
|
14
14
|
pre_deploy
|
15
|
-
|
15
|
+
sync_heroku(string_environment)
|
16
16
|
heroku_migrate(string_environment)
|
17
17
|
post_deploy
|
18
18
|
end
|
@@ -20,19 +20,19 @@ module Kumade
|
|
20
20
|
def pre_deploy
|
21
21
|
ensure_clean_git
|
22
22
|
package_assets
|
23
|
-
|
23
|
+
sync_github
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
27
|
-
run_or_error("git push
|
28
|
-
"Failed to push master ->
|
29
|
-
success("Pushed master ->
|
26
|
+
def sync_github
|
27
|
+
run_or_error("git push origin master",
|
28
|
+
"Failed to push master -> origin")
|
29
|
+
success("Pushed master -> origin")
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
33
|
-
run_or_error("git push -f #{
|
34
|
-
"Failed to force push
|
35
|
-
success("Force pushed master -> #{
|
32
|
+
def sync_heroku(environment)
|
33
|
+
run_or_error("git push -f #{environment} #{DEPLOY_BRANCH}:master",
|
34
|
+
"Failed to force push #{DEPLOY_BRANCH} -> #{environment}/master")
|
35
|
+
success("Force pushed master -> #{environment}")
|
36
36
|
end
|
37
37
|
|
38
38
|
def heroku_migrate(environment)
|
data/lib/kumade/version.rb
CHANGED
@@ -7,7 +7,7 @@ describe Kumade::Deployer, "#pre_deploy" do
|
|
7
7
|
%w(
|
8
8
|
ensure_clean_git
|
9
9
|
package_assets
|
10
|
-
|
10
|
+
sync_github
|
11
11
|
).each do |task|
|
12
12
|
subject.should_receive(task).ordered.and_return(true)
|
13
13
|
end
|
@@ -23,7 +23,7 @@ describe Kumade::Deployer, "#pre_deploy" do
|
|
23
23
|
subject.stub(task)
|
24
24
|
end
|
25
25
|
|
26
|
-
subject.should_receive(:
|
26
|
+
subject.should_receive(:sync_github)
|
27
27
|
subject.pre_deploy
|
28
28
|
end
|
29
29
|
end
|
@@ -50,7 +50,7 @@ describe Kumade::Deployer, "#deploy_to" do
|
|
50
50
|
ordered.
|
51
51
|
and_return(true)
|
52
52
|
|
53
|
-
subject.should_receive(:
|
53
|
+
subject.should_receive(:sync_heroku).
|
54
54
|
ordered.
|
55
55
|
and_return(true)
|
56
56
|
|
@@ -69,13 +69,13 @@ describe Kumade::Deployer, "#deploy_to" do
|
|
69
69
|
:on_cedar? => false,
|
70
70
|
:run => true)
|
71
71
|
|
72
|
-
subject.should_receive(:
|
72
|
+
subject.should_receive(:sync_heroku).with(remote_name)
|
73
73
|
|
74
74
|
subject.deploy_to(remote_name)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
describe Kumade::Deployer, "#
|
78
|
+
describe Kumade::Deployer, "#sync_github" do
|
79
79
|
let(:remote){ 'origin' }
|
80
80
|
|
81
81
|
before { subject.stub(:say) }
|
@@ -84,7 +84,7 @@ describe Kumade::Deployer, "#git_push" do
|
|
84
84
|
subject.should_receive(:run).
|
85
85
|
with("git push #{remote} master").
|
86
86
|
and_return(true)
|
87
|
-
subject.
|
87
|
+
subject.sync_github
|
88
88
|
end
|
89
89
|
|
90
90
|
context "when `git push` fails" do
|
@@ -93,49 +93,49 @@ describe Kumade::Deployer, "#git_push" do
|
|
93
93
|
it "prints an error message" do
|
94
94
|
subject.should_receive(:error).with("Failed to push master -> #{remote}")
|
95
95
|
|
96
|
-
subject.
|
96
|
+
subject.sync_github
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
context "when
|
100
|
+
context "when syncing github succeeds" do
|
101
101
|
before { subject.stub(:run => true) }
|
102
102
|
|
103
103
|
it "does not raise an error" do
|
104
104
|
subject.should_not_receive(:error)
|
105
|
-
subject.
|
105
|
+
subject.sync_github
|
106
106
|
end
|
107
107
|
|
108
108
|
it "prints a success message" do
|
109
109
|
subject.should_receive(:success).with("Pushed master -> #{remote}")
|
110
110
|
|
111
|
-
subject.
|
111
|
+
subject.sync_github
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
-
describe Kumade::Deployer, "#
|
117
|
-
let(:
|
116
|
+
describe Kumade::Deployer, "#sync_heroku" do
|
117
|
+
let(:environment) { 'staging' }
|
118
118
|
before { subject.stub(:say) }
|
119
119
|
|
120
120
|
it "calls `git push -f`" do
|
121
121
|
subject.should_receive(:run).
|
122
|
-
with("git push -f #{
|
122
|
+
with("git push -f #{environment} deploy:master").
|
123
123
|
and_return(true)
|
124
|
-
subject.
|
124
|
+
subject.sync_heroku(environment)
|
125
125
|
end
|
126
126
|
|
127
|
-
context "when
|
127
|
+
context "when syncing to heroku fails" do
|
128
128
|
before do
|
129
129
|
subject.stub(:run => false)
|
130
130
|
end
|
131
131
|
|
132
132
|
it "prints an error" do
|
133
|
-
subject.should_receive(:error)
|
134
|
-
subject.
|
133
|
+
subject.should_receive(:error)
|
134
|
+
subject.sync_heroku(environment)
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
-
context "when
|
138
|
+
context "when syncing to heroku succeeds" do
|
139
139
|
before do
|
140
140
|
subject.stub(:run => true)
|
141
141
|
subject.stub(:say)
|
@@ -143,14 +143,14 @@ describe Kumade::Deployer, "#git_force_push" do
|
|
143
143
|
|
144
144
|
it "does not raise an error" do
|
145
145
|
subject.should_not_receive(:error)
|
146
|
-
subject.
|
146
|
+
subject.sync_heroku(environment)
|
147
147
|
end
|
148
148
|
|
149
149
|
it "prints a success message" do
|
150
150
|
subject.should_receive(:success).
|
151
|
-
with("Force pushed master -> #{
|
151
|
+
with("Force pushed master -> #{environment}")
|
152
152
|
|
153
|
-
subject.
|
153
|
+
subject.sync_heroku(environment)
|
154
154
|
end
|
155
155
|
end
|
156
156
|
end
|