semver_bump 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/semver-bump +24 -0
- data/lib/semver_bump.rb +4 -0
- data/lib/semver_bump/semver.rb +10 -2
- data/lib/semver_bump/version.rb +1 -1
- data/lib/semver_bump/version_file.rb +1 -1
- metadata +6 -4
data/bin/semver-bump
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
lib = File.expand_path('../../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
|
6
|
+
require 'semver_bump'
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
bump = SemverBump::Bump.new
|
11
|
+
command = ARGV[0]
|
12
|
+
|
13
|
+
|
14
|
+
if !command || command == 'current'
|
15
|
+
puts "#{bump.current}"
|
16
|
+
elsif !bump.respond_to?(command)
|
17
|
+
puts "Don't know how to bump '#{command}'!"
|
18
|
+
else
|
19
|
+
current = bump.current
|
20
|
+
updated = bump.send(command)
|
21
|
+
puts "Bumped from #{current} to #{updated}"
|
22
|
+
end
|
23
|
+
|
24
|
+
|
data/lib/semver_bump.rb
CHANGED
data/lib/semver_bump/semver.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module SemverBump
|
2
2
|
class SemVer
|
3
3
|
|
4
|
-
MATCHER = /^(\d+)\.(\d+)\.(\d+)
|
4
|
+
MATCHER = /^(\d+)\.(\d+)\.(\d+)\.?([0-9A-Za-z]*)$/
|
5
5
|
PARTS = [:major, :minor, :patch, :pre]
|
6
6
|
attr_accessor *(PARTS << :pre_raw)
|
7
7
|
|
@@ -40,7 +40,7 @@ module SemverBump
|
|
40
40
|
@pre_s
|
41
41
|
end
|
42
42
|
|
43
|
-
(PARTS - [:pre]).each do |name|
|
43
|
+
(PARTS - [:pre,:minor]).each do |name|
|
44
44
|
define_method(:"bump_#{name.to_s}") do
|
45
45
|
send(:"#{name.to_s}=",(send(:"#{name.to_s}")+1))
|
46
46
|
PARTS[PARTS.index(name)+1..4].each do |name|
|
@@ -50,6 +50,14 @@ module SemverBump
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
def bump_patch
|
54
|
+
if pre && pre > 0
|
55
|
+
send(:pre=,0)
|
56
|
+
else
|
57
|
+
send(:patch=,(send(:patch)+1))
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
53
61
|
def bump_pre
|
54
62
|
if !pre || pre == 0
|
55
63
|
bump_patch
|
data/lib/semver_bump/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semver_bump
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -46,7 +46,8 @@ dependencies:
|
|
46
46
|
description: Little utility for bumping version numbers
|
47
47
|
email:
|
48
48
|
- daniel.luxemburg@gmail.com
|
49
|
-
executables:
|
49
|
+
executables:
|
50
|
+
- semver-bump
|
50
51
|
extensions: []
|
51
52
|
extra_rdoc_files: []
|
52
53
|
files:
|
@@ -55,6 +56,7 @@ files:
|
|
55
56
|
- LICENSE.txt
|
56
57
|
- README.md
|
57
58
|
- Rakefile
|
59
|
+
- bin/semver-bump
|
58
60
|
- lib/semver_bump.rb
|
59
61
|
- lib/semver_bump/find.rb
|
60
62
|
- lib/semver_bump/semver.rb
|
@@ -77,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
79
|
version: '0'
|
78
80
|
segments:
|
79
81
|
- 0
|
80
|
-
hash:
|
82
|
+
hash: 1797775827887834252
|
81
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
84
|
none: false
|
83
85
|
requirements:
|
@@ -86,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
88
|
version: '0'
|
87
89
|
segments:
|
88
90
|
- 0
|
89
|
-
hash:
|
91
|
+
hash: 1797775827887834252
|
90
92
|
requirements: []
|
91
93
|
rubyforge_project:
|
92
94
|
rubygems_version: 1.8.24
|