kumade 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog.md +5 -0
- data/features/rake_task_pre_deploy.feature +21 -0
- data/features/step_definitions/rake_steps.rb +12 -0
- data/lib/kumade/deployer.rb +7 -0
- data/lib/kumade/git.rb +1 -0
- data/lib/kumade/version.rb +1 -1
- data/spec/kumade/deployer_spec.rb +15 -1
- data/spec/kumade/git_spec.rb +31 -16
- metadata +101 -91
data/Changelog.md
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
@slow
|
2
|
+
Feature: Rake task that always runs during pre deploy
|
3
|
+
As a user
|
4
|
+
I want a Rake task that runs before deployment
|
5
|
+
So that I can hook into the deployment process
|
6
|
+
|
7
|
+
Scenario: Pre-deploy task runs during deployment
|
8
|
+
Given a new Rails application with Kumade and Jammit
|
9
|
+
When I create a Heroku remote named "pretend-staging"
|
10
|
+
And I add a pre-deploy rake task that prints "Hi!"
|
11
|
+
And I run kumade with "pretend-staging"
|
12
|
+
Then the output should contain "kumade:pre_deploy"
|
13
|
+
And the output should contain "Hi!"
|
14
|
+
|
15
|
+
Scenario: Pre-deploy task does not run when pretending
|
16
|
+
Given a new Rails application with Kumade and Jammit
|
17
|
+
When I create a Heroku remote named "pretend-staging"
|
18
|
+
And I add a pre-deploy rake task that prints "Hi!"
|
19
|
+
And I run kumade with "pretend-staging -p"
|
20
|
+
Then the output should contain "kumade:pre_deploy"
|
21
|
+
But the output should not contain "Hi!"
|
@@ -36,3 +36,15 @@ When /^I add a pre-compilation rake task that prints "Hi!"$/ do
|
|
36
36
|
|
37
37
|
commit_everything_in_repo
|
38
38
|
end
|
39
|
+
|
40
|
+
When /^I add a pre-deploy rake task that prints "Hi!"$/ do
|
41
|
+
append_to_file("Rakefile", <<-CUSTOM_TASK)
|
42
|
+
namespace :kumade do
|
43
|
+
task :pre_deploy do
|
44
|
+
puts 'Hi!'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
CUSTOM_TASK
|
48
|
+
|
49
|
+
commit_everything_in_repo
|
50
|
+
end
|
data/lib/kumade/deployer.rb
CHANGED
@@ -28,6 +28,7 @@ module Kumade
|
|
28
28
|
|
29
29
|
def pre_deploy
|
30
30
|
ensure_clean_git
|
31
|
+
run_predeploy_task
|
31
32
|
package_assets
|
32
33
|
sync_origin
|
33
34
|
end
|
@@ -59,5 +60,11 @@ module Kumade
|
|
59
60
|
Kumade.configuration.outputter.error(%{Cannot deploy: "#{Kumade.configuration.environment}" remote does not exist})
|
60
61
|
end
|
61
62
|
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def run_predeploy_task
|
67
|
+
RakeTaskRunner.new("kumade:pre_deploy").invoke
|
68
|
+
end
|
62
69
|
end
|
63
70
|
end
|
data/lib/kumade/git.rb
CHANGED
data/lib/kumade/version.rb
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Kumade::Deployer, "#pre_deploy", :with_mock_outputter do
|
4
|
-
let(:git)
|
4
|
+
let(:git) { subject.git }
|
5
|
+
let(:rake_task_runner) { stub("RakeTaskRunner", :invoke => true) }
|
6
|
+
let(:packager) { stub("packager", :run => true) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
Kumade::Packager.stubs(:new => packager)
|
10
|
+
Kumade::RakeTaskRunner.stubs(:new).with("kumade:pre_deploy").returns(rake_task_runner)
|
11
|
+
end
|
5
12
|
|
6
13
|
it "calls the correct methods" do
|
7
14
|
git.expects(:ensure_clean_git)
|
@@ -10,6 +17,13 @@ describe Kumade::Deployer, "#pre_deploy", :with_mock_outputter do
|
|
10
17
|
|
11
18
|
subject.pre_deploy
|
12
19
|
end
|
20
|
+
|
21
|
+
it "invokes the kumade:pre_deploy task" do
|
22
|
+
subject.pre_deploy
|
23
|
+
|
24
|
+
Kumade::RakeTaskRunner.should have_received(:new).with("kumade:pre_deploy")
|
25
|
+
rake_task_runner.should have_received(:invoke)
|
26
|
+
end
|
13
27
|
end
|
14
28
|
|
15
29
|
describe Kumade::Deployer, "#deploy", :with_mock_outputter do
|
data/spec/kumade/git_spec.rb
CHANGED
@@ -43,27 +43,42 @@ end
|
|
43
43
|
describe Kumade::Git, "#push", :with_mock_outputter do
|
44
44
|
let(:branch) { 'branch' }
|
45
45
|
let(:remote) { 'my-remote' }
|
46
|
-
let(:command_line) { stub("Kumade::CommandLine instance", :run_or_error => true) }
|
47
46
|
|
48
|
-
|
49
|
-
Kumade::CommandLine
|
50
|
-
end
|
47
|
+
context "when the remote exists" do
|
48
|
+
let(:command_line) { stub("Kumade::CommandLine instance", :run_or_error => true) }
|
51
49
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
before do
|
51
|
+
Kumade::CommandLine.stubs(:new => command_line)
|
52
|
+
subject.stubs(:remote_exists? => true)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "pushes to the correct remote" do
|
56
|
+
subject.push(branch, remote)
|
57
|
+
Kumade::CommandLine.should have_received(:new).with("git push #{remote} #{branch}")
|
58
|
+
command_line.should have_received(:run_or_error).once
|
59
|
+
end
|
57
60
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
61
|
+
it "can force push" do
|
62
|
+
subject.push(branch, remote, true)
|
63
|
+
Kumade::CommandLine.should have_received(:new).with("git push -f #{remote} #{branch}")
|
64
|
+
command_line.should have_received(:run_or_error).once
|
65
|
+
end
|
66
|
+
|
67
|
+
it "prints a success message" do
|
68
|
+
subject.push(branch, remote)
|
69
|
+
Kumade.configuration.outputter.should have_received(:success).with("Pushed #{branch} -> #{remote}")
|
70
|
+
end
|
62
71
|
end
|
63
72
|
|
64
|
-
|
65
|
-
|
66
|
-
|
73
|
+
context "when the remote does not exist" do
|
74
|
+
before do
|
75
|
+
subject.stubs(:remote_exists? => false)
|
76
|
+
end
|
77
|
+
|
78
|
+
it "returns silently" do
|
79
|
+
subject.push(branch)
|
80
|
+
Kumade::CommandLine.should have_received(:new).never
|
81
|
+
end
|
67
82
|
end
|
68
83
|
end
|
69
84
|
|
metadata
CHANGED
@@ -1,136 +1,140 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: kumade
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.1
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 0.8.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Gabe Berke-Williams
|
9
9
|
- thoughtbot
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
|
14
|
+
date: 2012-01-09 00:00:00 -05:00
|
15
|
+
default_executable:
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
16
18
|
name: heroku
|
17
|
-
|
19
|
+
prerelease: false
|
20
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
21
|
none: false
|
19
|
-
requirements:
|
22
|
+
requirements:
|
20
23
|
- - ~>
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version:
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: "2.0"
|
23
26
|
type: :runtime
|
24
|
-
|
25
|
-
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
+
version_requirements: *id001
|
28
|
+
- !ruby/object:Gem::Dependency
|
27
29
|
name: rake
|
28
|
-
|
30
|
+
prerelease: false
|
31
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
32
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
33
36
|
version: 0.8.7
|
34
37
|
type: :runtime
|
35
|
-
|
36
|
-
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
+
version_requirements: *id002
|
39
|
+
- !ruby/object:Gem::Dependency
|
38
40
|
name: cocaine
|
39
|
-
|
41
|
+
prerelease: false
|
42
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
43
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
44
47
|
version: 0.2.0
|
45
48
|
type: :runtime
|
46
|
-
|
47
|
-
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
+
version_requirements: *id003
|
50
|
+
- !ruby/object:Gem::Dependency
|
49
51
|
name: rails
|
50
|
-
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
51
54
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: "2"
|
56
59
|
type: :runtime
|
57
|
-
|
58
|
-
|
59
|
-
- !ruby/object:Gem::Dependency
|
60
|
+
version_requirements: *id004
|
61
|
+
- !ruby/object:Gem::Dependency
|
60
62
|
name: rspec
|
61
|
-
|
63
|
+
prerelease: false
|
64
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
62
65
|
none: false
|
63
|
-
requirements:
|
66
|
+
requirements:
|
64
67
|
- - ~>
|
65
|
-
- !ruby/object:Gem::Version
|
68
|
+
- !ruby/object:Gem::Version
|
66
69
|
version: 2.6.0
|
67
70
|
type: :development
|
68
|
-
|
69
|
-
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
+
version_requirements: *id005
|
72
|
+
- !ruby/object:Gem::Dependency
|
71
73
|
name: cucumber
|
72
|
-
|
74
|
+
prerelease: false
|
75
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
73
76
|
none: false
|
74
|
-
requirements:
|
77
|
+
requirements:
|
75
78
|
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
79
|
+
- !ruby/object:Gem::Version
|
77
80
|
version: 1.0.2
|
78
81
|
type: :development
|
79
|
-
|
80
|
-
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
+
version_requirements: *id006
|
83
|
+
- !ruby/object:Gem::Dependency
|
82
84
|
name: aruba
|
83
|
-
|
85
|
+
prerelease: false
|
86
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
84
87
|
none: false
|
85
|
-
requirements:
|
88
|
+
requirements:
|
86
89
|
- - ~>
|
87
|
-
- !ruby/object:Gem::Version
|
90
|
+
- !ruby/object:Gem::Version
|
88
91
|
version: 0.4.3
|
89
92
|
type: :development
|
90
|
-
|
91
|
-
|
92
|
-
- !ruby/object:Gem::Dependency
|
93
|
+
version_requirements: *id007
|
94
|
+
- !ruby/object:Gem::Dependency
|
93
95
|
name: jammit
|
94
|
-
|
96
|
+
prerelease: false
|
97
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
95
98
|
none: false
|
96
|
-
requirements:
|
99
|
+
requirements:
|
97
100
|
- - ~>
|
98
|
-
- !ruby/object:Gem::Version
|
101
|
+
- !ruby/object:Gem::Version
|
99
102
|
version: 0.6.3
|
100
103
|
type: :development
|
101
|
-
|
102
|
-
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
+
version_requirements: *id008
|
105
|
+
- !ruby/object:Gem::Dependency
|
104
106
|
name: bourne
|
105
|
-
|
107
|
+
prerelease: false
|
108
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
106
109
|
none: false
|
107
|
-
requirements:
|
108
|
-
- -
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: "0"
|
111
114
|
type: :development
|
112
|
-
|
113
|
-
|
114
|
-
- !ruby/object:Gem::Dependency
|
115
|
+
version_requirements: *id009
|
116
|
+
- !ruby/object:Gem::Dependency
|
115
117
|
name: simplecov
|
116
|
-
|
118
|
+
prerelease: false
|
119
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
117
120
|
none: false
|
118
|
-
requirements:
|
119
|
-
- -
|
120
|
-
- !ruby/object:Gem::Version
|
121
|
-
version:
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: "0"
|
122
125
|
type: :development
|
123
|
-
|
124
|
-
version_requirements: *70189854580720
|
126
|
+
version_requirements: *id010
|
125
127
|
description: A well-tested script for easy deploying to Heroku
|
126
|
-
email:
|
128
|
+
email:
|
127
129
|
- gabe@thoughtbot.com
|
128
130
|
- support@thoughtbot.com
|
129
|
-
executables:
|
131
|
+
executables:
|
130
132
|
- kumade
|
131
133
|
extensions: []
|
134
|
+
|
132
135
|
extra_rdoc_files: []
|
133
|
-
|
136
|
+
|
137
|
+
files:
|
134
138
|
- .gitignore
|
135
139
|
- .simplecov
|
136
140
|
- .travis.yml
|
@@ -147,6 +151,7 @@ files:
|
|
147
151
|
- features/no_op_packager.feature
|
148
152
|
- features/railtie.feature
|
149
153
|
- features/rake_task_before_asset_compilation.feature
|
154
|
+
- features/rake_task_pre_deploy.feature
|
150
155
|
- features/step_definitions/bundler_steps.rb
|
151
156
|
- features/step_definitions/git_steps.rb
|
152
157
|
- features/step_definitions/jammit_steps.rb
|
@@ -198,31 +203,35 @@ files:
|
|
198
203
|
- spec/support/git.rb
|
199
204
|
- spec/support/heroku.rb
|
200
205
|
- spec/support/shared_examples/packager.rb
|
206
|
+
has_rdoc: true
|
201
207
|
homepage: http://thoughtbot.com/community/
|
202
208
|
licenses: []
|
209
|
+
|
203
210
|
post_install_message:
|
204
211
|
rdoc_options: []
|
205
|
-
|
212
|
+
|
213
|
+
require_paths:
|
206
214
|
- lib
|
207
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
215
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
208
216
|
none: false
|
209
|
-
requirements:
|
210
|
-
- -
|
211
|
-
- !ruby/object:Gem::Version
|
212
|
-
version:
|
213
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - ">="
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: "0"
|
221
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
222
|
none: false
|
215
|
-
requirements:
|
216
|
-
- -
|
217
|
-
- !ruby/object:Gem::Version
|
218
|
-
version:
|
223
|
+
requirements:
|
224
|
+
- - ">="
|
225
|
+
- !ruby/object:Gem::Version
|
226
|
+
version: "0"
|
219
227
|
requirements: []
|
228
|
+
|
220
229
|
rubyforge_project:
|
221
|
-
rubygems_version: 1.
|
230
|
+
rubygems_version: 1.6.2
|
222
231
|
signing_key:
|
223
232
|
specification_version: 3
|
224
233
|
summary: A well-tested script for easy deploying to Heroku
|
225
|
-
test_files:
|
234
|
+
test_files:
|
226
235
|
- features/git.feature
|
227
236
|
- features/jammit.feature
|
228
237
|
- features/kumade_executable.feature
|
@@ -230,6 +239,7 @@ test_files:
|
|
230
239
|
- features/no_op_packager.feature
|
231
240
|
- features/railtie.feature
|
232
241
|
- features/rake_task_before_asset_compilation.feature
|
242
|
+
- features/rake_task_pre_deploy.feature
|
233
243
|
- features/step_definitions/bundler_steps.rb
|
234
244
|
- features/step_definitions/git_steps.rb
|
235
245
|
- features/step_definitions/jammit_steps.rb
|