jeweler2 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +8 -0
- data/ChangeLog.markdown +177 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +47 -0
- data/LICENSE.txt +20 -0
- data/README.markdown +217 -0
- data/Rakefile +80 -0
- data/bin/jeweler +5 -0
- data/features/generator/cucumber.feature +103 -0
- data/features/generator/directory_layout.feature +86 -0
- data/features/generator/dotdocument.feature +13 -0
- data/features/generator/env_options.feature +9 -0
- data/features/generator/gemfile.feature +71 -0
- data/features/generator/git.feature +102 -0
- data/features/generator/license.feature +20 -0
- data/features/generator/rakefile.feature +158 -0
- data/features/generator/readme.feature +12 -0
- data/features/generator/test.feature +54 -0
- data/features/generator/test_helper.feature +149 -0
- data/features/placeholder.feature +5 -0
- data/features/step_definitions/debug_steps.rb +6 -0
- data/features/step_definitions/filesystem_steps.rb +70 -0
- data/features/step_definitions/generator_steps.rb +380 -0
- data/features/step_definitions/task_steps.rb +6 -0
- data/features/support/env.rb +42 -0
- data/features/tasks/build_gem.feature +9 -0
- data/features/tasks/version.feature +31 -0
- data/features/tasks/version_bumping.feature +49 -0
- data/jeweler.gemspec +245 -0
- data/jeweler2.gemspec +233 -0
- data/lib/jeweler/commands/build_gem.rb +36 -0
- data/lib/jeweler/commands/check_dependencies.rb +66 -0
- data/lib/jeweler/commands/install_gem.rb +31 -0
- data/lib/jeweler/commands/release_gemspec.rb +82 -0
- data/lib/jeweler/commands/release_to_git.rb +59 -0
- data/lib/jeweler/commands/release_to_rubygems.rb +28 -0
- data/lib/jeweler/commands/validate_gemspec.rb +30 -0
- data/lib/jeweler/commands/version/base.rb +55 -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/commands.rb +20 -0
- data/lib/jeweler/errors.rb +8 -0
- data/lib/jeweler/gemcutter_tasks.rb +8 -0
- data/lib/jeweler/gemspec_helper.rb +87 -0
- data/lib/jeweler/generator/application.rb +61 -0
- data/lib/jeweler/generator/bacon_mixin.rb +43 -0
- data/lib/jeweler/generator/github_mixin.rb +29 -0
- data/lib/jeweler/generator/micronaut_mixin.rb +41 -0
- data/lib/jeweler/generator/minitest_mixin.rb +42 -0
- data/lib/jeweler/generator/options.rb +163 -0
- data/lib/jeweler/generator/rdoc_mixin.rb +9 -0
- data/lib/jeweler/generator/riot_mixin.rb +42 -0
- data/lib/jeweler/generator/rspec_mixin.rb +42 -0
- data/lib/jeweler/generator/shindo_mixin.rb +44 -0
- data/lib/jeweler/generator/shoulda_mixin.rb +42 -0
- data/lib/jeweler/generator/testspec_mixin.rb +42 -0
- data/lib/jeweler/generator/testunit_mixin.rb +39 -0
- data/lib/jeweler/generator/yard_mixin.rb +14 -0
- data/lib/jeweler/generator.rb +295 -0
- data/lib/jeweler/rubyforge_tasks.rb +95 -0
- data/lib/jeweler/rubygems_dot_org_tasks.rb +38 -0
- data/lib/jeweler/rubygems_tasks.rb +38 -0
- data/lib/jeweler/specification.rb +110 -0
- data/lib/jeweler/tasks.rb +224 -0
- data/lib/jeweler/templates/.document +5 -0
- data/lib/jeweler/templates/.gitignore +48 -0
- data/lib/jeweler/templates/Gemfile +12 -0
- data/lib/jeweler/templates/LICENSE.txt +20 -0
- data/lib/jeweler/templates/README.rdoc +19 -0
- data/lib/jeweler/templates/Rakefile +9 -0
- data/lib/jeweler/templates/bacon/flunking.rb +7 -0
- data/lib/jeweler/templates/bacon/helper.rb +9 -0
- data/lib/jeweler/templates/bundler_setup.erb +10 -0
- data/lib/jeweler/templates/features/default.feature +9 -0
- data/lib/jeweler/templates/features/support/env.rb +10 -0
- data/lib/jeweler/templates/jeweler_tasks.erb +31 -0
- data/lib/jeweler/templates/micronaut/flunking.rb +7 -0
- data/lib/jeweler/templates/micronaut/helper.rb +18 -0
- data/lib/jeweler/templates/minitest/flunking.rb +7 -0
- data/lib/jeweler/templates/minitest/helper.rb +12 -0
- data/lib/jeweler/templates/other_tasks.erb +86 -0
- data/lib/jeweler/templates/riot/flunking.rb +11 -0
- data/lib/jeweler/templates/riot/helper.rb +4 -0
- data/lib/jeweler/templates/rspec/.rspec +1 -0
- data/lib/jeweler/templates/rspec/flunking.rb +7 -0
- data/lib/jeweler/templates/rspec/helper.rb +12 -0
- data/lib/jeweler/templates/shindo/flunking.rb +8 -0
- data/lib/jeweler/templates/shindo/helper.rb +6 -0
- data/lib/jeweler/templates/shoulda/flunking.rb +7 -0
- data/lib/jeweler/templates/shoulda/helper.rb +11 -0
- data/lib/jeweler/templates/testspec/flunking.rb +7 -0
- data/lib/jeweler/templates/testspec/helper.rb +7 -0
- data/lib/jeweler/templates/testunit/flunking.rb +7 -0
- data/lib/jeweler/templates/testunit/helper.rb +10 -0
- data/lib/jeweler/version.rb +10 -0
- data/lib/jeweler/version_helper.rb +141 -0
- data/lib/jeweler.rb +177 -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-constant/.document +5 -0
- data/test/fixtures/existing-project-with-version-constant/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-constant/LICENSE.txt +20 -0
- data/test/fixtures/existing-project-with-version-constant/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-constant/Rakefile +85 -0
- data/test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-constant/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-constant/test/test_helper.rb +10 -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.txt +20 -0
- data/test/fixtures/existing-project-with-version-plaintext/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/Rakefile +84 -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.txt +20 -0
- data/test/fixtures/existing-project-with-version-yaml/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-yaml/Rakefile +84 -0
- data/test/fixtures/existing-project-with-version-yaml/VERSION.yml +4 -0
- data/test/fixtures/existing-project-with-version-yaml/bin/foo_the_ultimate_bin +0 -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 +103 -0
- data/test/jeweler/commands/test_install_gem.rb +35 -0
- data/test/jeweler/commands/test_release_to_gemcutter.rb +39 -0
- data/test/jeweler/commands/test_release_to_git.rb +198 -0
- data/test/jeweler/commands/test_release_to_github.rb +390 -0
- data/test/jeweler/commands/test_validate_gemspec.rb +27 -0
- data/test/jeweler/commands/test_write_gemspec.rb +101 -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 +22 -0
- data/test/jeweler/generator/test_application.rb +120 -0
- data/test/jeweler/generator/test_options.rb +225 -0
- data/test/jeweler/test_gemspec_helper.rb +44 -0
- data/test/jeweler/test_generator.rb +141 -0
- data/test/jeweler/test_generator_initialization.rb +164 -0
- data/test/jeweler/test_generator_mixins.rb +23 -0
- data/test/jeweler/test_specification.rb +237 -0
- data/test/jeweler/test_tasks.rb +50 -0
- data/test/jeweler/test_version_helper.rb +214 -0
- data/test/shoulda_macros/jeweler_macros.rb +35 -0
- data/test/test_helper.rb +178 -0
- data/test/test_jeweler.rb +175 -0
- metadata +343 -0
@@ -0,0 +1,390 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
class Jeweler
|
5
|
+
module Commands
|
6
|
+
class TestReleaseGemspec < Test::Unit::TestCase
|
7
|
+
|
8
|
+
rubyforge_command_context "running" do
|
9
|
+
context "happily" do
|
10
|
+
setup do
|
11
|
+
stub(@command).clean_staging_area? { true }
|
12
|
+
|
13
|
+
stub(@command).regenerate_gemspec!
|
14
|
+
|
15
|
+
stub(@command).gemspec_changed? { true }
|
16
|
+
stub(@command).commit_gemspec! { true }
|
17
|
+
|
18
|
+
stub(@repo).push
|
19
|
+
|
20
|
+
stub(@command).release_not_tagged? { true }
|
21
|
+
|
22
|
+
@command.run
|
23
|
+
end
|
24
|
+
|
25
|
+
should "regenerate gemspec" do
|
26
|
+
assert_received(@command) {|command| command.regenerate_gemspec! }
|
27
|
+
end
|
28
|
+
|
29
|
+
should "commit gemspec" do
|
30
|
+
assert_received(@command) {|command| command.commit_gemspec! }
|
31
|
+
end
|
32
|
+
|
33
|
+
should "push" do
|
34
|
+
assert_received(@repo) {|repo| repo.push }
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
context "with an unclean staging area" do
|
40
|
+
setup do
|
41
|
+
stub(@command).clean_staging_area? { false }
|
42
|
+
stub(@command).system
|
43
|
+
end
|
44
|
+
|
45
|
+
should 'raise error' do
|
46
|
+
assert_raises RuntimeError, /try commiting/i do
|
47
|
+
@command.run
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
should 'display git status' do
|
52
|
+
@command.run rescue nil
|
53
|
+
assert_received(@command) {|command| command.system("git status") }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "with an unchanged gemspec" do
|
58
|
+
setup do
|
59
|
+
stub(@command).clean_staging_area? { true }
|
60
|
+
|
61
|
+
stub(@command).regenerate_gemspec!
|
62
|
+
|
63
|
+
stub(@command).gemspec_changed? { false }
|
64
|
+
dont_allow(@command).commit_gemspec! { true }
|
65
|
+
|
66
|
+
stub(@repo).push
|
67
|
+
|
68
|
+
stub(@command).release_not_tagged? { true }
|
69
|
+
|
70
|
+
@command.run
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
should "regenerate gemspec" do
|
75
|
+
assert_received(@command) {|command| command.regenerate_gemspec! }
|
76
|
+
end
|
77
|
+
|
78
|
+
should "push" do
|
79
|
+
assert_received(@repo) {|repo| repo.push }
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
context "with a release already tagged" do
|
85
|
+
setup do
|
86
|
+
stub(@command).clean_staging_area? { true }
|
87
|
+
|
88
|
+
stub(@command).regenerate_gemspec!
|
89
|
+
|
90
|
+
stub(@command).gemspec_changed? { true }
|
91
|
+
stub(@command).commit_gemspec! { true }
|
92
|
+
|
93
|
+
stub(@repo).push
|
94
|
+
|
95
|
+
stub(@command).release_not_tagged? { false }
|
96
|
+
|
97
|
+
@command.run
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
should "regenerate gemspec" do
|
102
|
+
assert_received(@command) {|command| command.regenerate_gemspec! }
|
103
|
+
end
|
104
|
+
|
105
|
+
should "commit gemspec" do
|
106
|
+
assert_received(@command) {|command| command.commit_gemspec! }
|
107
|
+
end
|
108
|
+
|
109
|
+
should "push" do
|
110
|
+
assert_received(@repo) {|repo| repo.push }
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
build_command_context "building from jeweler" do
|
119
|
+
setup do
|
120
|
+
@command = Jeweler::Commands::ReleaseGemspec.build_for(@jeweler)
|
121
|
+
end
|
122
|
+
|
123
|
+
should "assign gemspec" do
|
124
|
+
assert_same @gemspec, @command.gemspec
|
125
|
+
end
|
126
|
+
|
127
|
+
should "assign version" do
|
128
|
+
assert_same @version, @command.version
|
129
|
+
end
|
130
|
+
|
131
|
+
should "assign repo" do
|
132
|
+
assert_same @repo, @command.repo
|
133
|
+
end
|
134
|
+
|
135
|
+
should "assign output" do
|
136
|
+
assert_same @output, @command.output
|
137
|
+
end
|
138
|
+
|
139
|
+
should "assign gemspec_helper" do
|
140
|
+
assert_same @gemspec_helper, @command.gemspec_helper
|
141
|
+
end
|
142
|
+
|
143
|
+
should "assign base_dir" do
|
144
|
+
assert_same @base_dir, @command.base_dir
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# FIXME this code had its ruby-git stuff replaced with `` and system, which is much harder to test, so re-enable these someday
|
149
|
+
#context "clean_staging_area?" do
|
150
|
+
|
151
|
+
# should "be false if there added files" do
|
152
|
+
# repo = build_repo :added => %w(README)
|
153
|
+
|
154
|
+
# command = Jeweler::Commands::ReleaseGemspec.new :repo => repo
|
155
|
+
|
156
|
+
# assert ! command.clean_staging_area?
|
157
|
+
# end
|
158
|
+
|
159
|
+
# should "be false if there are changed files" do
|
160
|
+
# repo = build_repo :changed => %w(README)
|
161
|
+
|
162
|
+
# command = Jeweler::Commands::ReleaseGemspec.new
|
163
|
+
# command.repo = repo
|
164
|
+
|
165
|
+
# assert ! command.clean_staging_area?
|
166
|
+
# end
|
167
|
+
|
168
|
+
# should "be false if there are deleted files" do
|
169
|
+
# repo = build_repo :deleted => %w(README)
|
170
|
+
|
171
|
+
# command = Jeweler::Commands::ReleaseGemspec.new
|
172
|
+
# command.repo = repo
|
173
|
+
|
174
|
+
# assert ! command.clean_staging_area?
|
175
|
+
# end
|
176
|
+
|
177
|
+
# should "be true if nothing added, changed, or deleted" do
|
178
|
+
# repo = build_repo
|
179
|
+
|
180
|
+
# command = Jeweler::Commands::ReleaseGemspec.new
|
181
|
+
# command.repo = repo
|
182
|
+
|
183
|
+
# assert command.clean_staging_area?
|
184
|
+
# end
|
185
|
+
#end
|
186
|
+
|
187
|
+
context "regenerate_gemspec!" do
|
188
|
+
setup do
|
189
|
+
@repo = Object.new
|
190
|
+
stub(@repo) do
|
191
|
+
add(anything)
|
192
|
+
commit(anything)
|
193
|
+
end
|
194
|
+
|
195
|
+
@gemspec_helper = Object.new
|
196
|
+
stub(@gemspec_helper) do
|
197
|
+
write
|
198
|
+
path {'zomg.gemspec'}
|
199
|
+
update_version('1.2.3')
|
200
|
+
end
|
201
|
+
|
202
|
+
@output = StringIO.new
|
203
|
+
|
204
|
+
@command = Jeweler::Commands::ReleaseGemspec.new :output => @output,
|
205
|
+
:repo => @repo,
|
206
|
+
:gemspec_helper => @gemspec_helper,
|
207
|
+
:version => '1.2.3'
|
208
|
+
|
209
|
+
@command.regenerate_gemspec!
|
210
|
+
end
|
211
|
+
|
212
|
+
should "refresh gemspec version" do
|
213
|
+
assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.update_version('1.2.3') }
|
214
|
+
end
|
215
|
+
|
216
|
+
should "write gemspec" do
|
217
|
+
assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.write }
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
context "commit_gemspec!" do
|
222
|
+
setup do
|
223
|
+
@repo = Object.new
|
224
|
+
stub(@repo) do
|
225
|
+
add(anything)
|
226
|
+
commit(anything)
|
227
|
+
end
|
228
|
+
|
229
|
+
@gemspec_helper = Object.new
|
230
|
+
stub(@gemspec_helper) do
|
231
|
+
path {'zomg.gemspec'}
|
232
|
+
update_version('1.2.3')
|
233
|
+
end
|
234
|
+
|
235
|
+
@output = StringIO.new
|
236
|
+
|
237
|
+
@command = Jeweler::Commands::ReleaseGemspec.new :output => @output,
|
238
|
+
:repo => @repo,
|
239
|
+
:gemspec_helper => @gemspec_helper,
|
240
|
+
:version => '1.2.3'
|
241
|
+
|
242
|
+
stub(@command).working_subdir { Pathname.new(".") }
|
243
|
+
@command.commit_gemspec!
|
244
|
+
end
|
245
|
+
|
246
|
+
should "add gemspec to repository" do
|
247
|
+
assert_received(@repo) {|repo| repo.add('zomg.gemspec') }
|
248
|
+
end
|
249
|
+
|
250
|
+
should "commit with commit message including version" do
|
251
|
+
assert_received(@repo) {|repo| repo.commit("Regenerate gemspec for version 1.2.3") }
|
252
|
+
end
|
253
|
+
|
254
|
+
end
|
255
|
+
|
256
|
+
context "commit_gemspec! in top dir" do
|
257
|
+
setup do
|
258
|
+
@repo = Object.new
|
259
|
+
|
260
|
+
stub(@repo) do
|
261
|
+
add(anything)
|
262
|
+
commit(anything)
|
263
|
+
end
|
264
|
+
|
265
|
+
@gemspec_helper = Object.new
|
266
|
+
stub(@gemspec_helper) do
|
267
|
+
path {'zomg.gemspec'}
|
268
|
+
update_version('1.2.3')
|
269
|
+
end
|
270
|
+
|
271
|
+
@output = StringIO.new
|
272
|
+
|
273
|
+
@command = Jeweler::Commands::ReleaseGemspec.new :output => @output,
|
274
|
+
:repo => @repo,
|
275
|
+
:gemspec_helper => @gemspec_helper,
|
276
|
+
:version => '1.2.3',
|
277
|
+
:base_dir => '.'
|
278
|
+
|
279
|
+
@dir = Object.new
|
280
|
+
stub(@repo).dir { @dir }
|
281
|
+
stub(@dir).path { "/x/y/z" }
|
282
|
+
|
283
|
+
stub(@command).base_dir_path { Pathname.new("/x/y/z") }
|
284
|
+
|
285
|
+
@command.commit_gemspec!
|
286
|
+
end
|
287
|
+
|
288
|
+
should "add gemspec to repository" do
|
289
|
+
assert_received(@repo) {|repo| repo.add('zomg.gemspec') }
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
context "commit_gemspec! in sub dir" do
|
294
|
+
setup do
|
295
|
+
@repo = Object.new
|
296
|
+
|
297
|
+
stub(@repo) do
|
298
|
+
add(anything)
|
299
|
+
commit(anything)
|
300
|
+
end
|
301
|
+
|
302
|
+
@gemspec_helper = Object.new
|
303
|
+
stub(@gemspec_helper) do
|
304
|
+
path {'zomg.gemspec'}
|
305
|
+
update_version('1.2.3')
|
306
|
+
end
|
307
|
+
|
308
|
+
@output = StringIO.new
|
309
|
+
|
310
|
+
@command = Jeweler::Commands::ReleaseGemspec.new :output => @output,
|
311
|
+
:repo => @repo,
|
312
|
+
:gemspec_helper => @gemspec_helper,
|
313
|
+
:version => '1.2.3',
|
314
|
+
:base_dir => '.'
|
315
|
+
|
316
|
+
@dir = Object.new
|
317
|
+
stub(@repo).dir { @dir }
|
318
|
+
stub(@dir).path { "/x/y/z" }
|
319
|
+
|
320
|
+
stub(@command).base_dir_path { Pathname.new("/x/y/z/gem") }
|
321
|
+
|
322
|
+
@command.commit_gemspec!
|
323
|
+
end
|
324
|
+
|
325
|
+
should "add gemspec to repository" do
|
326
|
+
assert_received(@repo) {|repo| repo.add('gem/zomg.gemspec') }
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
context "release_tagged? when no tag exists" do
|
331
|
+
setup do
|
332
|
+
@repo = Object.new
|
333
|
+
stub(@repo).tag('v1.2.3') { raise Git::GitTagNameDoesNotExist, tag }
|
334
|
+
|
335
|
+
@output = StringIO.new
|
336
|
+
|
337
|
+
@command = Jeweler::Commands::ReleaseGemspec.new
|
338
|
+
@command.output = @output
|
339
|
+
@command.repo = @repo
|
340
|
+
@command.version = '1.2.3'
|
341
|
+
end
|
342
|
+
|
343
|
+
should_eventually "be true" do
|
344
|
+
assert @command.release_not_tagged?
|
345
|
+
end
|
346
|
+
|
347
|
+
end
|
348
|
+
|
349
|
+
context "release_tagged? when tag exists" do
|
350
|
+
setup do
|
351
|
+
@repo = Object.new
|
352
|
+
stub(@repo) do
|
353
|
+
tag('v1.2.3') { Object.new }
|
354
|
+
end
|
355
|
+
|
356
|
+
@output = StringIO.new
|
357
|
+
|
358
|
+
@command = Jeweler::Commands::ReleaseGemspec.new
|
359
|
+
@command.output = @output
|
360
|
+
@command.repo = @repo
|
361
|
+
@command.version = '1.2.3'
|
362
|
+
end
|
363
|
+
|
364
|
+
should_eventually "be false" do
|
365
|
+
assert @command.release_not_tagged?
|
366
|
+
end
|
367
|
+
|
368
|
+
end
|
369
|
+
|
370
|
+
def build_repo(options = {})
|
371
|
+
status = build_status options
|
372
|
+
repo = Object.new
|
373
|
+
stub(repo).status { status }
|
374
|
+
repo
|
375
|
+
end
|
376
|
+
|
377
|
+
def build_status(options = {})
|
378
|
+
options = {:added => [], :deleted => [], :changed => []}.merge(options)
|
379
|
+
|
380
|
+
status = Object.new
|
381
|
+
stub(status) do
|
382
|
+
added { options[:added] }
|
383
|
+
deleted { options[:deleted] }
|
384
|
+
changed { options[:changed] }
|
385
|
+
end
|
386
|
+
|
387
|
+
end
|
388
|
+
end
|
389
|
+
end
|
390
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Jeweler
|
4
|
+
module Commands
|
5
|
+
class TestValidateGemspec < Test::Unit::TestCase
|
6
|
+
|
7
|
+
build_command_context "build context" do
|
8
|
+
setup do
|
9
|
+
@command = Jeweler::Commands::ValidateGemspec.build_for(@jeweler)
|
10
|
+
end
|
11
|
+
|
12
|
+
should "assign gemspec_helper" do
|
13
|
+
assert_same @gemspec_helper, @command.gemspec_helper
|
14
|
+
end
|
15
|
+
|
16
|
+
should "assign output" do
|
17
|
+
assert_same @output, @command.output
|
18
|
+
end
|
19
|
+
|
20
|
+
should "return Jeweler::Commands::ValidateGemspec" do
|
21
|
+
assert_kind_of Jeweler::Commands::ValidateGemspec, @command
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Jeweler
|
4
|
+
module Commands
|
5
|
+
class TestWriteGemspec < Test::Unit::TestCase
|
6
|
+
|
7
|
+
context "after run" do
|
8
|
+
setup do
|
9
|
+
@gemspec = Gem::Specification.new {|s| s.name = 'zomg' }
|
10
|
+
@gemspec_helper = Object.new
|
11
|
+
stub(@gemspec_helper).spec { @gemspec }
|
12
|
+
stub(@gemspec_helper).path { 'zomg.gemspec' }
|
13
|
+
stub(@gemspec_helper).write
|
14
|
+
|
15
|
+
@output = StringIO.new
|
16
|
+
|
17
|
+
@version_helper = Object.new
|
18
|
+
stub(@version_helper).to_s { '1.2.3' }
|
19
|
+
stub(@version_helper).refresh
|
20
|
+
|
21
|
+
@command = Jeweler::Commands::WriteGemspec.new
|
22
|
+
@command.base_dir = 'tmp'
|
23
|
+
@command.version_helper = @version_helper
|
24
|
+
@command.gemspec = @gemspec
|
25
|
+
@command.output = @output
|
26
|
+
@command.gemspec_helper = @gemspec_helper
|
27
|
+
|
28
|
+
@now = Time.now
|
29
|
+
stub(Time.now.getutc).now { @now }
|
30
|
+
end
|
31
|
+
|
32
|
+
should "refresh version" do
|
33
|
+
@command.run
|
34
|
+
assert_received(@version_helper) {|version_helper| version_helper.refresh }
|
35
|
+
end
|
36
|
+
|
37
|
+
should "update gemspec version" do
|
38
|
+
@command.run
|
39
|
+
assert_equal '1.2.3', @gemspec.version.to_s
|
40
|
+
end
|
41
|
+
|
42
|
+
should "not refresh version neither update version if it's set on the gemspec" do
|
43
|
+
@gemspec.version = '2.3.4'
|
44
|
+
@command.run
|
45
|
+
assert_equal '2.3.4', @gemspec.version.to_s
|
46
|
+
end
|
47
|
+
|
48
|
+
should "update gemspec date to the beginning of today" do
|
49
|
+
@command.run
|
50
|
+
assert_equal Time.mktime(@now.year, @now.month, @now.day, 0, 0).getutc, @gemspec.date
|
51
|
+
end
|
52
|
+
|
53
|
+
should "write gemspec" do
|
54
|
+
@command.run
|
55
|
+
assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.write }
|
56
|
+
end
|
57
|
+
|
58
|
+
should_eventually "output that the gemspec was written" do
|
59
|
+
@command.run
|
60
|
+
assert_equal @output.string, "Generated: tmp/zomg.gemspec"
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
build_command_context "building for jeweler" do
|
66
|
+
setup do
|
67
|
+
@command = Jeweler::Commands::WriteGemspec.build_for(@jeweler)
|
68
|
+
end
|
69
|
+
|
70
|
+
should "assign base_dir" do
|
71
|
+
assert_same @base_dir, @command.base_dir
|
72
|
+
end
|
73
|
+
|
74
|
+
should "assign gemspec" do
|
75
|
+
assert_same @gemspec, @command.gemspec
|
76
|
+
end
|
77
|
+
|
78
|
+
should "assign version" do
|
79
|
+
assert_same @version, @command.version
|
80
|
+
end
|
81
|
+
|
82
|
+
should "assign output" do
|
83
|
+
assert_same @output, @command.output
|
84
|
+
end
|
85
|
+
|
86
|
+
should "assign gemspec_helper" do
|
87
|
+
assert_same @gemspec_helper, @command.gemspec_helper
|
88
|
+
end
|
89
|
+
|
90
|
+
should "assign version_helper" do
|
91
|
+
assert_same @version_helper, @command.version_helper
|
92
|
+
end
|
93
|
+
|
94
|
+
should "return WriteGemspec" do
|
95
|
+
assert_kind_of Jeweler::Commands::WriteGemspec, @command
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Jeweler
|
4
|
+
module Commands
|
5
|
+
module Version
|
6
|
+
class TestBase < Test::Unit::TestCase
|
7
|
+
build_command_context "build for jeweler" do
|
8
|
+
setup do
|
9
|
+
@command = Jeweler::Commands::Version::Base.build_for(@jeweler)
|
10
|
+
end
|
11
|
+
|
12
|
+
should "assign repo" do
|
13
|
+
assert_equal @repo, @command.repo
|
14
|
+
end
|
15
|
+
|
16
|
+
should "assign version_helper" do
|
17
|
+
assert_equal @version_helper, @command.version_helper
|
18
|
+
end
|
19
|
+
|
20
|
+
should "assign gemspec" do
|
21
|
+
assert_equal @gemspec, @command.gemspec
|
22
|
+
end
|
23
|
+
|
24
|
+
should"assign commit" do
|
25
|
+
assert_equal @commit, @command.commit
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Jeweler
|
4
|
+
module Commands
|
5
|
+
module Version
|
6
|
+
class TestBumpMajor < Test::Unit::TestCase
|
7
|
+
|
8
|
+
should "call bump_major on version_helper in update_version" do
|
9
|
+
mock(version_helper = Object.new).bump_major
|
10
|
+
|
11
|
+
command = Jeweler::Commands::Version::BumpMajor.new
|
12
|
+
command.version_helper = version_helper
|
13
|
+
|
14
|
+
command.update_version
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Jeweler
|
4
|
+
module Commands
|
5
|
+
module Version
|
6
|
+
class TestBumpMinor < Test::Unit::TestCase
|
7
|
+
|
8
|
+
should "call bump_minor on version_helper in update_version" do
|
9
|
+
mock(version_helper = Object.new).bump_minor
|
10
|
+
|
11
|
+
command = Jeweler::Commands::Version::BumpMinor.new
|
12
|
+
command.version_helper = version_helper
|
13
|
+
|
14
|
+
command.update_version
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Jeweler
|
4
|
+
module Commands
|
5
|
+
module Version
|
6
|
+
class TestBumpPatch < Test::Unit::TestCase
|
7
|
+
|
8
|
+
should "call bump_patch on version_helper in update_version" do
|
9
|
+
mock(version_helper = Object.new).bump_patch
|
10
|
+
|
11
|
+
command = Jeweler::Commands::Version::BumpPatch.new
|
12
|
+
command.version_helper = version_helper
|
13
|
+
|
14
|
+
command.update_version
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Jeweler
|
4
|
+
module Commands
|
5
|
+
module Version
|
6
|
+
class TestWrite < Test::Unit::TestCase
|
7
|
+
|
8
|
+
should "call write_version on version_helper in update_version" do
|
9
|
+
mock(version_helper = Object.new).update_to 1, 2, 3, nil
|
10
|
+
|
11
|
+
command = Jeweler::Commands::Version::Write.new
|
12
|
+
command.version_helper = version_helper
|
13
|
+
command.major = 1
|
14
|
+
command.minor = 2
|
15
|
+
command.patch = 3
|
16
|
+
command.update_version
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|