kumade 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +9 -1
- data/features/kumade_executable.feature +11 -12
- data/features/kumade_without_jammit.feature +2 -2
- data/kumade.gemspec +1 -0
- data/lib/kumade.rb +7 -1
- data/lib/kumade/cli.rb +4 -4
- data/lib/kumade/command_line.rb +33 -0
- data/lib/kumade/configuration.rb +13 -6
- data/lib/kumade/deployer.rb +9 -9
- data/lib/kumade/git.rb +25 -20
- data/lib/kumade/heroku.rb +18 -11
- data/lib/kumade/outputter.rb +21 -0
- data/lib/kumade/packager.rb +23 -76
- data/lib/kumade/packager_list.rb +29 -0
- data/lib/kumade/packagers/jammit_packager.rb +20 -0
- data/lib/kumade/packagers/more_packager.rb +20 -0
- data/lib/kumade/packagers/noop_packager.rb +14 -0
- data/lib/kumade/rake_task_runner.rb +29 -0
- data/lib/kumade/version.rb +1 -1
- data/spec/kumade/cli_spec.rb +5 -5
- data/spec/kumade/command_line_spec.rb +107 -0
- data/spec/kumade/configuration_spec.rb +15 -2
- data/spec/kumade/deployer_spec.rb +39 -25
- data/spec/kumade/git_spec.rb +168 -57
- data/spec/kumade/heroku_spec.rb +19 -25
- data/spec/kumade/outputter_spec.rb +50 -0
- data/spec/kumade/packager_list_spec.rb +31 -0
- data/spec/kumade/packager_spec.rb +66 -275
- data/spec/kumade/packagers/jammit_packager_spec.rb +27 -0
- data/spec/kumade/packagers/more_packager_spec.rb +37 -0
- data/spec/kumade/packagers/noop_packager_spec.rb +9 -0
- data/spec/kumade/rake_task_runner_spec.rb +75 -0
- data/spec/spec_helper.rb +13 -2
- data/spec/support/define_constant.rb +41 -0
- data/spec/support/environments.rb +32 -0
- data/spec/support/git.rb +5 -0
- data/spec/support/heroku.rb +6 -6
- data/spec/support/shared_examples/packager.rb +6 -0
- metadata +65 -28
- data/lib/kumade/base.rb +0 -35
- data/spec/kumade/base_spec.rb +0 -99
@@ -0,0 +1,75 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Kumade::RakeTaskRunner, :with_mock_outputter do
|
4
|
+
context "when the task doesn't exist" do
|
5
|
+
subject { Kumade::RakeTaskRunner.new("bogus:task") }
|
6
|
+
|
7
|
+
it "does not notify the user that the task was run successfully" do
|
8
|
+
subject.invoke
|
9
|
+
Kumade.configuration.outputter.should have_received(:success).never
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
context "when Rakefile exists" do
|
14
|
+
subject { Kumade::RakeTaskRunner.new("bogus:task") }
|
15
|
+
|
16
|
+
before do
|
17
|
+
File.stubs(:exist?).with("Rakefile").returns(true)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "loads the Rakefile" do
|
21
|
+
subject.stubs(:load).with("Rakefile")
|
22
|
+
subject.invoke
|
23
|
+
subject.should have_received(:load).with("Rakefile")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "when the task exists" do
|
28
|
+
let(:task_name) { "kumade:test:custom_task_name" }
|
29
|
+
let(:invoked_task) { stub("invoked", :invoke! => false) }
|
30
|
+
|
31
|
+
before do
|
32
|
+
Rake::Task.define_task task_name do
|
33
|
+
invoked_task.invoke!
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
after do
|
38
|
+
Rake::Task[task_name].reenable
|
39
|
+
end
|
40
|
+
|
41
|
+
subject { Kumade::RakeTaskRunner.new(task_name) }
|
42
|
+
|
43
|
+
context "when pretending" do
|
44
|
+
before do
|
45
|
+
Kumade.configuration.pretending = true
|
46
|
+
end
|
47
|
+
|
48
|
+
it "notifies the user that the task was run successfully" do
|
49
|
+
subject.invoke
|
50
|
+
Kumade.configuration.outputter.should have_received(:success).with("Running rake task: #{task_name}")
|
51
|
+
end
|
52
|
+
|
53
|
+
it "does not invoke the task" do
|
54
|
+
subject.invoke
|
55
|
+
invoked_task.should have_received(:invoke!).never
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context "when not pretending" do
|
60
|
+
before do
|
61
|
+
Kumade.configuration.pretending = false
|
62
|
+
end
|
63
|
+
|
64
|
+
it "notifies the user that the task was run successfully" do
|
65
|
+
subject.invoke
|
66
|
+
Kumade.configuration.outputter.should have_received(:success).with("Running rake task: #{task_name}")
|
67
|
+
end
|
68
|
+
|
69
|
+
it "invokes the task" do
|
70
|
+
subject.invoke
|
71
|
+
invoked_task.should have_received(:invoke!).once
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -19,9 +19,8 @@ module GitRemoteHelpers
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
22
|
spec_dir = Pathname.new(File.expand_path(File.dirname(__FILE__)))
|
24
|
-
Dir[spec_dir.join('support', '**')].each {|f| require File.expand_path(f) }
|
23
|
+
Dir[spec_dir.join('support', '**', "*.rb")].each {|f| require File.expand_path(f) }
|
25
24
|
|
26
25
|
RSpec.configure do |config|
|
27
26
|
config.mock_with :mocha
|
@@ -30,6 +29,8 @@ RSpec.configure do |config|
|
|
30
29
|
config.include Rake::DSL if defined?(Rake::DSL)
|
31
30
|
|
32
31
|
config.include GitRemoteHelpers
|
32
|
+
config.include GitHelpers
|
33
|
+
config.include EnvironmentHelpers
|
33
34
|
config.include Aruba::Api
|
34
35
|
|
35
36
|
config.around do |example|
|
@@ -44,6 +45,16 @@ RSpec.configure do |config|
|
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
48
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
49
|
+
|
50
|
+
config.before(:each, :with_mock_outputter) do
|
51
|
+
Kumade.configuration.outputter = stub("Null Outputter", :success => true, :error => true, :info => true, :say_command => true)
|
52
|
+
end
|
53
|
+
|
54
|
+
config.after(:each, :with_mock_outputter) do
|
55
|
+
Kumade.configuration.outputter = Kumade::Outputter.new
|
56
|
+
end
|
57
|
+
|
47
58
|
config.after do
|
48
59
|
Kumade.configuration = Kumade::Configuration.new
|
49
60
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module DefineConstant
|
2
|
+
def define_constant(path, base = Object, &block)
|
3
|
+
namespace, class_name = *constant_path(path)
|
4
|
+
klass = Class.new(base)
|
5
|
+
namespace.const_set(class_name, klass)
|
6
|
+
klass.class_eval(&block) if block_given?
|
7
|
+
@defined_constants << path
|
8
|
+
klass
|
9
|
+
end
|
10
|
+
|
11
|
+
def clear_generated_constants
|
12
|
+
@defined_constants.reverse.each do |path|
|
13
|
+
namespace, class_name = *constant_path(path)
|
14
|
+
if namespace.const_defined?(class_name)
|
15
|
+
namespace.send(:remove_const, class_name)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
@defined_constants.clear
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def constant_path(constant_name)
|
25
|
+
names = constant_name.split('::')
|
26
|
+
class_name = names.pop
|
27
|
+
namespace = names.inject(Object) { |result, name| result.const_get(name) }
|
28
|
+
[namespace, class_name]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
RSpec.configure do |config|
|
33
|
+
config.include DefineConstant
|
34
|
+
config.before do
|
35
|
+
@defined_constants = []
|
36
|
+
end
|
37
|
+
|
38
|
+
config.after do
|
39
|
+
clear_generated_constants
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module EnvironmentHelpers
|
2
|
+
shared_context "with Heroku environment" do
|
3
|
+
let(:environment) { 'staging' }
|
4
|
+
before do
|
5
|
+
force_add_heroku_remote(environment)
|
6
|
+
Kumade.configuration.environment = environment
|
7
|
+
end
|
8
|
+
|
9
|
+
after { remove_remote(environment) }
|
10
|
+
end
|
11
|
+
|
12
|
+
shared_context "with Heroku-accounts environment" do
|
13
|
+
let(:environment) { 'heroku-accounts' }
|
14
|
+
let(:heroku_url) { 'git@heroku.work:my-app.git' }
|
15
|
+
before do
|
16
|
+
`git remote add #{environment} #{heroku_url}`
|
17
|
+
Kumade.configuration.environment = environment
|
18
|
+
end
|
19
|
+
after { remove_remote(environment) }
|
20
|
+
end
|
21
|
+
|
22
|
+
shared_context "with non-Heroku environment" do
|
23
|
+
let(:environment) { 'not-heroku' }
|
24
|
+
let(:not_a_heroku_url) { 'git@github.com:gabebw/kumade.git' }
|
25
|
+
|
26
|
+
before do
|
27
|
+
`git remote add #{environment} #{not_a_heroku_url}`
|
28
|
+
Kumade.configuration.environment = environment
|
29
|
+
end
|
30
|
+
after { remove_remote(environment) }
|
31
|
+
end
|
32
|
+
end
|
data/spec/support/git.rb
ADDED
data/spec/support/heroku.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
shared_context "when on Cedar" do
|
2
|
-
let(:command_line) { mock("
|
2
|
+
let(:command_line) { mock("Kumade::CommandLine instance") }
|
3
3
|
|
4
4
|
before do
|
5
|
-
|
5
|
+
Kumade::CommandLine.expects(:new).
|
6
6
|
with("bundle exec heroku stack --remote staging").
|
7
7
|
returns(command_line)
|
8
8
|
|
9
|
-
command_line.expects(:
|
9
|
+
command_line.expects(:run_or_error).returns(%{
|
10
10
|
aspen-mri-1.8.6
|
11
11
|
bamboo-mri-1.9.2
|
12
12
|
bamboo-ree-1.8.7
|
@@ -16,14 +16,14 @@ shared_context "when on Cedar" do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
shared_context "when not on Cedar" do
|
19
|
-
let(:command_line) { mock("
|
19
|
+
let(:command_line) { mock("Kumade::CommandLine") }
|
20
20
|
|
21
21
|
before do
|
22
|
-
|
22
|
+
Kumade::CommandLine.expects(:new).
|
23
23
|
with("bundle exec heroku stack --remote staging").
|
24
24
|
returns(command_line)
|
25
25
|
|
26
|
-
command_line.expects(:
|
26
|
+
command_line.expects(:run_or_error).returns(%{
|
27
27
|
aspen-mri-1.8.6
|
28
28
|
* bamboo-mri-1.9.2
|
29
29
|
bamboo-ree-1.8.7
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kumade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-10-14 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: heroku
|
17
|
-
requirement: &
|
17
|
+
requirement: &70273404653120 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '2.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70273404653120
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: thor
|
28
|
-
requirement: &
|
28
|
+
requirement: &70273404650560 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0.14'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70273404650560
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: rake
|
39
|
-
requirement: &
|
39
|
+
requirement: &70273404649280 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 0.8.7
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70273404649280
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: cocaine
|
50
|
-
requirement: &
|
50
|
+
requirement: &70273404648340 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: 0.2.0
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70273404648340
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: rake
|
61
|
-
requirement: &
|
61
|
+
requirement: &70273404647040 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: 0.8.7
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70273404647040
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rspec
|
72
|
-
requirement: &
|
72
|
+
requirement: &70273404646180 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 2.6.0
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70273404646180
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: cucumber
|
83
|
-
requirement: &
|
83
|
+
requirement: &70273404645480 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: 1.0.2
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *70273404645480
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: aruba
|
94
|
-
requirement: &
|
94
|
+
requirement: &70273404644760 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ~>
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: 0.4.3
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *70273404644760
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: jammit
|
105
|
-
requirement: &
|
105
|
+
requirement: &70273404644040 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - ~>
|
@@ -110,10 +110,21 @@ dependencies:
|
|
110
110
|
version: 0.6.3
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *70273404644040
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: less
|
116
|
+
requirement: &70273404643300 !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ~>
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '2.0'
|
122
|
+
type: :development
|
123
|
+
prerelease: false
|
124
|
+
version_requirements: *70273404643300
|
114
125
|
- !ruby/object:Gem::Dependency
|
115
126
|
name: bourne
|
116
|
-
requirement: &
|
127
|
+
requirement: &70273404642820 !ruby/object:Gem::Requirement
|
117
128
|
none: false
|
118
129
|
requirements:
|
119
130
|
- - ! '>='
|
@@ -121,7 +132,7 @@ dependencies:
|
|
121
132
|
version: '0'
|
122
133
|
type: :development
|
123
134
|
prerelease: false
|
124
|
-
version_requirements: *
|
135
|
+
version_requirements: *70273404642820
|
125
136
|
description: A well-tested script for easy deploying to Heroku
|
126
137
|
email:
|
127
138
|
- gabe@thoughtbot.com
|
@@ -147,27 +158,43 @@ files:
|
|
147
158
|
- features/support/env.rb
|
148
159
|
- kumade.gemspec
|
149
160
|
- lib/kumade.rb
|
150
|
-
- lib/kumade/base.rb
|
151
161
|
- lib/kumade/cli.rb
|
162
|
+
- lib/kumade/command_line.rb
|
152
163
|
- lib/kumade/configuration.rb
|
153
164
|
- lib/kumade/deployer.rb
|
154
165
|
- lib/kumade/deployment_error.rb
|
155
166
|
- lib/kumade/git.rb
|
156
167
|
- lib/kumade/heroku.rb
|
168
|
+
- lib/kumade/outputter.rb
|
157
169
|
- lib/kumade/packager.rb
|
170
|
+
- lib/kumade/packager_list.rb
|
171
|
+
- lib/kumade/packagers/jammit_packager.rb
|
172
|
+
- lib/kumade/packagers/more_packager.rb
|
173
|
+
- lib/kumade/packagers/noop_packager.rb
|
158
174
|
- lib/kumade/railtie.rb
|
175
|
+
- lib/kumade/rake_task_runner.rb
|
159
176
|
- lib/kumade/version.rb
|
160
177
|
- lib/tasks/deploy.rake
|
161
|
-
- spec/kumade/base_spec.rb
|
162
178
|
- spec/kumade/cli_spec.rb
|
179
|
+
- spec/kumade/command_line_spec.rb
|
163
180
|
- spec/kumade/configuration_spec.rb
|
164
181
|
- spec/kumade/deployer_spec.rb
|
165
182
|
- spec/kumade/git_spec.rb
|
166
183
|
- spec/kumade/heroku_spec.rb
|
184
|
+
- spec/kumade/outputter_spec.rb
|
185
|
+
- spec/kumade/packager_list_spec.rb
|
167
186
|
- spec/kumade/packager_spec.rb
|
187
|
+
- spec/kumade/packagers/jammit_packager_spec.rb
|
188
|
+
- spec/kumade/packagers/more_packager_spec.rb
|
189
|
+
- spec/kumade/packagers/noop_packager_spec.rb
|
190
|
+
- spec/kumade/rake_task_runner_spec.rb
|
168
191
|
- spec/kumade_spec.rb
|
169
192
|
- spec/spec_helper.rb
|
193
|
+
- spec/support/define_constant.rb
|
194
|
+
- spec/support/environments.rb
|
195
|
+
- spec/support/git.rb
|
170
196
|
- spec/support/heroku.rb
|
197
|
+
- spec/support/shared_examples/packager.rb
|
171
198
|
homepage: http://thoughtbot.com/community/
|
172
199
|
licenses: []
|
173
200
|
post_install_message:
|
@@ -182,7 +209,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
182
209
|
version: '0'
|
183
210
|
segments:
|
184
211
|
- 0
|
185
|
-
hash:
|
212
|
+
hash: 724534950492440132
|
186
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
214
|
none: false
|
188
215
|
requirements:
|
@@ -191,10 +218,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
218
|
version: '0'
|
192
219
|
segments:
|
193
220
|
- 0
|
194
|
-
hash:
|
221
|
+
hash: 724534950492440132
|
195
222
|
requirements: []
|
196
223
|
rubyforge_project:
|
197
|
-
rubygems_version: 1.8.
|
224
|
+
rubygems_version: 1.8.11
|
198
225
|
signing_key:
|
199
226
|
specification_version: 3
|
200
227
|
summary: A well-tested script for easy deploying to Heroku
|
@@ -206,13 +233,23 @@ test_files:
|
|
206
233
|
- features/step_definitions/git_steps.rb
|
207
234
|
- features/step_definitions/kumade_steps.rb
|
208
235
|
- features/support/env.rb
|
209
|
-
- spec/kumade/base_spec.rb
|
210
236
|
- spec/kumade/cli_spec.rb
|
237
|
+
- spec/kumade/command_line_spec.rb
|
211
238
|
- spec/kumade/configuration_spec.rb
|
212
239
|
- spec/kumade/deployer_spec.rb
|
213
240
|
- spec/kumade/git_spec.rb
|
214
241
|
- spec/kumade/heroku_spec.rb
|
242
|
+
- spec/kumade/outputter_spec.rb
|
243
|
+
- spec/kumade/packager_list_spec.rb
|
215
244
|
- spec/kumade/packager_spec.rb
|
245
|
+
- spec/kumade/packagers/jammit_packager_spec.rb
|
246
|
+
- spec/kumade/packagers/more_packager_spec.rb
|
247
|
+
- spec/kumade/packagers/noop_packager_spec.rb
|
248
|
+
- spec/kumade/rake_task_runner_spec.rb
|
216
249
|
- spec/kumade_spec.rb
|
217
250
|
- spec/spec_helper.rb
|
251
|
+
- spec/support/define_constant.rb
|
252
|
+
- spec/support/environments.rb
|
253
|
+
- spec/support/git.rb
|
218
254
|
- spec/support/heroku.rb
|
255
|
+
- spec/support/shared_examples/packager.rb
|