bump 0.3.7 → 0.3.8

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.
data/.gitignore CHANGED
@@ -1 +1,3 @@
1
1
  *.gem
2
+ .bundle/
3
+ .rspec
data/Gemfile CHANGED
@@ -1,5 +1,2 @@
1
1
  source :rubygems
2
2
  gemspec
3
-
4
- gem 'rake'
5
- gem 'rspec', '~>2'
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bump (0.3.7)
4
+ bump (0.3.8)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
9
  diff-lcs (1.1.3)
10
- rake (0.9.2.2)
10
+ rake (10.0.2)
11
11
  rspec (2.11.0)
12
12
  rspec-core (~> 2.11.0)
13
13
  rspec-expectations (~> 2.11.0)
@@ -22,5 +22,5 @@ PLATFORMS
22
22
 
23
23
  DEPENDENCIES
24
24
  bump!
25
- rake
26
- rspec (~> 2)
25
+ rake (~> 10.0.0)
26
+ rspec (~> 2.0)
data/bump.gemspec CHANGED
@@ -1,5 +1,5 @@
1
1
  Gem::Specification.new "bump" do |s|
2
- s.version = "0.3.7"
2
+ s.version = "0.3.8"
3
3
  s.author = "Gregory Marcilhacy"
4
4
  s.email = "g.marcilhacy@gmail.com"
5
5
  s.homepage = "https://github.com/gregorym/bump"
@@ -9,6 +9,9 @@ Gem::Specification.new "bump" do |s|
9
9
  s.license = "MIT"
10
10
  s.require_path = "lib"
11
11
  s.executables = ["bump"]
12
+
13
+ s.add_development_dependency 'rake', '~> 10.0.0'
14
+ s.add_development_dependency 'rspec', '~> 2.0'
12
15
  end
13
16
 
14
17
 
data/lib/bump.rb CHANGED
@@ -71,6 +71,7 @@ module Bump
71
71
  version_from_version_rb ||
72
72
  version_from_gemspec ||
73
73
  version_from_version ||
74
+ version_from_lib_rb ||
74
75
  raise(UnfoundVersionFileError)
75
76
  )
76
77
  raise UnfoundVersionError unless version
@@ -85,7 +86,7 @@ module Bump
85
86
  end
86
87
 
87
88
  def self.version_from_version_rb
88
- return unless file = find_version_file("*/**/version.rb")
89
+ return unless file = find_version_file("lib/**/version.rb")
89
90
  extract_version_from_file(file)
90
91
  end
91
92
 
@@ -94,6 +95,12 @@ module Bump
94
95
  extract_version_from_file(file)
95
96
  end
96
97
 
