bump 0.4.3 → 0.5.0

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bump (0.4.3)
4
+ bump (0.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -27,6 +27,10 @@ If you don't want to make a commit after bumping, add the `--no-commit` option.
27
27
 
28
28
  bump patch --no-commit
29
29
 
30
+ ### --tag
31
+ Will add a git tag (if the current project is a git repository and `--no-commit` has not been given).
32
+
33
+ bump patch --tag
30
34
 
31
35
  ### --no-bundle
32
36
  If you don't want to run the `bundle` command after bumping, add the `--no-bundle` option.
data/bin/bump CHANGED
@@ -18,6 +18,7 @@ Options:
18
18
  BANNER
19
19
  opts.on("--no-commit", "Do not make a commit.") { options[:commit] = false }
20
20
  opts.on("--no-bundle", "Do not bundle.") { options[:bundle] = false }
21
+ opts.on("--tag", "Create git tag from version (only if commit is true).") { options[:tag] = true }
21
22
  opts.on("-h", "--help","Show this.") { puts opts; exit }
22
23
  end.parse!
23
24
 
@@ -26,7 +27,7 @@ unless (ARGV.size == 1 && ARGV.first != "set") || (ARGV.size == 2 && ARGV.first
26
27
  exit 1
27
28
  end
28
29
 
29
- if ARGV.first == "set"
30
+ if ARGV.first == "set"
30
31
  options[:version] = ARGV[1]
31
32
  end
32
33
 
data/bump.gemspec CHANGED
@@ -1,5 +1,5 @@
1
1
  Gem::Specification.new "bump" do |s|
2
- s.version = "0.4.3"
2
+ s.version = "0.5.0"
3
3
  s.author = "Gregory Marcilhacy"
4
4
  s.email = "g.marcilhacy@gmail.com"
5
5
  s.homepage = "https://github.com/gregorym/bump"
data/lib/bump.rb CHANGED
@@ -14,7 +14,8 @@ module Bump
14
14
  def self.defaults
15
15
  {
16
16
  :commit => true,
17
- :bundle => File.exist?("Gemfile")
17
+ :bundle => File.exist?("Gemfile"),
18
+ :tag => false
18
19
  }
19
20
  end
20
21
 
@@ -86,6 +87,7 @@ module Bump
86
87
  return unless File.directory?(".git")
87
88
  system("git add --update Gemfile.lock") if options[:bundle]
88
89
  system("git add --update #{file} && git commit -m 'v#{version}'")
90
+ system("git tag -a -m 'Bump to v#{version}' v#{version}") if options[:tag]
89
91
  end
90
92
 
91
93
  def self.replace(file, old, new)
data/spec/bump_spec.rb CHANGED
@@ -63,6 +63,20 @@ describe Bump do
63
63
  `git log -1 --pretty=format:'%s'`.should == "initial"
64
64
  `git status`.should include "Untracked files:"
65
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
66
80
  end
67
81
 
68
82
  context ".version in gemspec" do
@@ -403,7 +417,8 @@ describe Bump do
403
417
  private
404
418
 
405
419
  def bump(command="", options={})
406
- run "#{File.expand_path("../../bin/bump", __FILE__)} #{command}", options
420
+ cmdline = "#{File.expand_path("../../bin/bump", __FILE__)} #{command}"
421
+ run cmdline, options
407
422
  end
408
423
 
409
424
  def write_gemspec(version = '"4.2.3"')
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.3
4
+ version: 0.5.0
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-09-25 00:00:00.000000000 Z
12
+ date: 2013-09-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake