bump 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/bump.gemspec +1 -1
- data/lib/bump.rb +6 -5
- data/spec/bump_spec.rb +15 -0
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/bump.gemspec
CHANGED
data/lib/bump.rb
CHANGED
@@ -5,9 +5,9 @@ module Bump
|
|
5
5
|
class UnfoundVersionFileError < StandardError; end
|
6
6
|
|
7
7
|
class Bump
|
8
|
-
BUMPS
|
9
|
-
PRERELEASE
|
10
|
-
OPTIONS
|
8
|
+
BUMPS = %w(major minor patch pre)
|
9
|
+
PRERELEASE = ["alpha","beta","rc",nil]
|
10
|
+
OPTIONS = BUMPS | ["current"]
|
11
11
|
VERSION_REGEX = /(\d+\.\d+\.\d+(?:-(?:#{PRERELEASE.compact.join('|')}))?)/
|
12
12
|
|
13
13
|
def self.defaults
|
@@ -84,8 +84,9 @@ module Bump
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def self.version_from_gemspec
|
87
|
-
return unless file
|
88
|
-
|
87
|
+
return unless file = find_version_file("*.gemspec")
|
88
|
+
version = File.read(file)[/\.version\s*=\s*["']#{VERSION_REGEX}["']/, 1]
|
89
|
+
return unless version = File.read(file)[/Gem::Specification.new.+ ["']#{VERSION_REGEX}["']/, 1] if version.nil?
|
89
90
|
[version, file]
|
90
91
|
end
|
91
92
|
|
data/spec/bump_spec.rb
CHANGED
@@ -104,6 +104,21 @@ describe Bump do
|
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
+
context ".version in gemspec within the initializer" do
|
108
|
+
before do
|
109
|
+
write gemspec, <<-RUBY.sub(" "*6, "")
|
110
|
+
Gem::Specification.new "bump", "4.2.3" do
|
111
|
+
end
|
112
|
+
RUBY
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should bump patch" do
|
116
|
+
bump("patch").should include("4.2.4")
|
117
|
+
read(gemspec).should include('"4.2.4"')
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
|
107
122
|
context "VERSION in version.rb" do
|
108
123
|
before do
|
109
124
|
write_version_rb
|
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.
|
4
|
+
version: 0.3.4
|
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-
|
12
|
+
date: 2012-10-27 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email: g.marcilhacy@gmail.com
|