bump 0.4.0 → 0.4.1

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bump (0.4.0)
4
+ bump (0.4.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,5 +1,5 @@
1
1
  Gem::Specification.new "bump" do |s|
2
- s.version = "0.4.0"
2
+ s.version = "0.4.1"
3
3
  s.author = "Gregory Marcilhacy"
4
4
  s.email = "g.marcilhacy@gmail.com"
5
5
  s.homepage = "https://github.com/gregorym/bump"
@@ -54,11 +54,23 @@ module Bump
54
54
 
55
55
  def self.bump(file, current, next_version, options)
56
56
  replace(file, current, next_version)
57
- system("bundle") if options[:bundle] and under_version_control?("Gemfile.lock")
57
+ if options[:bundle] and under_version_control?("Gemfile.lock")
58
+ bundler_with_clean_env do
59
+ system("bundle")
60
+ end
61
+ end
58
62
  commit(next_version, file, options) if options[:commit]
59
63
  ["Bump version #{current} to #{next_version}", 0]
60
64
  end
61
65
 
66
+ def self.bundler_with_clean_env(&block)
67
+ if defined?(Bundler)
68
+ Bundler.with_clean_env(&block)
69
+ else
70
+ yield
71
+ end
72
+ end
73
+
62
74
  def self.bump_part(part, options)
63
75
  current, file = current_info
64
76
  next_version = next_version(current, part)
@@ -271,6 +271,7 @@ describe Bump do
271
271
  write_gemspec('"1.0.0"')
272
272
  write "Gemfile", <<-RUBY
273
273
  source :rubygems
274
+ gem "parallel" # a gem not in the Gemfile used to run this test
274
275
  gemspec
275
276
  RUBY
276
277
  `git add Gemfile #{gemspec}`
@@ -279,20 +280,20 @@ describe Bump do
279
280
 
280
281
  it "bundle to keep version up to date and commit changed Gemfile.lock" do
281
282
  `git add Gemfile.lock`
282
- Bundler.with_clean_env { bump("patch") }
283
+ bump("patch")
283
284
  read("Gemfile.lock").should include "1.0.1"
284
285
  `git status`.should include "nothing to commit"
285
286
  end
286
287
 
287
288
  it "does not bundle with --no-bundle" do
288
- Bundler.with_clean_env { bump("patch --no-bundle") }
289
+ bump("patch --no-bundle")
289
290
  read(gemspec).should include "1.0.1"
290
291
  read("Gemfile.lock").should include "1.0.0"
291
292
  `git status --porcelain`.should include "?? Gemfile.lock"
292
293
  end
293
294
 
294
295
  it "does not bundle or commit an untracked Gemfile.lock" do
295
- Bundler.with_clean_env { bump("patch") }
296
+ bump("patch")
296
297
  read("Gemfile.lock").should include "1.0.0"
297
298
  `git status --porcelain`.should include "?? Gemfile.lock"
298
299
  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.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-29 00:00:00.000000000 Z
12
+ date: 2013-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake