bump 0.5.2 → 0.5.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ef186ccfe40cf26219fa1c75d15efc1d8dafdfc
4
- data.tar.gz: 7da83bfd2c56ea4f0c4afced03ab7d09a8ce3bab
3
+ metadata.gz: 1175cf2868e448afaf993f17409112483889ed04
4
+ data.tar.gz: 29be419ef76fed2ca063e1eea18f6fbc922a019e
5
5
  SHA512:
6
- metadata.gz: e1e6e0b617ef415e82dacd1607b69a16af17e692e9a0127bc0b8ecaa35945730b2c0ee3dc7b5e7dbd83e8e7216ba06e142443632082e09fcfcde2fdfb15f8caa
7
- data.tar.gz: 021358ba88e682754d6907280dce1b69e1ff791cc93d62c3dc8fc1d5ce1e2b61c3715d42b55edb6ed117710aed96e7b81d943842e6100d116036af074e9f9c0f
6
+ metadata.gz: a31e2f7327abba449c4144807c2f20471a3d67566800fe77326507be5d4d22fc93b2885e67f87f3d9fa9530d8cad6fa0d4e9223d5761efde0894efe31335b2e0
7
+ data.tar.gz: ccca570ac125a618f0524664a975838c1e5e3673dfd2e4ccb110300367360f8880c47e8d07fdc0cf422d690f9e9042304716c97b9d53caa2b26b7daee533d303
@@ -42,9 +42,7 @@ module Bump
42
42
  rescue UnfoundVersionFileError
43
43
  ["Unable to find a file with the gem version", 1]
44
44
  rescue TooManyVersionFilesError
45
- ["More than one gemspec file", 1]
46
- rescue Exception => e
47
- ["Something wrong happened: #{e.message}\n#{e.backtrace.join("\n")}", 1]
45
+ ["More than one version file found (#{$!.message})", 1]
48
46
  end
49
47
 
50
48
  def self.current
@@ -120,8 +118,12 @@ module Bump
120
118
  end
121
119
 
122
120
  def self.version_from_version_rb
123
- return unless file = find_version_file("lib/**/version.rb")
124
- extract_version_from_file(file)
121
+ files = Dir.glob("lib/**/version.rb")
122
+ files.detect do |file|
123
+ if version_and_file = extract_version_from_file(file)
124
+ return version_and_file
125
+ end
126
+ end
125
127
  end
126
128
 
127
129
  def self.version_from_version
@@ -154,7 +156,7 @@ module Bump
154
156
  when 0 then nil
155
157
  when 1 then files.first
156
158
  else
157
- raise TooManyVersionFilesError
159
+ raise TooManyVersionFilesError, files.join(", ")
158
160
  end
159
161
  end
160
162
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bump
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Marcilhacy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-20 00:00:00.000000000 Z
11
+ date: 2015-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -45,19 +45,10 @@ executables:
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - ".gitignore"
49
- - ".travis.yml"
50
- - Gemfile
51
- - Gemfile.lock
52
48
  - README.md
53
- - Rakefile
54
49
  - bin/bump
55
- - bump.gemspec
56
50
  - lib/bump.rb
57
51
  - lib/bump/tasks.rb
58
- - spec/bump/tasks_spec.rb
59
- - spec/bump_spec.rb
60
- - spec/spec_helper.rb
61
52
  homepage: https://github.com/gregorym/bump
62
53
  licenses:
63
54
  - MIT
@@ -70,7 +61,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
61
  requirements:
71
62
  - - ">="
72
63
  - !ruby/object:Gem::Version
73
- version: '0'
64
+ version: 1.9.3
74
65
  required_rubygems_version: !ruby/object:Gem::Requirement
75
66
  requirements:
