versionomy 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +31 -0
- data/README.rdoc +144 -0
- data/Rakefile +93 -12
- data/lib/versionomy/errors.rb +30 -11
- data/lib/versionomy/format/base.rb +96 -0
- data/lib/versionomy/format/delimiter.rb +951 -0
- data/lib/versionomy/format.rb +26 -112
- data/lib/versionomy/formats/standard.rb +346 -0
- data/lib/versionomy/formats.rb +79 -0
- data/lib/versionomy/interface.rb +23 -17
- data/lib/versionomy/schema/field.rb +500 -0
- data/lib/versionomy/schema/wrapper.rb +177 -0
- data/lib/versionomy/schema.rb +41 -500
- data/lib/versionomy/value.rb +129 -157
- data/lib/versionomy/version.rb +8 -8
- data/lib/versionomy.rb +25 -10
- data/tests/tc_custom_format.rb +66 -0
- data/tests/tc_readme_examples.rb +121 -0
- data/tests/tc_standard_basic.rb +17 -16
- data/tests/tc_standard_bump.rb +11 -10
- data/tests/tc_standard_change.rb +2 -1
- data/tests/tc_standard_comparison.rb +2 -1
- data/tests/tc_standard_parse.rb +41 -23
- metadata +28 -31
- data/History.txt +0 -21
- data/Manifest.txt +0 -17
- data/README.txt +0 -133
- data/lib/versionomy/standard.rb +0 -392
@@ -0,0 +1,121 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Versionomy tests of the README examples
|
4
|
+
#
|
5
|
+
# This file contains tests to ensure the README is valid
|
6
|
+
#
|
7
|
+
# -----------------------------------------------------------------------------
|
8
|
+
# Copyright 2008-2009 Daniel Azuma
|
9
|
+
#
|
10
|
+
# All rights reserved.
|
11
|
+
#
|
12
|
+
# Redistribution and use in source and binary forms, with or without
|
13
|
+
# modification, are permitted provided that the following conditions are met:
|
14
|
+
#
|
15
|
+
# * Redistributions of source code must retain the above copyright notice,
|
16
|
+
# this list of conditions and the following disclaimer.
|
17
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
18
|
+
# this list of conditions and the following disclaimer in the documentation
|
19
|
+
# and/or other materials provided with the distribution.
|
20
|
+
# * Neither the name of the copyright holder, nor the names of any other
|
21
|
+
# contributors to this software, may be used to endorse or promote products
|
22
|
+
# derived from this software without specific prior written permission.
|
23
|
+
#
|
24
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
25
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
26
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
27
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
28
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
29
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
30
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
31
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
32
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
33
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
34
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
35
|
+
# -----------------------------------------------------------------------------
|
36
|
+
|
37
|
+
|
38
|
+
require 'test/unit'
|
39
|
+
require File.expand_path("#{File.dirname(__FILE__)}/../lib/versionomy.rb")
|
40
|
+
|
41
|
+
|
42
|
+
module Versionomy
|
43
|
+
module Tests # :nodoc:
|
44
|
+
|
45
|
+
class TestReadmeExamples < Test::Unit::TestCase # :nodoc:
|
46
|
+
|
47
|
+
|
48
|
+
# Test the README file.
|
49
|
+
# This actually reads the README file and does some eval magic
|
50
|
+
# to run it and ensure it works the way it claims.
|
51
|
+
|
52
|
+
def test_readme_file
|
53
|
+
binding_ = _get_binding
|
54
|
+
File.open("#{File.dirname(__FILE__)}/../README.rdoc") do |io_|
|
55
|
+
running_ = false
|
56
|
+
buffer_ = ''
|
57
|
+
buffer_start_line_ = nil
|
58
|
+
io_.each_line do |line_|
|
59
|
+
|
60
|
+
# Run code in the "Some examples" section.
|
61
|
+
running_ = false if line_ =~ /^===/
|
62
|
+
running_ = true if line_ =~ /^=== Some examples/
|
63
|
+
next unless running_ && line_[0,1] == ' '
|
64
|
+
# Skip the require line
|
65
|
+
next if line_ =~ /^\s+require/
|
66
|
+
|
67
|
+
# If there isn't an expects clause, then collect the code into
|
68
|
+
# a buffer to run all at once, because it might be code that
|
69
|
+
# gets spread over multiple lines.
|
70
|
+
delim_index_ = line_.index(' # ')
|
71
|
+
unless delim_index_
|
72
|
+
buffer_start_line_ ||= io_.lineno
|
73
|
+
buffer_ << line_
|
74
|
+
next
|
75
|
+
end
|
76
|
+
|
77
|
+
# At this point, we have an expects clause. First run any buffer
|
78
|
+
# accumulated up to now.
|
79
|
+
if buffer_.length > 0
|
80
|
+
Kernel.eval(buffer_, binding_, 'README.rdoc', buffer_start_line_)
|
81
|
+
buffer_ = ''
|
82
|
+
buffer_start_line_ = nil
|
83
|
+
end
|
84
|
+
|
85
|
+
# Parse the line into an expression and an expectation
|
86
|
+
expr_ = line_[0,delim_index_]
|
87
|
+
expect_ = line_[delim_index_+3..-1]
|
88
|
+
|
89
|
+
if expect_ =~ /^=> (.*)$/
|
90
|
+
# Expect a value
|
91
|
+
expect_value_ = Kernel.eval($1, binding_, 'README.rdoc', io_.lineno)
|
92
|
+
actual_value_ = Kernel.eval(expr_, binding_, 'README.rdoc', io_.lineno)
|
93
|
+
assert_equal(expect_value_, actual_value_,
|
94
|
+
"Values did not match on line #{io_.lineno} of README.rdoc")
|
95
|
+
|
96
|
+
elsif expect_ =~ /^raises (.*)$/
|
97
|
+
# Expect an exception to be raised
|
98
|
+
expect_error_ = Kernel.eval($1, binding_, 'README.rdoc', io_.lineno)
|
99
|
+
got_error_ = false
|
100
|
+
assert_raise(expect_error_) do
|
101
|
+
Kernel.eval(expr_, binding_, 'README.rdoc', io_.lineno)
|
102
|
+
end
|
103
|
+
|
104
|
+
else
|
105
|
+
raise "Unknown expect syntax: #{expect_.inspect}"
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
def _get_binding
|
114
|
+
binding
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
end
|
data/tests/tc_standard_basic.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# This file contains tests for the basic use cases on the standard schema
|
6
6
|
#
|
7
7
|
# -----------------------------------------------------------------------------
|
8
|
-
# Copyright 2008 Daniel Azuma
|
8
|
+
# Copyright 2008-2009 Daniel Azuma
|
9
9
|
#
|
10
10
|
# All rights reserved.
|
11
11
|
#
|
@@ -35,6 +35,7 @@
|
|
35
35
|
# -----------------------------------------------------------------------------
|
36
36
|
|
37
37
|
|
38
|
+
require 'test/unit'
|
38
39
|
require File.expand_path("#{File.dirname(__FILE__)}/../lib/versionomy.rb")
|
39
40
|
|
40
41
|
|
@@ -52,7 +53,7 @@ module Versionomy
|
|
52
53
|
assert_equal(0, value_.minor)
|
53
54
|
assert_equal(0, value_.tiny)
|
54
55
|
assert_equal(0, value_.tiny2)
|
55
|
-
assert_equal(:
|
56
|
+
assert_equal(:final, value_.release_type)
|
56
57
|
assert_equal(0, value_.patchlevel)
|
57
58
|
assert_equal(0, value_.patchlevel_minor)
|
58
59
|
end
|
@@ -66,7 +67,7 @@ module Versionomy
|
|
66
67
|
assert_equal(0, value_.minor)
|
67
68
|
assert_equal(4, value_.tiny)
|
68
69
|
assert_equal(2, value_.tiny2)
|
69
|
-
assert_equal(:
|
70
|
+
assert_equal(:final, value_.release_type)
|
70
71
|
assert_equal(5, value_.patchlevel)
|
71
72
|
assert_equal(0, value_.patchlevel_minor)
|
72
73
|
assert_equal(false, value_.has_field?(:prerelase_version))
|
@@ -82,7 +83,7 @@ module Versionomy
|
|
82
83
|
assert_equal(3, value_.minor)
|
83
84
|
assert_equal(0, value_.tiny)
|
84
85
|
assert_equal(0, value_.tiny2)
|
85
|
-
assert_equal(:
|
86
|
+
assert_equal(:final, value_.release_type)
|
86
87
|
assert_equal(0, value_.patchlevel)
|
87
88
|
assert_equal(0, value_.patchlevel_minor)
|
88
89
|
assert_equal(false, value_.has_field?(:prerelase_version))
|
@@ -90,33 +91,33 @@ module Versionomy
|
|
90
91
|
end
|
91
92
|
|
92
93
|
|
93
|
-
# Test an arbitrary
|
94
|
+
# Test an arbitrary preview value.
|
94
95
|
|
95
|
-
def
|
96
|
-
value_ = Versionomy.create(:major => 2, :minor => 3, :release_type => :
|
96
|
+
def test_preview_value_1
|
97
|
+
value_ = Versionomy.create(:major => 2, :minor => 3, :release_type => :preview, :preview_version => 3)
|
97
98
|
assert_equal(2, value_.major)
|
98
99
|
assert_equal(3, value_.minor)
|
99
100
|
assert_equal(0, value_.tiny)
|
100
101
|
assert_equal(0, value_.tiny2)
|
101
|
-
assert_equal(:
|
102
|
-
assert_equal(3, value_.
|
103
|
-
assert_equal(0, value_.
|
102
|
+
assert_equal(:preview, value_.release_type)
|
103
|
+
assert_equal(3, value_.preview_version)
|
104
|
+
assert_equal(0, value_.preview_minor)
|
104
105
|
assert_equal(false, value_.has_field?(:patchlevel))
|
105
106
|
assert_equal(false, value_.has_field?(:patchlevel_minor))
|
106
107
|
end
|
107
108
|
|
108
109
|
|
109
|
-
# Test an arbitrary
|
110
|
+
# Test an arbitrary preview value.
|
110
111
|
|
111
|
-
def
|
112
|
-
value_ = Versionomy.create(:major => 2, :minor => 3, :release_type => :
|
112
|
+
def test_preview_value_2
|
113
|
+
value_ = Versionomy.create(:major => 2, :minor => 3, :release_type => :preview)
|
113
114
|
assert_equal(2, value_.major)
|
114
115
|
assert_equal(3, value_.minor)
|
115
116
|
assert_equal(0, value_.tiny)
|
116
117
|
assert_equal(0, value_.tiny2)
|
117
|
-
assert_equal(:
|
118
|
-
assert_equal(1, value_.
|
119
|
-
assert_equal(0, value_.
|
118
|
+
assert_equal(:preview, value_.release_type)
|
119
|
+
assert_equal(1, value_.preview_version)
|
120
|
+
assert_equal(0, value_.preview_minor)
|
120
121
|
assert_equal(false, value_.has_field?(:patchlevel))
|
121
122
|
assert_equal(false, value_.has_field?(:patchlevel_minor))
|
122
123
|
end
|
data/tests/tc_standard_bump.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# This file contains tests for the bump function on the standard schema
|
6
6
|
#
|
7
7
|
# -----------------------------------------------------------------------------
|
8
|
-
# Copyright 2008 Daniel Azuma
|
8
|
+
# Copyright 2008-2009 Daniel Azuma
|
9
9
|
#
|
10
10
|
# All rights reserved.
|
11
11
|
#
|
@@ -35,6 +35,7 @@
|
|
35
35
|
# -----------------------------------------------------------------------------
|
36
36
|
|
37
37
|
|
38
|
+
require 'test/unit'
|
38
39
|
require File.expand_path("#{File.dirname(__FILE__)}/../lib/versionomy.rb")
|
39
40
|
|
40
41
|
|
@@ -53,7 +54,7 @@ module Versionomy
|
|
53
54
|
assert_equal(0, value_.minor)
|
54
55
|
assert_equal(1, value_.tiny)
|
55
56
|
assert_equal(0, value_.tiny2)
|
56
|
-
assert_equal(:
|
57
|
+
assert_equal(:final, value_.release_type)
|
57
58
|
assert_equal(3, value_.patchlevel)
|
58
59
|
assert_equal(1, value_.patchlevel_minor)
|
59
60
|
end
|
@@ -68,22 +69,22 @@ module Versionomy
|
|
68
69
|
assert_equal(0, value_.minor)
|
69
70
|
assert_equal(1, value_.tiny)
|
70
71
|
assert_equal(0, value_.tiny2)
|
71
|
-
assert_equal(:
|
72
|
+
assert_equal(:final, value_.release_type)
|
72
73
|
assert_equal(4, value_.patchlevel)
|
73
74
|
assert_equal(0, value_.patchlevel_minor)
|
74
75
|
end
|
75
76
|
|
76
77
|
|
77
|
-
# Test bumping release type
|
78
|
+
# Test bumping release type preview.
|
78
79
|
|
79
|
-
def
|
80
|
-
value_ = Versionomy.create(:major => 2, :tiny => 1, :release_type => :
|
80
|
+
def test_bump_preview_to_release
|
81
|
+
value_ = Versionomy.create(:major => 2, :tiny => 1, :release_type => :preview)
|
81
82
|
value_ = value_.bump(:release_type)
|
82
83
|
assert_equal(2, value_.major)
|
83
84
|
assert_equal(0, value_.minor)
|
84
85
|
assert_equal(1, value_.tiny)
|
85
86
|
assert_equal(0, value_.tiny2)
|
86
|
-
assert_equal(:
|
87
|
+
assert_equal(:final, value_.release_type)
|
87
88
|
assert_equal(0, value_.patchlevel)
|
88
89
|
assert_equal(0, value_.patchlevel_minor)
|
89
90
|
end
|
@@ -128,7 +129,7 @@ module Versionomy
|
|
128
129
|
assert_equal(0, value_.minor)
|
129
130
|
assert_equal(1, value_.tiny)
|
130
131
|
assert_equal(0, value_.tiny2)
|
131
|
-
assert_equal(:
|
132
|
+
assert_equal(:final, value_.release_type)
|
132
133
|
assert_equal(0, value_.patchlevel)
|
133
134
|
assert_equal(0, value_.patchlevel_minor)
|
134
135
|
end
|
@@ -143,7 +144,7 @@ module Versionomy
|
|
143
144
|
assert_equal(0, value_.minor)
|
144
145
|
assert_equal(2, value_.tiny)
|
145
146
|
assert_equal(0, value_.tiny2)
|
146
|
-
assert_equal(:
|
147
|
+
assert_equal(:final, value_.release_type)
|
147
148
|
assert_equal(0, value_.patchlevel)
|
148
149
|
assert_equal(0, value_.patchlevel_minor)
|
149
150
|
end
|
@@ -158,7 +159,7 @@ module Versionomy
|
|
158
159
|
assert_equal(0, value_.minor)
|
159
160
|
assert_equal(0, value_.tiny)
|
160
161
|
assert_equal(0, value_.tiny2)
|
161
|
-
assert_equal(:
|
162
|
+
assert_equal(:final, value_.release_type)
|
162
163
|
assert_equal(0, value_.patchlevel)
|
163
164
|
assert_equal(0, value_.patchlevel_minor)
|
164
165
|
end
|
data/tests/tc_standard_change.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# This file contains tests for the change function on the standard schema
|
6
6
|
#
|
7
7
|
# -----------------------------------------------------------------------------
|
8
|
-
# Copyright 2008 Daniel Azuma
|
8
|
+
# Copyright 2008-2009 Daniel Azuma
|
9
9
|
#
|
10
10
|
# All rights reserved.
|
11
11
|
#
|
@@ -35,6 +35,7 @@
|
|
35
35
|
# -----------------------------------------------------------------------------
|
36
36
|
|
37
37
|
|
38
|
+
require 'test/unit'
|
38
39
|
require File.expand_path("#{File.dirname(__FILE__)}/../lib/versionomy.rb")
|
39
40
|
|
40
41
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# This file contains tests for comparisons on the standard schema
|
6
6
|
#
|
7
7
|
# -----------------------------------------------------------------------------
|
8
|
-
# Copyright 2008 Daniel Azuma
|
8
|
+
# Copyright 2008-2009 Daniel Azuma
|
9
9
|
#
|
10
10
|
# All rights reserved.
|
11
11
|
#
|
@@ -35,6 +35,7 @@
|
|
35
35
|
# -----------------------------------------------------------------------------
|
36
36
|
|
37
37
|
|
38
|
+
require 'test/unit'
|
38
39
|
require File.expand_path("#{File.dirname(__FILE__)}/../lib/versionomy.rb")
|
39
40
|
|
40
41
|
|
data/tests/tc_standard_parse.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# This file contains tests for parsing on the standard schema
|
6
6
|
#
|
7
7
|
# -----------------------------------------------------------------------------
|
8
|
-
# Copyright 2008 Daniel Azuma
|
8
|
+
# Copyright 2008-2009 Daniel Azuma
|
9
9
|
#
|
10
10
|
# All rights reserved.
|
11
11
|
#
|
@@ -35,6 +35,7 @@
|
|
35
35
|
# -----------------------------------------------------------------------------
|
36
36
|
|
37
37
|
|
38
|
+
require 'test/unit'
|
38
39
|
require File.expand_path("#{File.dirname(__FILE__)}/../lib/versionomy.rb")
|
39
40
|
|
40
41
|
|
@@ -52,7 +53,7 @@ module Versionomy
|
|
52
53
|
assert_equal(0, value_.minor)
|
53
54
|
assert_equal(1, value_.tiny)
|
54
55
|
assert_equal(1, value_.tiny2)
|
55
|
-
assert_equal(:
|
56
|
+
assert_equal(:final, value_.release_type)
|
56
57
|
assert_equal(4, value_.patchlevel)
|
57
58
|
assert_equal(6, value_.patchlevel_minor)
|
58
59
|
assert_equal('2.0.1.1-4.6', value_.unparse)
|
@@ -67,11 +68,11 @@ module Versionomy
|
|
67
68
|
assert_equal(0, value_.minor)
|
68
69
|
assert_equal(1, value_.tiny)
|
69
70
|
assert_equal(0, value_.tiny2)
|
70
|
-
assert_equal(:
|
71
|
+
assert_equal(:final, value_.release_type)
|
71
72
|
assert_equal(0, value_.patchlevel)
|
72
73
|
assert_equal(0, value_.patchlevel_minor)
|
73
|
-
assert_equal('2.0.1.0-0.0', value_.unparse(:required_fields =>
|
74
|
-
assert_equal('2.0.1-0', value_.unparse(:required_fields =>
|
74
|
+
assert_equal('2.0.1.0-0.0', value_.unparse(:required_fields => [:minor, :tiny, :tiny2, :patchlevel, :patchlevel_minor]))
|
75
|
+
assert_equal('2.0.1-0', value_.unparse(:required_fields => [:minor, :patchlevel]))
|
75
76
|
assert_equal('2.0.1', value_.unparse)
|
76
77
|
end
|
77
78
|
|
@@ -84,26 +85,26 @@ module Versionomy
|
|
84
85
|
assert_equal(0, value_.minor)
|
85
86
|
assert_equal(0, value_.tiny)
|
86
87
|
assert_equal(0, value_.tiny2)
|
87
|
-
assert_equal(:
|
88
|
+
assert_equal(:final, value_.release_type)
|
88
89
|
assert_equal(0, value_.patchlevel)
|
89
90
|
assert_equal(0, value_.patchlevel_minor)
|
90
91
|
assert_equal('2.0.0', value_.unparse)
|
91
92
|
end
|
92
93
|
|
93
94
|
|
94
|
-
# Test parsing
|
95
|
+
# Test parsing preview.
|
95
96
|
|
96
|
-
def
|
97
|
+
def test_parsing_preview
|
97
98
|
value_ = Versionomy.parse('2.0.1pre4')
|
98
99
|
assert_equal(2, value_.major)
|
99
100
|
assert_equal(0, value_.minor)
|
100
101
|
assert_equal(1, value_.tiny)
|
101
102
|
assert_equal(0, value_.tiny2)
|
102
|
-
assert_equal(:
|
103
|
-
assert_equal(4, value_.
|
104
|
-
assert_equal(0, value_.
|
103
|
+
assert_equal(:preview, value_.release_type)
|
104
|
+
assert_equal(4, value_.preview_version)
|
105
|
+
assert_equal(0, value_.preview_minor)
|
105
106
|
assert_equal('2.0.1pre4', value_.unparse)
|
106
|
-
assert_equal('2.0.1pre4.0', value_.unparse(:
|
107
|
+
assert_equal('2.0.1pre4.0', value_.unparse(:required_fields => [:preview_minor]))
|
107
108
|
end
|
108
109
|
|
109
110
|
|
@@ -119,7 +120,7 @@ module Versionomy
|
|
119
120
|
assert_equal(4, value_.alpha_version)
|
120
121
|
assert_equal(1, value_.alpha_minor)
|
121
122
|
assert_equal('2.0.1a4.1', value_.unparse)
|
122
|
-
assert_equal('2.0.1a4.1', value_.unparse(:
|
123
|
+
assert_equal('2.0.1a4.1', value_.unparse(:optional_fields => [:alpha_minor]))
|
123
124
|
end
|
124
125
|
|
125
126
|
|
@@ -135,7 +136,7 @@ module Versionomy
|
|
135
136
|
assert_equal(4, value_.beta_version)
|
136
137
|
assert_equal(0, value_.beta_minor)
|
137
138
|
assert_equal('2.52.1b4.0', value_.unparse)
|
138
|
-
assert_equal('2.52.1b4', value_.unparse(:
|
139
|
+
assert_equal('2.52.1b4', value_.unparse(:optional_fields => [:beta_minor]))
|
139
140
|
end
|
140
141
|
|
141
142
|
|
@@ -143,10 +144,12 @@ module Versionomy
|
|
143
144
|
|
144
145
|
def test_parsing_beta_alternates
|
145
146
|
assert_equal(Versionomy.parse('2.52.1 beta4'), '2.52.1b4')
|
147
|
+
assert_equal(Versionomy.parse('2.52.1-b4'), '2.52.1b4')
|
148
|
+
assert_equal(Versionomy.parse('2.52.1.b4'), '2.52.1b4')
|
146
149
|
assert_equal(Versionomy.parse('2.52.1B4'), '2.52.1b4')
|
147
150
|
assert_equal(Versionomy.parse('2.52.1BETA4'), '2.52.1b4')
|
148
151
|
assert_equal(Versionomy.parse('2.52.1 Beta4'), '2.52.1b4')
|
149
|
-
|
152
|
+
assert_equal(Versionomy.parse('2.52.1 eta4'), '2.52.1')
|
150
153
|
end
|
151
154
|
|
152
155
|
|
@@ -162,18 +165,33 @@ module Versionomy
|
|
162
165
|
assert_equal(0, value_.release_candidate_version)
|
163
166
|
assert_equal(0, value_.release_candidate_minor)
|
164
167
|
assert_equal('0.2rc0', value_.unparse)
|
165
|
-
assert_equal('0.2rc0.0', value_.unparse(:
|
166
|
-
assert_equal('0.2rc0', value_.unparse(:
|
168
|
+
assert_equal('0.2rc0.0', value_.unparse(:required_fields => [:release_candidate_minor]))
|
169
|
+
assert_equal('0.2rc0', value_.unparse(:optional_fields => [:release_candidate_version]))
|
167
170
|
end
|
168
171
|
|
169
172
|
|
170
|
-
# Test
|
173
|
+
# Test unparsing a value that requires lookback.
|
171
174
|
|
172
|
-
def
|
173
|
-
|
174
|
-
|
175
|
-
value2_
|
176
|
-
assert_equal(
|
175
|
+
def test_unparsing_with_lookback
|
176
|
+
value_ = Versionomy.parse('2.0')
|
177
|
+
value2_ = value_.change(:tiny2 => 1)
|
178
|
+
assert_equal(1, value2_.tiny2)
|
179
|
+
assert_equal('2.0.0.1', value2_.unparse)
|
180
|
+
value3_ = value2_.change(:tiny2 => 0)
|
181
|
+
assert_equal(0, value3_.tiny2)
|
182
|
+
assert_equal('2.0', value3_.unparse)
|
183
|
+
end
|
184
|
+
|
185
|
+
|
186
|
+
# Test delimiter changes in a multi-form field.
|
187
|
+
|
188
|
+
def test_multi_form_delimiter_changes
|
189
|
+
value_ = Versionomy.parse('2.0 preview 1')
|
190
|
+
assert_equal('2.0 preview 1', value_.to_s)
|
191
|
+
value2_ = value_.change(:release_type => :final)
|
192
|
+
assert_equal('2.0', value2_.to_s)
|
193
|
+
value3_ = value2_.change(:release_type => :preview, :preview_version => 1)
|
194
|
+
assert_equal('2.0 preview 1', value3_.to_s)
|
177
195
|
end
|
178
196
|
|
179
197
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: versionomy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-10-14 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,60 +20,55 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.
|
24
|
-
version:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: hoe
|
27
|
-
type: :development
|
28
|
-
version_requirement:
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.8.1
|
23
|
+
version: 0.2.1
|
34
24
|
version:
|
35
25
|
description: Versionomy is a generalized version number library. It provides tools to represent, manipulate, parse, and compare version numbers in the wide variety of versioning schemes in use.
|
36
|
-
email:
|
37
|
-
- dazuma@gmail.com
|
26
|
+
email: dazuma@gmail.com
|
38
27
|
executables: []
|
39
28
|
|
40
29
|
extensions: []
|
41
30
|
|
42
31
|
extra_rdoc_files:
|
43
|
-
-
|
44
|
-
-
|
45
|
-
- README.txt
|
32
|
+
- README.rdoc
|
33
|
+
- History.rdoc
|
46
34
|
files:
|
47
|
-
- History.txt
|
48
|
-
- Manifest.txt
|
49
|
-
- README.txt
|
50
|
-
- Rakefile
|
51
|
-
- lib/versionomy.rb
|
52
35
|
- lib/versionomy/errors.rb
|
36
|
+
- lib/versionomy/format/base.rb
|
37
|
+
- lib/versionomy/format/delimiter.rb
|
53
38
|
- lib/versionomy/format.rb
|
39
|
+
- lib/versionomy/formats/standard.rb
|
40
|
+
- lib/versionomy/formats.rb
|
54
41
|
- lib/versionomy/interface.rb
|
42
|
+
- lib/versionomy/schema/field.rb
|
43
|
+
- lib/versionomy/schema/wrapper.rb
|
55
44
|
- lib/versionomy/schema.rb
|
56
|
-
- lib/versionomy/standard.rb
|
57
45
|
- lib/versionomy/value.rb
|
58
46
|
- lib/versionomy/version.rb
|
47
|
+
- lib/versionomy.rb
|
48
|
+
- tests/tc_custom_format.rb
|
49
|
+
- tests/tc_readme_examples.rb
|
59
50
|
- tests/tc_standard_basic.rb
|
60
51
|
- tests/tc_standard_bump.rb
|
61
52
|
- tests/tc_standard_change.rb
|
62
53
|
- tests/tc_standard_comparison.rb
|
63
54
|
- tests/tc_standard_parse.rb
|
55
|
+
- History.rdoc
|
56
|
+
- README.rdoc
|
57
|
+
- Rakefile
|
64
58
|
has_rdoc: true
|
65
59
|
homepage: http://virtuoso.rubyforge.org/versionomy
|
60
|
+
licenses: []
|
61
|
+
|
66
62
|
post_install_message:
|
67
|
-
rdoc_options:
|
68
|
-
|
69
|
-
- README.txt
|
63
|
+
rdoc_options: []
|
64
|
+
|
70
65
|
require_paths:
|
71
66
|
- lib
|
72
67
|
required_ruby_version: !ruby/object:Gem::Requirement
|
73
68
|
requirements:
|
74
69
|
- - ">="
|
75
70
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
71
|
+
version: 1.8.6
|
77
72
|
version:
|
78
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
74
|
requirements:
|
@@ -84,11 +79,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
79
|
requirements: []
|
85
80
|
|
86
81
|
rubyforge_project: virtuoso
|
87
|
-
rubygems_version: 1.3.
|
82
|
+
rubygems_version: 1.3.5
|
88
83
|
signing_key:
|
89
|
-
specification_version:
|
90
|
-
summary: Versionomy is a generalized version number library
|
84
|
+
specification_version: 3
|
85
|
+
summary: Versionomy is a generalized version number library.
|
91
86
|
test_files:
|
87
|
+
- tests/tc_custom_format.rb
|
88
|
+
- tests/tc_readme_examples.rb
|
92
89
|
- tests/tc_standard_basic.rb
|
93
90
|
- tests/tc_standard_bump.rb
|
94
91
|
- tests/tc_standard_change.rb
|
data/History.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
=== 0.0.4 / 2008-10-24
|
2
|
-
|
3
|
-
* Fixed incompatibility with Blockenspiel 0.0.4
|
4
|
-
* Fixed a number of issues with remembering value parse settings
|
5
|
-
* Parser recognizes additional release type formats
|
6
|
-
* Values have a parse method to parse another string in the same form
|
7
|
-
* Implemented comparison between value and string
|
8
|
-
* Exceptions correctly raised on comparison between incompatible types
|
9
|
-
|
10
|
-
=== 0.0.3 / 2008-10-21
|
11
|
-
|
12
|
-
* Fixed string representations (inspect method)
|
13
|
-
* Fixed up equality and hash computation for version values
|
14
|
-
|
15
|
-
=== 0.0.2 / 2008-10-20
|
16
|
-
|
17
|
-
* Fixed manifest
|
18
|
-
|
19
|
-
=== 0.0.1 / 2008-10-20
|
20
|
-
|
21
|
-
* Initial test release
|
data/Manifest.txt
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
History.txt
|
2
|
-
Manifest.txt
|
3
|
-
README.txt
|
4
|
-
Rakefile
|
5
|
-
lib/versionomy.rb
|
6
|
-
lib/versionomy/errors.rb
|
7
|
-
lib/versionomy/format.rb
|
8
|
-
lib/versionomy/interface.rb
|
9
|
-
lib/versionomy/schema.rb
|
10
|
-
lib/versionomy/standard.rb
|
11
|
-
lib/versionomy/value.rb
|
12
|
-
lib/versionomy/version.rb
|
13
|
-
tests/tc_standard_basic.rb
|
14
|
-
tests/tc_standard_bump.rb
|
15
|
-
tests/tc_standard_change.rb
|
16
|
-
tests/tc_standard_comparison.rb
|
17
|
-
tests/tc_standard_parse.rb
|