bump 0.3.0 → 0.3.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.
@@ -0,0 +1,4 @@
1
+ rvm:
2
+ - ree
3
+ - 1.9.2
4
+ - 1.9.3
@@ -0,0 +1,35 @@
1
+ # Installation
2
+
3
+ gem install bump
4
+
5
+ # Usage
6
+
7
+ Current version of your gem:
8
+
9
+ bump current
10
+
11
+ Current version: 0.1.2
12
+
13
+ Bump your gemfile (major, minor, patch):
14
+
15
+ bump patch
16
+
17
+ Bump version 0.1.2 to 0.1.3
18
+
19
+ # Supported locations
20
+ - VERSION file with "1.2.3"
21
+ - gemspec with `gem.version = "1.2.3"`
22
+ - lib/**/version.rb file with `VERSION = "1.2.3"`
23
+
24
+ # Todo
25
+
26
+ - Handle options properly
27
+ - `VERSION = "1.2.3"` in lib/*.rb
28
+ - gemspec with `Gem::Specification.new "gem-name", "1.2.3" do`
29
+
30
+ # Author
31
+ Gregory<br/>
32
+ License: MIT<br/>
33
+ [![Build Status](https://travis-ci.org/gregorym/bump.png)](https://travis-ci.org/gregorym/bump)
34
+
35
+
data/bin/bump CHANGED
@@ -2,7 +2,8 @@
2
2
  require 'optparse'
3
3
 
4
4
  options = {
5
- :commit => true
5
+ :commit => true,
6
+ :bundle => File.exist?("Gemfile")
6
7
  }
7
8
  OptionParser.new do |opts|
8
9
  opts.banner = <<BANNER
@@ -17,6 +18,7 @@ Usage:
17
18
  Options:
18
19
  BANNER
19
20
  opts.on("--no-commit", "Do not make a commit.") { options[:commit] = false }
21
+ opts.on("--no-bundle", "Do not bundle.") { options[:bundle] = false }
20
22
  opts.on("-h", "--help","Show this.") { puts opts; exit }
21
23
  end.parse!
22
24
 
@@ -1,5 +1,5 @@
1
1
  Gem::Specification.new "bump" do |s|
2
- s.version = "0.3.0"
2
+ s.version = "0.3.1"
3
3
  s.author = "Gregory Marcilhacy"
4
4
  s.email = "g.marcilhacy@gmail.com"
5
5
  s.homepage = "https://github.com/gregorym/bump"
@@ -36,13 +36,15 @@ module Bump
36
36
  current, file = current_version
37
37
  next_version = next_version(current, part)
38
38
  replace(file, current, next_version)
39
- commit(next_version, file) if options[:commit]
39
+ system("bundle") if options[:bundle]
40
+ commit(next_version, file, options) if options[:commit]
40
41
  ["Bump version #{current} to #{next_version}", 0]
41
42
  end
42
43
 
43
- def self.commit(version, file)
44
+ def self.commit(version, file, options)
44
45
  return unless File.directory?(".git")
45
- raise unless system("git add #{file} && git commit -m 'v#{version}'")
46
+ system("git add --update Gemfile.lock") if options[:bundle]
47
+ system("git add --update #{file} && git commit -m 'v#{version}'")
46
48
  end
47
49
 
48
50
  def self.replace(file, old, new)
@@ -1,4 +1,5 @@
1
1
  require File.dirname(__FILE__) + "/../lib/bump.rb"
2
+ require 'bundler'
2
3
 
3
4
  describe Bump do
4
5
  let(:gemspec){ "fixture.gemspec" }
@@ -45,17 +46,32 @@ describe Bump do
45
46
  context "git" do
46
47
  it "should commit the new version" do
47
48
  write_gemspec
49
+ `git add #{gemspec}`
50
+
48
51
  bump("patch")
52
+
49
53
  `git log -1 --pretty=format:'%s'`.should == "v4.2.4"
50
54
  `git status`.should include "nothing to commit"
51
55
  end
52
56
 
53
57
  it "should not commit if --no-commit flag was given" do
54
58
  write_gemspec
59
+ `git add #{gemspec}`
60
+
55
61
  bump("patch --no-commit")
62
+
56
63
  `git log -1 --pretty=format:'%s'`.should == "initial"
57
64
  `git status`.should_not include "nothing to commit"
58
65
  end
66
+
67
+ it "should not add untracked gemspec" do
68
+ write_gemspec
69
+
70
+ bump("patch")
71
+
72
+ `git log -1 --pretty=format:'%s'`.should == "initial"
73
+ `git status`.should include "Untracked files:"
74
+ end
59
75
  end
60
76
 
61
77
  context ".version in gemspec" do
@@ -153,6 +169,36 @@ describe Bump do
153
169
  end
154
170
  end
155
171
 
172
+ context "with a Gemfile" do
173
+ before do
174
+ write_gemspec('"1.0.0"')
175
+ write "Gemfile", <<-RUBY
176
+ gemspec
177
+ RUBY
178
+ `git add Gemfile #{gemspec}`
179
+ Bundler.with_clean_env { run("bundle") }
180
+ end
181
+
182
+ it "bundle to keep version up to date and commit changed Gemfile.lock" do
183
+ `git add Gemfile.lock`
184
+ Bundler.with_clean_env { bump("patch") }
185
+ read("Gemfile.lock").should include "1.0.1"
186
+ `git status`.should include "nothing to commit"
187
+ end
188
+
189
+ it "does not bundle with --no-bundle" do
190
+ Bundler.with_clean_env { bump("patch --no-bundle") }
191
+ read(gemspec).should include "1.0.1"
192
+ read("Gemfile.lock").should include "1.0.0"
193
+ end
194
+
195
+ it "does not commit an untracked Gemfile.lock" do
196
+ Bundler.with_clean_env { bump("patch") }
197
+ read("Gemfile.lock").should include "1.0.1"
198
+ `git status`.should include "Untracked files:"
199
+ end
200
+ end
201
+
156
202
  private
157
203
 
158
204
  def write(file, content)
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.0
4
+ version: 0.3.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: 2012-10-18 00:00:00.000000000 Z
12
+ date: 2012-10-22 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: g.marcilhacy@gmail.com
@@ -19,9 +19,10 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - .gitignore
22
+ - .travis.yml
22
23
  - Gemfile
23
24
  - Gemfile.lock
24
- - README.textile
25
+ - README.md
25
26
  - Rakefile
26
27
  - bin/bump
27
28
  - bump.gemspec
@@ -1,27 +0,0 @@
1
- h1. Installation
2
-
3
- bc. gem install bump
4
-
5
- h1. Usage
6
-
7
- Current version of your gem:
8
-
9
- bc. bump current
10
- Current version: 0.1.2
11
-
12
- Bump your gemfile (major, minor, patch):
13
-
14
- bc. bump patch
15
- Bump version 0.1.2 to 0.1.3
16
-
17
- h1. Supported locations
18
- * VERSION file with "1.2.3"
19
- * gemspec with `gem.version = "1.2.3"`
20
- * lib/**/version.rb file with `VERSION = "1.2.3"`
21
-
22
- h1. Todo
23
-
24
- * Handle options properly
25
- * `VERSION = "1.2.3"` in lib/*.rb
26
- * gemspec with `Gem::Specification.new "gem-name", "1.2.3" do`
27
-