76
67
  - - ">="
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- *.gem
2
- .bundle/
3
- .rspec
@@ -1,19 +0,0 @@
1
- rvm:
2
- - ree
3
- - 1.8.7
4
- - 1.9.2
5
- - 1.9.3
6
- - 2.0.0
7
- - 2.1.0
8
- - jruby-18mode
9
- - jruby-19mode
10
- - rbx-2.1.1
11
- matrix:
12
- allow_failures:
13
- - rvm: 2.1.0
14
- before_script:
15
- - git config --global user.email "you@example.com"
16
- - git config --global user.name "Your Name"
17
- before_install:
18
- - gem update --system 2.1.11
19
- - gem --version
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source "https://rubygems.org"
2
- gemspec
@@ -1,26 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- bump (0.5.2)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- diff-lcs (1.1.3)
10
- rake (10.0.2)
11
- rspec (2.11.0)
12
- rspec-core (~> 2.11.0)
13
- rspec-expectations (~> 2.11.0)
14
- rspec-mocks (~> 2.11.0)
15
- rspec-core (2.11.1)
16
- rspec-expectations (2.11.3)
17
- diff-lcs (~> 1.1.3)
18
- rspec-mocks (2.11.3)
19
-
20
- PLATFORMS
21
- ruby
22
-
23
- DEPENDENCIES
24
- bump!
25
- rake (~> 10.0.0)
26
- rspec (~> 2.0)
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require 'bundler/gem_tasks'
2
-
3
- task :default do
4
- sh "rspec spec/"
5
- end
6
-
@@ -1,17 +0,0 @@
1
- Gem::Specification.new "bump" do |s|
2
- s.version = "0.5.2"
3
- s.author = "Gregory Marcilhacy"
4
- s.email = "g.marcilhacy@gmail.com"
5
- s.homepage = "https://github.com/gregorym/bump"
6
- s.summary = "Bump your gem version file"
7
-
8
- s.files = `git ls-files`.split("\n")
9
- s.license = "MIT"
10
- s.require_path = "lib"
11
- s.executables = ["bump"]
12
-
13
- s.add_development_dependency 'rake', '~> 10.0.0'
14
- s.add_development_dependency 'rspec', '~> 2.0'
15
- end
16
-
17
-
@@ -1,45 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "rake bump" do
4
- inside_of_folder("spec/fixture")
5
-
6
- before do
7
- write "VERSION", "1.2.3\n"
8
- write "Rakefile", "require File.expand_path('../../../lib/bump/tasks', __FILE__)"
9
- raise unless system("git add VERSION")
10
- end
11
-
12
- it "bumps a version" do
13
- output = run "rake bump:minor"
14
- output.should include("1.3.0")
15
- read("VERSION").should == "1.3.0\n"
16
- `git log -1 --pretty=format:'%s'`.should == "v1.3.0"
17
- end
18
-
19
- it "bumps a version and can optionally tag it" do
20
- run "rake bump:patch[true]"
21
- `git tag`.split("\n").last.should == "v1.2.4"
22
- end
23
-
24
- it "does not tag by default" do
25
- run "rake bump:patch"
26
- `git tag`.split("\n").last.should be_nil
27
- end
28
-
29
- it "sets a version" do
30
- output = run "VERSION=1.3.0 rake bump:set"
31
- output.should include("1.3.0")
32
- read("VERSION").should == "1.3.0\n"
33
- `git log -1 --pretty=format:'%s'`.should == "v1.3.0"
34
- end
35
-
36
- it "fails when it cannot bump" do
37
- write "VERSION", "AAA"
38
- run "rake bump:minor", :fail => true
39
- end
40
-
41
- it "shows the version" do
42
- result = run "rake bump:current"
43
- result.should include("1.2.3")
44
- end
45
- end
@@ -1,443 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Bump do
4
- let(:gemspec) { "fixture.gemspec" }
5
-
6
- inside_of_folder("spec/fixture")
7
-
8
- it "should fail if it cannot find anything to bump" do
9
- bump("current", :fail => true).should include "Unable to find"
10
- end
11
-
12
- it "should fail without command" do
13
- write_gemspec
14
- bump("", :fail => true).should include "Usage instructions: bump --help"
15
- end
16
-
17
- it "should fail with invalid options" do
18
- write_gemspec
19
- bump("xxx", :fail => true).should include "Invalid option"
20
- end
21
-
22
- it "should fail with multiple gemspecs" do
23
- write_gemspec
24
- write("xxxx.gemspec", "Gem::Specification.new{}")
25
- bump("current", :fail => true).should include "More than one gemspec file"
26
- end
27
-
28
- it "should fail if version is weird" do
29
- write_gemspec('"1."+"3.4"')
30
- bump("current", :fail => true).should include "Unable to find a file with the gem version"
31
- end
32
-
33
- it "should show help" do
34
- bump("--help").should include("bump current")
35
- end
36
-
37
- context "git" do
38
- it "should commit the new version" do
39
- write_gemspec
40
- `git add #{gemspec}`
41
-
42
- bump("patch")
43
-
44
- `git log -1 --pretty=format:'%s'`.should == "v4.2.4"
45
- `git status`.should include "nothing to commit"
46
- end
47
-
48
- it "should not commit if --no-commit flag was given" do
49
- write_gemspec
50
- `git add #{gemspec}`
51
-
52
- bump("patch --no-commit")
53
-
54
- `git log -1 --pretty=format:'%s'`.should == "initial"
55
- `git status`.should_not include "nothing to commit"
56
- end
57
-
58
- it "should not add untracked gemspec" do
59
- write_gemspec
60
-
61
- bump("patch")
62
-
63
- `git log -1 --pretty=format:'%s'`.should == "initial"
64
- `git status`.should include "Untracked files:"
65
- end
66
-
67
- it "should tag the version if --tag flag given" do
68
- write_gemspec
69
-
70
- bump("patch --tag")
71
- `git tag -l`.should include 'v4.2.4'
72
- end
73
-
74
- it "should not tag the version if --no-commit and --tag flag given" do
75
- write_gemspec
76
-
77
- bump("patch --no-commit --tag")
78
- `git tag -l`.should == ''
79
- end
80
- end
81
-
82
- context ".version in gemspec" do
83
- before do
84
- write_gemspec
85
- end
86
-
87
- it "should find current version" do
88
- bump("current").should include("4.2.3")
89
- read(gemspec).should include('s.version = "4.2.3"')
90
- end
91
-
92
- it "should bump patch" do
93
- bump("patch").should include("4.2.4")
94
- read(gemspec).should include('s.version = "4.2.4"')
95
- end
96
-
97
- it "should bump minor" do
98
- bump("minor").should include("4.3.0")
99
- read(gemspec).should include('s.version = "4.3.0"')
100
- end
101
-
102
- it "should bump major" do
103
- bump("major").should include("5.0.0")
104
- read(gemspec).should include('s.version = "5.0.0"')
105
- end
106
-
107
- it "should set the version" do
108
- bump("set 1.2.3").should include("1.2.3")
109
- read(gemspec).should include('s.version = "1.2.3"')
110
- end
111
-
112
- it "should bump more then 10" do
113
- bump("patch").should include("4.2.4")
114
- bump("patch").should include("4.2.5")
115
- bump("patch").should include("4.2.6")
116
- bump("patch").should include("4.2.7")
117
- bump("patch").should include("4.2.8")
118
- bump("patch").should include("4.2.9")
119
- bump("patch").should include("4.2.10")
120
- bump("patch").should include("4.2.11")
121
- read(gemspec).should include('s.version = "4.2.11"')
122
- end
123
-
124
- it "should not bump multiple versions" do
125
- version = '"4.2.3"'
126
- write gemspec, <<-RUBY
127
- Gem::Specification.new do |s|
128
- s.name = 'fixture'
129
- s.version = #{version}
130
- s.summary = 'Fixture gem'
131
- s.runtime_dependency 'rake', #{version}
132
- end
133
- RUBY
134
- bump("patch").should include("4.2.4")
135
- read(gemspec).should include('s.version = "4.2.4"')
136
- read(gemspec).should include("'rake', #{version}")
137
- end
138
- end
139
-
140
- context ".version in gemspec within the initializer" do
141
- before do
142
- write gemspec, <<-RUBY.sub(" "*6, "")
143
- Gem::Specification.new "bump", "4.2.3" do
144
- end
145
- RUBY
146
- end
147
-
148
- it "should bump patch" do
149
- bump("patch").should include("4.2.4")
150
- read(gemspec).should include('"4.2.4"')
151
- end
152
-
153
- it "should set the version" do
154
- bump("set 1.2.3").should include("1.2.3")
155
- read(gemspec).should include('"1.2.3"')
156
- end
157
- end
158
-
159
- context "VERSION in version.rb" do
160
- let(:version_file) { "lib/foo/version.rb" }
161
-
162
- before do
163
- write_version_file
164
- end
165
-
166
- it "show current" do
167
- bump("current").should include("1.2.3")
168
- read(version_file).should include(' VERSION = "1.2.3"')
169
- end
170
-
171
- it "should bump VERSION" do
172
- bump("minor").should include("1.3.0")
173
- read(version_file).should include(' VERSION = "1.3.0"')
174
- end
175
-
176
- it "should set the version" do
177
- bump("set 1.2.3").should include("1.2.3")
178
- read(version_file).should include('"1.2.3"')
179
- end
180
-
181
- it "should bump Version" do
182
- write version_file, <<-RUBY.sub(" "*8, "")
183
- module Foo
184
- Version = "1.2.3"
185
- end
186
- RUBY
187
- bump("minor").should include("1.3.0")
188
- read(version_file).should include(' Version = "1.3.0"')
189
- end
190
-
191
- it "should set Version" do
192
- write version_file, <<-RUBY.sub(" "*8, "")
193
- module Foo
194
- Version = "1.2.3"
195
- end
196
- RUBY
197
- bump("set 1.3.0").should include("1.3.0")
198
- read(version_file).should include(' Version = "1.3.0"')
199
- end
200
-
201
- it "should bump if a gemspec exists and leave it alone" do
202
- write_gemspec "'1.'+'2.3'"
203
- bump("minor").should include("1.3.0")
204
- read(gemspec).should include("version = '1.'+'2.3'")
205
- end
206
- end
207
-
208
- context "version in VERSION" do
209
- let(:version) { "1.2.3" }
210
- let(:version_file) { "lib/foo/version.rb" }
211
-
212
- before do
213
- write "VERSION", "#{version}\n"
214
- end
215
-
216
- it "show current" do
217
- bump("current").should include("#{version}")
218
- read("VERSION").should include("#{version}")
219
- end
220
-
221
- it "should bump version" do
222
- bump("minor").should include("1.3.0")
223
- read("VERSION").should include("1.3.0")
224
- end
225
-
226
- it "should set the version" do
227
- bump("set 1.3.0").should include("1.3.0")
228
- read("VERSION").should include("1.3.0")
229
- end
230
-
231
- it "should bump if a gemspec & version.rb exists and leave it alone" do
232
- write_gemspec "'1.2.0'"
233
- write_version_file "File.read('VERSION')"
234
- bump("minor").should include("1.3.0")
235
- read("VERSION").should include("1.3.0")
236
- read(version_file).should include("VERSION = File.read('VERSION')")
237
- read(gemspec).should include("version = '1.2.0'")
238
- end
239
-
240
- context "with pre-release identifier" do
241
- let(:version) { "1.2.3-alpha" }
242
- before do
243
- write "VERSION", "#{version}\n"
244
- end
245
-
246
- it "show current" do
247
- bump("current").should include(version)
248
- read("VERSION").should include(version)
249
- end
250
-
251
- it "minor should drop prerelease" do
252
- bump("minor").should include("1.3.0")
253
- read("VERSION").should include("1.3.0")
254
- bump("minor").should_not include("alpha")
255
- read("VERSION").should_not include("alpha")
256
- end
257
-
258
- it "major should drop prerelease" do
259
- bump("major").should include("2.0.0")
260
- read("VERSION").should include("2.0.0")
261
- bump("major").should_not include("alpha")
262
- read("VERSION").should_not include("alpha")
263
- end
264
-
265
- context "alpha" do
266
- it "should bump to beta" do
267
- bump("pre").should include("1.2.3-beta")
268
- read("VERSION").should include("1.2.3-beta")
269
- end
270
- end
271
-
272
- context "beta" do
273
- let(:version) { "1.2.3-beta" }
274
- it "should bump to rc" do
275
- bump("pre").should include("1.2.3-rc")
276
- read("VERSION").should include("1.2.3-rc")
277
- end
278
- end
279
-
280
- context "rc" do
281
- let(:version) { "1.2.3-rc" }
282
- it "should bump to final" do
283
- bump("pre").should include("1.2.3")
284
- read("VERSION").should include("1.2.3")
285
- end
286
- end
287
-
288
- context "final" do
289
- let(:version) { "1.2.3" }
290
- it "should bump to alpha" do
291
- bump("pre").should include("1.2.3-alpha")
292
- read("VERSION").should include("1.2.3-alpha")
293
- end
294
- end
295
- end
296
- end
297
-
298
- context "with a Gemfile" do
299
- before do
300
- write_gemspec('"1.0.0"')
301
- write "Gemfile", <<-RUBY
302
- source 'https://rubygems.org'
303
- # a gem not in the Gemfile used to run this test
304
- gem 'a1330ks_bmi', '~> 0.0.1'
305
- gemspec
306
- RUBY
307
- `git add Gemfile #{gemspec}`
308
- Bundler.with_clean_env { run("bundle") }
309
- end
310
-
311
- it "bundle to keep version up to date and commit changed Gemfile.lock" do
312
- `git add Gemfile.lock`
313
- bump("patch")
314
- read("Gemfile.lock").should include "1.0.1"
315
- `git status`.should include "nothing to commit"
316
- end
317
-
318
- it "does not bundle with --no-bundle" do
319
- bump("patch --no-bundle")
320
- read(gemspec).should include "1.0.1"
321
- read("Gemfile.lock").should include "1.0.0"
322
- `git status --porcelain`.should include "?? Gemfile.lock"
323
- end
324
-
325
- it "does not bundle or commit an untracked Gemfile.lock" do
326
- bump("patch")
327
- read("Gemfile.lock").should include "1.0.0"
328
- `git status --porcelain`.should include "?? Gemfile.lock"
329
- end
330
- end
331
-
332
- context ".current" do
333
- it "returns the version as a string" do
334
- write_gemspec
335
- Bump::Bump.current.should == "4.2.3"
336
- end
337
- end
338
-
339
- context "VERSION in lib file" do
340
- let(:version_file) { "lib/foo.rb" }
341
-
342
- before do
343
- write_version_file
344
- write("lib/random_other_file.rb", "foo")
345
- write("lib/random/other/file.rb", "foo")
346
- end
347
-
348
- it "show current" do
349
- bump("current").should include("1.2.3")
350
- read(version_file).should include(' VERSION = "1.2.3"')
351
- end
352
-
353
- it "should bump VERSION" do
354
- bump("minor").should include("1.3.0")
355
- read(version_file).should include(' VERSION = "1.3.0"')
356
- end
357
-
358
- it "should set VERSION" do
359
- bump("set 1.3.0").should include("1.3.0")
360
- read(version_file).should include(' VERSION = "1.3.0"')
361
- end
362
-
363
- it "should bump Version" do
364
- write version_file, <<-RUBY.sub(" "*8, "")
365
- module Foo
366
- Version = "1.2.3"
367
- end
368
- RUBY
369
- bump("minor").should include("1.3.0")
370
- read(version_file).should include(' Version = "1.3.0"')
371
- end
372
-
373
- it "should set Version" do
374
- write version_file, <<-RUBY.sub(" "*8, "")
375
- module Foo
376
- Version = "1.2.3"
377
- end
378
- RUBY
379
- bump("set 1.3.0").should include("1.3.0")
380
- read(version_file).should include(' Version = "1.3.0"')
381
- end
382
-
383
- it "should bump if a gemspec exists and leave it alone" do
384
- write_gemspec "'1.'+'2.3'"
385
- bump("minor").should include("1.3.0")
386
- read(gemspec).should include("version = '1.'+'2.3'")
387
- end
388
-
389
- context "that is nested" do
390
- let(:version_file) { "lib/bar/baz/foo.rb" }
391
-
392
- it "show current" do
393
- bump("current").should include("1.2.3")
394
- read(version_file).should include(' VERSION = "1.2.3"')
395
- end
396
- end
397
- end
398
-
399
- context "version in metadata.rb" do
400
- let(:version) { "1.2.3" }
401
- let(:version_file) { "metadata.rb" }
402
-
403
- before do
404
- write version_file, "foo :bar\nversion '#{version}'\nbar :baz\n"
405
- end
406
-
407
- it "should bump version" do
408
- bump("minor").should include("1.3.0")
409
- read(version_file).should include("1.3.0")
410
- end
411
-
412
- it "should set the version" do
413
- bump("set 1.3.0").should include("1.3.0")
414
- read(version_file).should include("1.3.0")
415
- end
416
- end
417
-
418
- private
419
-
420
- def bump(command="", options={})
421
- cmdline = "#{File.expand_path("../../bin/bump", __FILE__)} #{command}"
422
- run cmdline, options
423
- end
424
-
425
- def write_gemspec(version = '"4.2.3"')
426
- write gemspec, <<-RUBY.sub(" "*6, "")
427
- Gem::Specification.new do |s|
428
- s.author = 'joe'
429
- s.name = 'fixture'
430
- s.version = #{version}
431
- s.summary = 'Fixture gem'
432
- end
433
- RUBY
434
- end
435
-
436
- def write_version_file(version = '"1.2.3"')
437
- write version_file, <<-RUBY.sub(" "*6, "")
438
- module Foo
439
- VERSION = #{version}
440
- end
441
- RUBY
442
- end
443
- end
@@ -1,41 +0,0 @@
1
- require "bundler"
2
- require "bump"
3
-
4
- module SpecHelpers
5
- module InstanceMethods
6
- def write(file, content)
7
- folder = File.dirname(file)
8
- run "mkdir -p #{folder}" unless File.exist?(folder)
9
- File.open(file, 'w'){|f| f.write content }
10
- end
11
-
12
- def read(file)
13
- File.read(file)
14
- end
15
-
16
- def run(cmd, options={})
17
- result = `#{cmd} 2>&1`
18
- raise "FAILED #{cmd} --> #{result}" if $?.success? != !options[:fail]
19
- result
20
- end
21
- end
22
-
23
- module ClassMethods
24
- def inside_of_folder(folder)
25
- folder = File.expand_path(folder, File.dirname(File.dirname(__FILE__)))
26
- around do |example|
27
- run "rm -rf #{folder} && mkdir #{folder}"
28
- Dir.chdir folder do
29
- `git init && git commit --allow-empty -am 'initial'` # so we never accidentally do commit to the current repo
30
- example.call
31
- end
32
- run "rm -rf #{folder}"
33
- end
34
- end
35
- end
36
- end
37
-
38
- RSpec.configure do |c|
39
- c.include SpecHelpers::InstanceMethods
40
- c.extend SpecHelpers::ClassMethods
41
- end