monkeyhelper-jeweler 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/ChangeLog.markdown +83 -0
- data/LICENSE +20 -0
- data/README.markdown +170 -0
- data/ROADMAP +12 -0
- data/Rakefile +106 -0
- data/VERSION.yml +4 -0
- data/bin/jeweler +8 -0
- data/features/generator/cucumber.feature +83 -0
- data/features/generator/directory_layout.feature +76 -0
- data/features/generator/dotdocument.feature +14 -0
- data/features/generator/env_options.feature +9 -0
- data/features/generator/git.feature +94 -0
- data/features/generator/license.feature +11 -0
- data/features/generator/rakefile.feature +110 -0
- data/features/generator/readme.feature +12 -0
- data/features/generator/test.feature +41 -0
- data/features/generator/test_helper.feature +49 -0
- data/features/placeholder.feature +5 -0
- data/features/step_definitions/debug_steps.rb +6 -0
- data/features/step_definitions/filesystem_steps.rb +65 -0
- data/features/step_definitions/generator_steps.rb +251 -0
- data/features/step_definitions/task_steps.rb +6 -0
- data/features/support/env.rb +19 -0
- data/features/tasks/build_gem.feature +9 -0
- data/features/tasks/version.feature +24 -0
- data/features/tasks/version_bumping.feature +33 -0
- data/jeweler.gemspec +204 -0
- data/lib/jeweler.rb +142 -0
- data/lib/jeweler/commands.rb +12 -0
- data/lib/jeweler/commands/build_gem.rb +31 -0
- data/lib/jeweler/commands/install_gem.rb +26 -0
- data/lib/jeweler/commands/release.rb +83 -0
- data/lib/jeweler/commands/release_to_rubyforge.rb +51 -0
- data/lib/jeweler/commands/setup_rubyforge.rb +38 -0
- data/lib/jeweler/commands/validate_gemspec.rb +30 -0
- data/lib/jeweler/commands/version/base.rb +41 -0
- data/lib/jeweler/commands/version/bump_major.rb +13 -0
- data/lib/jeweler/commands/version/bump_minor.rb +12 -0
- data/lib/jeweler/commands/version/bump_patch.rb +14 -0
- data/lib/jeweler/commands/version/write.rb +12 -0
- data/lib/jeweler/commands/write_gemspec.rb +39 -0
- data/lib/jeweler/errors.rb +20 -0
- data/lib/jeweler/gemspec_helper.rb +76 -0
- data/lib/jeweler/generator.rb +284 -0
- data/lib/jeweler/generator/application.rb +54 -0
- data/lib/jeweler/generator/bacon_mixin.rb +39 -0
- data/lib/jeweler/generator/micronaut_mixin.rb +38 -0
- data/lib/jeweler/generator/minitest_mixin.rb +39 -0
- data/lib/jeweler/generator/options.rb +77 -0
- data/lib/jeweler/generator/rspec_mixin.rb +39 -0
- data/lib/jeweler/generator/shoulda_mixin.rb +39 -0
- data/lib/jeweler/generator/testunit_mixin.rb +39 -0
- data/lib/jeweler/rubyforge_tasks.rb +46 -0
- data/lib/jeweler/specification.rb +67 -0
- data/lib/jeweler/tasks.rb +124 -0
- data/lib/jeweler/templates/.document +5 -0
- data/lib/jeweler/templates/.gitignore +5 -0
- data/lib/jeweler/templates/LICENSE +20 -0
- data/lib/jeweler/templates/README.rdoc +7 -0
- data/lib/jeweler/templates/Rakefile +102 -0
- data/lib/jeweler/templates/bacon/flunking.rb +7 -0
- data/lib/jeweler/templates/bacon/helper.rb +8 -0
- data/lib/jeweler/templates/features/default.feature +9 -0
- data/lib/jeweler/templates/features/support/env.rb +8 -0
- data/lib/jeweler/templates/micronaut/flunking.rb +7 -0
- data/lib/jeweler/templates/micronaut/helper.rb +17 -0
- data/lib/jeweler/templates/minitest/flunking.rb +7 -0
- data/lib/jeweler/templates/minitest/helper.rb +11 -0
- data/lib/jeweler/templates/rspec/flunking.rb +7 -0
- data/lib/jeweler/templates/rspec/helper.rb +9 -0
- data/lib/jeweler/templates/shoulda/flunking.rb +7 -0
- data/lib/jeweler/templates/shoulda/helper.rb +10 -0
- data/lib/jeweler/templates/testunit/flunking.rb +7 -0
- data/lib/jeweler/templates/testunit/helper.rb +9 -0
- data/lib/jeweler/version_helper.rb +128 -0
- data/test/fixtures/bar/VERSION.yml +4 -0
- data/test/fixtures/bar/bin/foo_the_ultimate_bin +1 -0
- data/test/fixtures/bar/hey_include_me_in_gemspec +0 -0
- data/test/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -0
- data/test/fixtures/existing-project-with-version-plaintext/.document +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/LICENSE +20 -0
- data/test/fixtures/existing-project-with-version-plaintext/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/Rakefile +82 -0
- data/test/fixtures/existing-project-with-version-plaintext/VERSION +1 -0
- data/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-plaintext/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/test/test_helper.rb +10 -0
- data/test/fixtures/existing-project-with-version-yaml/.document +5 -0
- data/test/fixtures/existing-project-with-version-yaml/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-yaml/LICENSE +20 -0
- data/test/fixtures/existing-project-with-version-yaml/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-yaml/Rakefile +82 -0
- data/test/fixtures/existing-project-with-version-yaml/VERSION.yml +4 -0
- data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-yaml/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-yaml/test/test_helper.rb +10 -0
- data/test/geminstaller.yml +12 -0
- data/test/jeweler/commands/test_build_gem.rb +72 -0
- data/test/jeweler/commands/test_install_gem.rb +21 -0
- data/test/jeweler/commands/test_release.rb +405 -0
- data/test/jeweler/commands/test_release_to_rubyforge.rb +157 -0
- data/test/jeweler/commands/test_setup_rubyforge.rb +88 -0
- data/test/jeweler/commands/test_validate_gemspec.rb +27 -0
- data/test/jeweler/commands/test_write_gemspec.rb +92 -0
- data/test/jeweler/commands/version/test_base.rb +32 -0
- data/test/jeweler/commands/version/test_bump_major.rb +22 -0
- data/test/jeweler/commands/version/test_bump_minor.rb +19 -0
- data/test/jeweler/commands/version/test_bump_patch.rb +20 -0
- data/test/jeweler/commands/version/test_write.rb +23 -0
- data/test/shoulda_macros/jeweler_macros.rb +35 -0
- data/test/test_application.rb +139 -0
- data/test/test_gemspec_helper.rb +40 -0
- data/test/test_generator.rb +154 -0
- data/test/test_generator_initialization.rb +113 -0
- data/test/test_generator_mixins.rb +18 -0
- data/test/test_helper.rb +133 -0
- data/test/test_jeweler.rb +174 -0
- data/test/test_options.rb +116 -0
- data/test/test_specification.rb +61 -0
- data/test/test_tasks.rb +51 -0
- data/test/test_version_helper.rb +153 -0
- metadata +228 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Jeweler
|
4
|
+
module Commands
|
5
|
+
class TestInstallGem < Test::Unit::TestCase
|
6
|
+
build_command_context "build for jeweler" do
|
7
|
+
setup do
|
8
|
+
@command = Jeweler::Commands::InstallGem.build_for(@jeweler)
|
9
|
+
end
|
10
|
+
|
11
|
+
should "assign gemspec helper" do
|
12
|
+
assert_equal @gemspec_helper, @command.gemspec_helper
|
13
|
+
end
|
14
|
+
|
15
|
+
should "assign output" do
|
16
|
+
assert_equal @output, @command.output
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,405 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Jeweler
|
4
|
+
module Commands
|
5
|
+
class TestRelease < Test::Unit::TestCase
|
6
|
+
|
7
|
+
context "with pending changes" do
|
8
|
+
setup do
|
9
|
+
@repo = Object.new
|
10
|
+
stub(@repo).checkout(anything)
|
11
|
+
stub(@repo).status { status }
|
12
|
+
|
13
|
+
@command = Jeweler::Commands::Release.new
|
14
|
+
@command.output = @output
|
15
|
+
@command.repo = @repo
|
16
|
+
@command.gemspec_helper = @gemspec_helper
|
17
|
+
@command.version = '1.2.3'
|
18
|
+
|
19
|
+
stub(@command).any_pending_changes? { true }
|
20
|
+
end
|
21
|
+
|
22
|
+
should 'raise error' do
|
23
|
+
assert_raises RuntimeError, /try commiting/i do
|
24
|
+
@command.run
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "run without pending changes, and gemspec changed, and tagged not created already" do
|
30
|
+
setup do
|
31
|
+
@repo = Object.new
|
32
|
+
stub(@repo) do
|
33
|
+
checkout(anything)
|
34
|
+
add(anything)
|
35
|
+
commit(anything)
|
36
|
+
push
|
37
|
+
end
|
38
|
+
|
39
|
+
@gemspec_helper = Object.new
|
40
|
+
stub(@gemspec_helper) do
|
41
|
+
write
|
42
|
+
path {'zomg.gemspec'}
|
43
|
+
update_version('1.2.3')
|
44
|
+
end
|
45
|
+
|
46
|
+
@output = StringIO.new
|
47
|
+
|
48
|
+
@command = Jeweler::Commands::Release.new :output => @output,
|
49
|
+
:repo => @repo,
|
50
|
+
:gemspec_helper => @gemspec_helper,
|
51
|
+
:version => '1.2.3'
|
52
|
+
|
53
|
+
stub(@command).tag_release!
|
54
|
+
stub(@command).gemspec_changed? { true }
|
55
|
+
stub(@command).any_pending_changes? { false }
|
56
|
+
stub(@command).regenerate_gemspec!
|
57
|
+
stub(@command).commit_gemspec!
|
58
|
+
stub(@command).release_tagged? { false }
|
59
|
+
|
60
|
+
@command.run
|
61
|
+
end
|
62
|
+
|
63
|
+
should "checkout master" do
|
64
|
+
assert_received(@repo) {|repo| repo.checkout('master') }
|
65
|
+
end
|
66
|
+
|
67
|
+
should "regenerate gemspec" do
|
68
|
+
assert_received(@command) {|command| command.regenerate_gemspec! }
|
69
|
+
end
|
70
|
+
|
71
|
+
should "commit gemspec" do
|
72
|
+
assert_received(@command) {|command| command.commit_gemspec! }
|
73
|
+
end
|
74
|
+
|
75
|
+
should "tag release" do
|
76
|
+
assert_received(@command) {|command| command.tag_release! }
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context "run without pending changes, and gemspec didn't change, and tagged not created already" do
|
81
|
+
setup do
|
82
|
+
@repo = Object.new
|
83
|
+
stub(@repo) do
|
84
|
+
checkout(anything)
|
85
|
+
add(anything)
|
86
|
+
commit(anything)
|
87
|
+
push
|
88
|
+
end
|
89
|
+
|
90
|
+
@gemspec_helper = Object.new
|
91
|
+
stub(@gemspec_helper) do
|
92
|
+
write
|
93
|
+
path {'zomg.gemspec'}
|
94
|
+
update_version('1.2.3')
|
95
|
+
end
|
96
|
+
|
97
|
+
@output = StringIO.new
|
98
|
+
|
99
|
+
@command = Jeweler::Commands::Release.new :output => @output,
|
100
|
+
:repo => @repo,
|
101
|
+
:gemspec_helper => @gemspec_helper,
|
102
|
+
:version => '1.2.3'
|
103
|
+
|
104
|
+
stub(@command).tag_release!
|
105
|
+
stub(@command).any_pending_changes? { false }
|
106
|
+
stub(@command).gemspec_changed? { false }
|
107
|
+
stub(@command).regenerate_gemspec!
|
108
|
+
stub(@command).release_tagged? { false }
|
109
|
+
|
110
|
+
@command.run
|
111
|
+
end
|
112
|
+
|
113
|
+
should "checkout master" do
|
114
|
+
assert_received(@repo) {|repo| repo.checkout('master') }
|
115
|
+
end
|
116
|
+
|
117
|
+
should "regenerate gemspec" do
|
118
|
+
assert_received(@command) {|command| command.regenerate_gemspec! }
|
119
|
+
end
|
120
|
+
|
121
|
+
should_eventually "not commit gemspec" do
|
122
|
+
# need a way to assert it wasn't received short of not stubbing it
|
123
|
+
#assert_received(@command) {|command| command.commit_gemspec! }
|
124
|
+
end
|
125
|
+
|
126
|
+
should "tag release" do
|
127
|
+
assert_received(@command) {|command| command.tag_release! }
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
context "run without pending changes and tagged already" do
|
132
|
+
setup do
|
133
|
+
@repo = Object.new
|
134
|
+
stub(@repo) do
|
135
|
+
checkout(anything)
|
136
|
+
add(anything)
|
137
|
+
commit(anything)
|
138
|
+
push
|
139
|
+
end
|
140
|
+
|
141
|
+
@gemspec_helper = Object.new
|
142
|
+
stub(@gemspec_helper) do
|
143
|
+
write
|
144
|
+
path {'zomg.gemspec'}
|
145
|
+
update_version('1.2.3')
|
146
|
+
end
|
147
|
+
|
148
|
+
@output = StringIO.new
|
149
|
+
|
150
|
+
@command = Jeweler::Commands::Release.new :output => @output,
|
151
|
+
:repo => @repo,
|
152
|
+
:gemspec_helper => @gemspec_helper,
|
153
|
+
:version => '1.2.3'
|
154
|
+
|
155
|
+
#stub(@command).tag_release!
|
156
|
+
stub(@command).any_pending_changes? { false }
|
157
|
+
stub(@command).regenerate_gemspec!
|
158
|
+
stub(@command).release_tagged? { true }
|
159
|
+
|
160
|
+
@command.run
|
161
|
+
end
|
162
|
+
|
163
|
+
should "checkout master" do
|
164
|
+
assert_received(@repo) {|repo| repo.checkout('master') }
|
165
|
+
end
|
166
|
+
|
167
|
+
should "regenerate gemspec" do
|
168
|
+
assert_received(@command) {|command| command.regenerate_gemspec! }
|
169
|
+
end
|
170
|
+
|
171
|
+
should_eventually "not tag release" do
|
172
|
+
# need to have a way to verify tag_release! not being called, short of not stubbing it
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
build_command_context "building from jeweler" do
|
177
|
+
setup do
|
178
|
+
@command = Jeweler::Commands::Release.build_for(@jeweler)
|
179
|
+
end
|
180
|
+
|
181
|
+
should "assign gemspec" do
|
182
|
+
assert_same @gemspec, @command.gemspec
|
183
|
+
end
|
184
|
+
|
185
|
+
should "assign version" do
|
186
|
+
assert_same @version, @command.version
|
187
|
+
end
|
188
|
+
|
189
|
+
should "assign repo" do
|
190
|
+
assert_same @repo, @command.repo
|
191
|
+
end
|
192
|
+
|
193
|
+
should "assign output" do
|
194
|
+
assert_same @output, @command.output
|
195
|
+
end
|
196
|
+
|
197
|
+
should "assign gemspec_helper" do
|
198
|
+
assert_same @gemspec_helper, @command.gemspec_helper
|
199
|
+
end
|
200
|
+
|
201
|
+
should "assign base_dir" do
|
202
|
+
assert_same @base_dir, @command.base_dir
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
context "any_pending_changes?" do
|
207
|
+
|
208
|
+
should "be true if there added files" do
|
209
|
+
repo = build_repo :added => %w(README)
|
210
|
+
|
211
|
+
command = Jeweler::Commands::Release.new :repo => repo
|
212
|
+
|
213
|
+
assert command.any_pending_changes?
|
214
|
+
end
|
215
|
+
|
216
|
+
should "be true if there are changed files" do
|
217
|
+
repo = build_repo :changed => %w(README)
|
218
|
+
|
219
|
+
command = Jeweler::Commands::Release.new
|
220
|
+
command.repo = repo
|
221
|
+
|
222
|
+
assert command.any_pending_changes?
|
223
|
+
end
|
224
|
+
|
225
|
+
should "be true if there are deleted files" do
|
226
|
+
repo = build_repo :deleted => %w(README)
|
227
|
+
|
228
|
+
command = Jeweler::Commands::Release.new
|
229
|
+
command.repo = repo
|
230
|
+
|
231
|
+
assert command.any_pending_changes?
|
232
|
+
end
|
233
|
+
|
234
|
+
should "be false if nothing added, changed, or deleted" do
|
235
|
+
repo = build_repo
|
236
|
+
|
237
|
+
command = Jeweler::Commands::Release.new
|
238
|
+
command.repo = repo
|
239
|
+
|
240
|
+
assert ! command.any_pending_changes?
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
context "tag_release!" do
|
245
|
+
setup do
|
246
|
+
@repo = Object.new
|
247
|
+
stub(@repo) do
|
248
|
+
add_tag(anything)
|
249
|
+
push(anything, anything)
|
250
|
+
end
|
251
|
+
|
252
|
+
@output = StringIO.new
|
253
|
+
|
254
|
+
@command = Jeweler::Commands::Release.new
|
255
|
+
@command.output = @output
|
256
|
+
@command.repo = @repo
|
257
|
+
@command.gemspec_helper = @gemspec_helper
|
258
|
+
@command.version = '1.2.3'
|
259
|
+
|
260
|
+
@command.tag_release!
|
261
|
+
end
|
262
|
+
|
263
|
+
should "tag release" do
|
264
|
+
assert_received(@repo) {|repo| repo.add_tag("v1.2.3")}
|
265
|
+
end
|
266
|
+
|
267
|
+
should "push tag to repository" do
|
268
|
+
assert_received(@repo) {|repo| repo.push('origin', 'v1.2.3')}
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
context "regenerate_gemspec!" do
|
273
|
+
setup do
|
274
|
+
@repo = Object.new
|
275
|
+
stub(@repo) do
|
276
|
+
add(anything)
|
277
|
+
commit(anything)
|
278
|
+
end
|
279
|
+
|
280
|
+
@gemspec_helper = Object.new
|
281
|
+
stub(@gemspec_helper) do
|
282
|
+
write
|
283
|
+
path {'zomg.gemspec'}
|
284
|
+
update_version('1.2.3')
|
285
|
+
end
|
286
|
+
|
287
|
+
@output = StringIO.new
|
288
|
+
|
289
|
+
@command = Jeweler::Commands::Release.new :output => @output,
|
290
|
+
:repo => @repo,
|
291
|
+
:gemspec_helper => @gemspec_helper,
|
292
|
+
:version => '1.2.3'
|
293
|
+
|
294
|
+
@command.regenerate_gemspec!
|
295
|
+
end
|
296
|
+
|
297
|
+
should "refresh gemspec version" do
|
298
|
+
assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.update_version('1.2.3') }
|
299
|
+
end
|
300
|
+
|
301
|
+
should "write gemspec" do
|
302
|
+
assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.write }
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
context "commit_gemspec!" do
|
307
|
+
setup do
|
308
|
+
@repo = Object.new
|
309
|
+
stub(@repo) do
|
310
|
+
add(anything)
|
311
|
+
commit(anything)
|
312
|
+
end
|
313
|
+
|
314
|
+
@gemspec_helper = Object.new
|
315
|
+
stub(@gemspec_helper) do
|
316
|
+
path {'zomg.gemspec'}
|
317
|
+
update_version('1.2.3')
|
318
|
+
end
|
319
|
+
|
320
|
+
@output = StringIO.new
|
321
|
+
|
322
|
+
@command = Jeweler::Commands::Release.new :output => @output,
|
323
|
+
:repo => @repo,
|
324
|
+
:gemspec_helper => @gemspec_helper,
|
325
|
+
:version => '1.2.3'
|
326
|
+
|
327
|
+
@command.commit_gemspec!
|
328
|
+
end
|
329
|
+
|
330
|
+
should "add gemspec to repository" do
|
331
|
+
assert_received(@repo) {|repo| repo.add('zomg.gemspec') }
|
332
|
+
end
|
333
|
+
|
334
|
+
should "commit with commit message including version" do
|
335
|
+
assert_received(@repo) {|repo| repo.commit("Regenerated gemspec for version 1.2.3") }
|
336
|
+
end
|
337
|
+
|
338
|
+
end
|
339
|
+
|
340
|
+
context "release_tagged? when no tag exists" do
|
341
|
+
setup do
|
342
|
+
@repo = Object.new
|
343
|
+
stub(@repo).tag('v1.2.3') {raise Git::GitTagNameDoesNotExist, tag}
|
344
|
+
#stub(@repo) do
|
345
|
+
#tag('v1.2.3') do |tag|
|
346
|
+
#raise Git::GitTagNameDoesNotExist, tag
|
347
|
+
#end
|
348
|
+
#end
|
349
|
+
|
350
|
+
@output = StringIO.new
|
351
|
+
|
352
|
+
@command = Jeweler::Commands::Release.new
|
353
|
+
@command.output = @output
|
354
|
+
@command.repo = @repo
|
355
|
+
@command.version = '1.2.3'
|
356
|
+
end
|
357
|
+
|
358
|
+
should_eventually "be false" do
|
359
|
+
assert ! @command.release_tagged?
|
360
|
+
end
|
361
|
+
|
362
|
+
end
|
363
|
+
|
364
|
+
context "release_tagged? when tag exists" do
|
365
|
+
setup do
|
366
|
+
@repo = Object.new
|
367
|
+
stub(@repo) do
|
368
|
+
tag('v1.2.3') { Object.new }
|
369
|
+
end
|
370
|
+
|
371
|
+
@output = StringIO.new
|
372
|
+
|
373
|
+
@command = Jeweler::Commands::Release.new
|
374
|
+
@command.output = @output
|
375
|
+
@command.repo = @repo
|
376
|
+
@command.version = '1.2.3'
|
377
|
+
end
|
378
|
+
|
379
|
+
should_eventually "be true" do
|
380
|
+
assert @command.release_tagged?
|
381
|
+
end
|
382
|
+
|
383
|
+
end
|
384
|
+
|
385
|
+
def build_repo(options = {})
|
386
|
+
status = build_status options
|
387
|
+
repo = Object.new
|
388
|
+
stub(repo).status { status }
|
389
|
+
repo
|
390
|
+
end
|
391
|
+
|
392
|
+
def build_status(options = {})
|
393
|
+
options = {:added => [], :deleted => [], :changed => []}.merge(options)
|
394
|
+
|
395
|
+
status = Object.new
|
396
|
+
stub(status) do
|
397
|
+
added { options[:added] }
|
398
|
+
deleted { options[:deleted] }
|
399
|
+
changed { options[:changed] }
|
400
|
+
end
|
401
|
+
|
402
|
+
end
|
403
|
+
end
|
404
|
+
end
|
405
|
+
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Jeweler
|
4
|
+
module Commands
|
5
|
+
class TestReleaseToRubyforge < Test::Unit::TestCase
|
6
|
+
def self.subject
|
7
|
+
Jeweler::Commands::ReleaseToRubyforge.new
|
8
|
+
end
|
9
|
+
|
10
|
+
rubyforge_command_context "rubyforge_project is defined in gemspec and package exists on rubyforge" do
|
11
|
+
setup do
|
12
|
+
stub(@rubyforge).configure
|
13
|
+
stub(@rubyforge).login
|
14
|
+
stub(@rubyforge).add_release("MyRubyForgeProjectName", "zomg", "1.2.3", "pkg/zomg-1.2.3.gem")
|
15
|
+
|
16
|
+
stub(@gemspec).description {"The zomg gem rocks."}
|
17
|
+
stub(@gemspec).rubyforge_project {"MyRubyForgeProjectName"}
|
18
|
+
stub(@gemspec).name {"zomg"}
|
19
|
+
|
20
|
+
stub(@gemspec_helper).write
|
21
|
+
stub(@gemspec_helper).gem_path {'pkg/zomg-1.2.3.gem'}
|
22
|
+
stub(@gemspec_helper).update_version('1.2.3')
|
23
|
+
|
24
|
+
@command.version = '1.2.3'
|
25
|
+
|
26
|
+
@command.run
|
27
|
+
end
|
28
|
+
|
29
|
+
should "configure" do
|
30
|
+
assert_received(@rubyforge) {|rubyforge| rubyforge.configure }
|
31
|
+
end
|
32
|
+
|
33
|
+
should "login" do
|
34
|
+
assert_received(@rubyforge) {|rubyforge| rubyforge.login }
|
35
|
+
end
|
36
|
+
|
37
|
+
should "set release notes" do
|
38
|
+
assert_equal "The zomg gem rocks.", @rubyforge.userconfig["release_notes"]
|
39
|
+
end
|
40
|
+
|
41
|
+
should "set preformatted to true" do
|
42
|
+
assert_equal true, @rubyforge.userconfig['preformatted']
|
43
|
+
end
|
44
|
+
|
45
|
+
should "add release" do
|
46
|
+
assert_received(@rubyforge) {|rubyforge| rubyforge.add_release("MyRubyForgeProjectName", "zomg", "1.2.3", "pkg/zomg-1.2.3.gem") }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
rubyforge_command_context "rubyforge_project is defined in gemspec and package does not exist on rubyforge" do
|
51
|
+
setup do
|
52
|
+
stub(@rubyforge).configure
|
53
|
+
stub(@rubyforge).login
|
54
|
+
stub(@rubyforge).scrape_config
|
55
|
+
stub(@rubyforge).add_release("MyRubyForgeProjectName", "zomg", "1.2.3", "pkg/zomg-1.2.3.gem") {
|
56
|
+
raise "no <package_id> configured for <zomg>"
|
57
|
+
}
|
58
|
+
|
59
|
+
stub(@gemspec).description {"The zomg gem rocks."}
|
60
|
+
stub(@gemspec).rubyforge_project {"MyRubyForgeProjectName"}
|
61
|
+
stub(@gemspec).name {"zomg"}
|
62
|
+
|
63
|
+
stub(@gemspec_helper).write
|
64
|
+
stub(@gemspec_helper).gem_path {'pkg/zomg-1.2.3.gem'}
|
65
|
+
stub(@gemspec_helper).update_version('1.2.3')
|
66
|
+
|
67
|
+
@command.version = '1.2.3'
|
68
|
+
end
|
69
|
+
|
70
|
+
should "raise MissingRubyForgePackageError" do
|
71
|
+
assert_raises Jeweler::MissingRubyForgePackageError do
|
72
|
+
@command.run
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
rubyforge_command_context "rubyforge_project is not defined in gemspec" do
|
78
|
+
setup do
|
79
|
+
stub(@rubyforge).configure
|
80
|
+
stub(@rubyforge).login
|
81
|
+
stub(@rubyforge).add_release(nil, "zomg", "1.2.3", "pkg/zomg-1.2.3.gem")
|
82
|
+
|
83
|
+
stub(@gemspec).description {"The zomg gem rocks."}
|
84
|
+
stub(@gemspec).rubyforge_project { nil }
|
85
|
+
stub(@gemspec).name {"zomg"}
|
86
|
+
|
87
|
+
stub(@gemspec_helper).write
|
88
|
+
stub(@gemspec_helper).gem_path {'pkg/zomg-1.2.3.gem'}
|
89
|
+
stub(@gemspec_helper).update_version('1.2.3')
|
90
|
+
|
91
|
+
@command.version = '1.2.3'
|
92
|
+
end
|
93
|
+
|
94
|
+
should "raise NoRubyForgeProjectConfigured" do
|
95
|
+
assert_raises Jeweler::NoRubyForgeProjectInGemspecError do
|
96
|
+
@command.run
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
rubyforge_command_context "after running when rubyforge_project is not defined in ~/.rubyforge/auto_config.yml" do
|
102
|
+
setup do
|
103
|
+
stub(@rubyforge).configure
|
104
|
+
stub(@rubyforge).login
|
105
|
+
stub(@rubyforge).add_release("some_project_that_doesnt_exist", "zomg", "1.2.3", "pkg/zomg-1.2.3.gem") do
|
106
|
+
raise RuntimeError, "no <group_id> configured for <some_project_that_doesnt_exist>"
|
107
|
+
end
|
108
|
+
|
109
|
+
@rubyforge.autoconfig['package_ids'] = { 'zomg' => 1234 }
|
110
|
+
|
111
|
+
stub(@gemspec).description {"The zomg gem rocks."}
|
112
|
+
stub(@gemspec).rubyforge_project { "some_project_that_doesnt_exist" }
|
113
|
+
stub(@gemspec).name {"zomg"}
|
114
|
+
|
115
|
+
stub(@gemspec_helper).write
|
116
|
+
stub(@gemspec_helper).gem_path {'pkg/zomg-1.2.3.gem'}
|
117
|
+
stub(@gemspec_helper).update_version('1.2.3')
|
118
|
+
|
119
|
+
@command.version = '1.2.3'
|
120
|
+
end
|
121
|
+
|
122
|
+
should "raise RubyForgeProjectNotConfiguredError" do
|
123
|
+
assert_raises RubyForgeProjectNotConfiguredError do
|
124
|
+
@command.run
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
build_command_context "build for jeweler" do
|
130
|
+
setup do
|
131
|
+
@command = Jeweler::Commands::ReleaseToRubyforge.build_for(@jeweler)
|
132
|
+
end
|
133
|
+
|
134
|
+
should "assign gemspec helper" do
|
135
|
+
assert_equal @gemspec_helper, @command.gemspec_helper
|
136
|
+
end
|
137
|
+
|
138
|
+
should "assign gemspec" do
|
139
|
+
assert_equal @gemspec, @command.gemspec
|
140
|
+
end
|
141
|
+
|
142
|
+
should "assign version" do
|
143
|
+
assert_equal @version, @command.version
|
144
|
+
end
|
145
|
+
|
146
|
+
should "assign output" do
|
147
|
+
assert_equal @output, @command.output
|
148
|
+
end
|
149
|
+
|
150
|
+
should "assign rubyforge" do
|
151
|
+
assert_equal @rubyforge, @command.rubyforge
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|