98
+ def self.version_from_lib_rb
99
+ file = find_version_file('lib/*.rb')
100
+ return unless file && File.open(file).lines.grep(/^VERSION = (['"])#{VERSION_REGEX}['"]/i)
101
+ extract_version_from_file(file)
102
+ end
103
+
97
104
  def self.extract_version_from_file(file)
98
105
  return unless version = File.read(file)[VERSION_REGEX]
99
106
  [version, file]
data/spec/bump_spec.rb CHANGED
@@ -1,8 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Bump do
4
- let(:gemspec){ "fixture.gemspec" }
5
- let(:version_rb_file){ "lib/foo/version.rb" }
4
+ let(:gemspec) { "fixture.gemspec" }
6
5
 
7
6
  inside_of_folder("spec/fixture")
8
7
 
@@ -119,28 +118,30 @@ describe Bump do
119
118
  end
120
119
 
121
120
  context "VERSION in version.rb" do
121
+ let(:version_file) { "lib/foo/version.rb" }
122
+
122
123
  before do
123
- write_version_rb
124
+ write_version_file
124
125
  end
125
126
 
126
127
  it "show current" do
127
128
  bump("current").should include("1.2.3")
128
- read(version_rb_file).should include(' VERSION = "1.2.3"')
129
+ read(version_file).should include(' VERSION = "1.2.3"')
129
130
  end
130
131
 
131
132
  it "should bump VERSION" do
132
133
  bump("minor").should include("1.3.0")
133
- read(version_rb_file).should include(' VERSION = "1.3.0"')
134
+ read(version_file).should include(' VERSION = "1.3.0"')
134
135
  end
135
136
 
136
137
  it "should bump Version" do
137
- write version_rb_file, <<-RUBY.sub(" "*8, "")
138
+ write version_file, <<-RUBY.sub(" "*8, "")
138
139
  module Foo
139
140
  Version = "1.2.3"
140
141
  end
141
142
  RUBY
142
143
  bump("minor").should include("1.3.0")
143
- read(version_rb_file).should include(' Version = "1.3.0"')
144
+ read(version_file).should include(' Version = "1.3.0"')
144
145
  end
145
146
 
146
147
  it "should bump if a gemspec exists and leave it alone" do
@@ -152,6 +153,7 @@ describe Bump do
152
153
 
153
154
  context "version in VERSION" do
154
155
  let(:version) { "1.2.3" }
156
+ let(:version_file) { "lib/foo/version.rb" }
155
157
 
156
158
  before do
157
159
  write "VERSION", "#{version}\n"
@@ -169,10 +171,10 @@ describe Bump do
169
171
 
170
172
  it "should bump if a gemspec & version.rb exists and leave it alone" do
171
173
  write_gemspec "File.read('VERSION')"
172
- write_version_rb "File.read('VERSION')"
174
+ write_version_file "File.read('VERSION')"
173
175
  bump("minor").should include("1.3.0")
174
176
  read("VERSION").should include("1.3.0")
175
- read(version_rb_file).should include("VERSION = File.read('VERSION')")
177
+ read(version_file).should include("VERSION = File.read('VERSION')")
176
178
  read(gemspec).should include("version = File.read('VERSION')")
177
179
  end
178
180
 
@@ -238,6 +240,7 @@ describe Bump do
238
240
  before do
239
241
  write_gemspec('"1.0.0"')
240
242
  write "Gemfile", <<-RUBY
243
+ source :rubygems
241
244
  gemspec
242
245
  RUBY
243
246
  `git add Gemfile #{gemspec}`
@@ -272,6 +275,40 @@ describe Bump do
272
275
  end
273
276
  end
274
277
 
278
+ context "VERSION in lib file" do
279
+ let(:version_file) { "lib/foo.rb" }
280
+
281
+ before do
282
+ write_version_file
283
+ end
284
+
285
+ it "show current" do
286
+ bump("current").should include("1.2.3")
287
+ read(version_file).should include(' VERSION = "1.2.3"')
288
+ end
289
+
290
+ it "should bump VERSION" do
291
+ bump("minor").should include("1.3.0")
292
+ read(version_file).should include(' VERSION = "1.3.0"')
293
+ end
294
+
295
+ it "should bump Version" do
296
+ write version_file, <<-RUBY.sub(" "*8, "")
297
+ module Foo
298
+ Version = "1.2.3"
299
+ end
300
+ RUBY
301
+ bump("minor").should include("1.3.0")
302
+ read(version_file).should include(' Version = "1.3.0"')
303
+ end
304
+
305
+ it "should bump if a gemspec exists and leave it alone" do
306
+ write_gemspec "'1.'+'2.3'"
307
+ bump("minor").should include("1.3.0")
308
+ read(gemspec).should include("version = '1.'+'2.3'")
309
+ end
310
+ end
311
+
275
312
  private
276
313
 
277
314
  def bump(command="", options={})
@@ -285,14 +322,14 @@ describe Bump do
285
322
  s.version = #{version}
286
323
  s.summary = 'Fixture gem'
287
324
  end
288
- RUBY
325
+ RUBY
289
326
  end
290
327
 
291
- def write_version_rb(version = '"1.2.3"')
292
- write version_rb_file, <<-RUBY.sub(" "*6, "")
328
+ def write_version_file(version = '"1.2.3"')
329
+ write version_file, <<-RUBY.sub(" "*6, "")
293
330
  module Foo
294
331
  VERSION = #{version}
295
332
  end
296
- RUBY
333
+ RUBY
297
334
  end
298
335
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bump
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,40 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-10 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2012-12-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 10.0.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 10.0.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '2.0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '2.0'
14
46
  description:
15
47
  email: g.marcilhacy@gmail.com
16
48
  executables: