hoe-version 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/Rakefile +2 -0
- data/lib/hoe/version.rb +3 -1
- data/test/test_hoe_version.rb +14 -4
- metadata +1 -1
data/History.txt
CHANGED
data/Rakefile
CHANGED
data/lib/hoe/version.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
# version:bump:patch:: Writes out version, bumping to next patch level release.
|
11
11
|
#
|
12
12
|
module Hoe::Version
|
13
|
-
VERSION = '1.
|
13
|
+
VERSION = '1.2.0'
|
14
14
|
|
15
15
|
def define_version_tasks
|
16
16
|
desc 'print current version'
|
@@ -76,6 +76,8 @@ module Hoe::Version
|
|
76
76
|
if data and data[version_re, 2] &&= vers
|
77
77
|
#File.write(file, data)
|
78
78
|
File.open(file, 'w'){|f| f.write data}
|
79
|
+
# tell hoe about the new version
|
80
|
+
spec.version = self.version = vers.dup
|
79
81
|
return true
|
80
82
|
end
|
81
83
|
end
|
data/test/test_hoe_version.rb
CHANGED
@@ -8,12 +8,16 @@ class TestHoe; end
|
|
8
8
|
class TestHoe::TestVersion < MiniTest::Unit::TestCase
|
9
9
|
include Hoe::Version
|
10
10
|
|
11
|
+
attr_accessor :version
|
12
|
+
|
11
13
|
def setup
|
12
14
|
@version = '1.1.1'
|
13
15
|
@files = []
|
14
|
-
@spec =
|
15
|
-
@spec.
|
16
|
+
@spec = Gem::Specification.new
|
17
|
+
@spec.files = @files
|
18
|
+
ENV.delete 'VERSION'
|
16
19
|
end
|
20
|
+
def spec() @spec end
|
17
21
|
|
18
22
|
def test_increment_minor
|
19
23
|
v = increment [0,1,nil]
|
@@ -30,6 +34,11 @@ class TestHoe::TestVersion < MiniTest::Unit::TestCase
|
|
30
34
|
assert_equal '1.1.2', v
|
31
35
|
end
|
32
36
|
|
37
|
+
def test_override_increment
|
38
|
+
ENV['VERSION'] = '4.5.6'
|
39
|
+
refute increment [1,2,3]
|
40
|
+
end
|
41
|
+
|
33
42
|
def test_update_version
|
34
43
|
expected = ["def nothing() 'No version here' end\n",
|
35
44
|
"class Blah\n VERSION = '1.1.1'\nend\n"]
|
@@ -40,6 +49,9 @@ class TestHoe::TestVersion < MiniTest::Unit::TestCase
|
|
40
49
|
assert_equal expected[0], File.read(@files[0])
|
41
50
|
expected[1].gsub! '1.1.1', '3.2.1'
|
42
51
|
assert_equal expected[1], File.read(@files[1])
|
52
|
+
|
53
|
+
assert_equal '3.2.1', version
|
54
|
+
assert_equal '3.2.1', spec.version.version
|
43
55
|
end
|
44
56
|
end
|
45
57
|
|
@@ -62,6 +74,4 @@ class TestHoe::TestVersion < MiniTest::Unit::TestCase
|
|
62
74
|
end
|
63
75
|
end
|
64
76
|
|
65
|
-
def spec() @spec end
|
66
|
-
def version() @version end
|
67
77
|
end
|