versionomy 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +3 -2
- data/lib/versionomy/interface.rb +88 -0
- data/lib/versionomy/version.rb +1 -1
- metadata +4 -3
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
@@ -4,10 +4,11 @@ README.txt
|
|
4
4
|
Rakefile
|
5
5
|
lib/versionomy.rb
|
6
6
|
lib/versionomy/errors.rb
|
7
|
-
lib/versionomy/schema.rb
|
8
7
|
lib/versionomy/format.rb
|
9
|
-
lib/versionomy/
|
8
|
+
lib/versionomy/interface.rb
|
9
|
+
lib/versionomy/schema.rb
|
10
10
|
lib/versionomy/standard.rb
|
11
|
+
lib/versionomy/value.rb
|
11
12
|
lib/versionomy/version.rb
|
12
13
|
tests/tc_standard_basic.rb
|
13
14
|
tests/tc_standard_bump.rb
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Versionomy convenience interface
|
4
|
+
#
|
5
|
+
# -----------------------------------------------------------------------------
|
6
|
+
# Copyright 2008 Daniel Azuma
|
7
|
+
#
|
8
|
+
# All rights reserved.
|
9
|
+
#
|
10
|
+
# Redistribution and use in source and binary forms, with or without
|
11
|
+
# modification, are permitted provided that the following conditions are met:
|
12
|
+
#
|
13
|
+
# * Redistributions of source code must retain the above copyright notice,
|
14
|
+
# this list of conditions and the following disclaimer.
|
15
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
+
# this list of conditions and the following disclaimer in the documentation
|
17
|
+
# and/or other materials provided with the distribution.
|
18
|
+
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
+
# contributors to this software, may be used to endorse or promote products
|
20
|
+
# derived from this software without specific prior written permission.
|
21
|
+
#
|
22
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
# -----------------------------------------------------------------------------
|
34
|
+
;
|
35
|
+
|
36
|
+
|
37
|
+
# == Versionomy
|
38
|
+
#
|
39
|
+
# The Versionomy module contains some convenience methods for creating and
|
40
|
+
# parsing version numbers.
|
41
|
+
|
42
|
+
module Versionomy
|
43
|
+
|
44
|
+
@default_schema = Versionomy::Standard.schema
|
45
|
+
|
46
|
+
|
47
|
+
class << self
|
48
|
+
|
49
|
+
|
50
|
+
# Gets the current default schema. Usually this is Versionomy::Standard.schema.
|
51
|
+
|
52
|
+
def default_schema
|
53
|
+
@default_schema
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
# Sets the default schema. Usually this should be left as Versionomy::Standard.schema.
|
58
|
+
|
59
|
+
def default_schema=(schema_)
|
60
|
+
@default_schema = schema_
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
# Create a new version number given a hash or array of values, and an
|
65
|
+
# optional schema.
|
66
|
+
#
|
67
|
+
# The values should either be a hash of field names and values, or an array
|
68
|
+
# of values that will be interpreted in field order.
|
69
|
+
#
|
70
|
+
# If schema is omitted, the default_schema will be used.
|
71
|
+
|
72
|
+
def create(values_=nil, schema_=nil)
|
73
|
+
(schema_ || @default_schema).create(values_)
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
# Create a new version number given a string to parse, and optional parse
|
78
|
+
# parameters and schema.
|
79
|
+
#
|
80
|
+
# If schema is omitted, the default_schema will be used.
|
81
|
+
|
82
|
+
def parse(str_, params_={}, schema_=nil)
|
83
|
+
(schema_ || @default_schema).parse(str_, params_)
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
data/lib/versionomy/version.rb
CHANGED
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.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
@@ -50,10 +50,11 @@ files:
|
|
50
50
|
- Rakefile
|
51
51
|
- lib/versionomy.rb
|
52
52
|
- lib/versionomy/errors.rb
|
53
|
-
- lib/versionomy/schema.rb
|
54
53
|
- lib/versionomy/format.rb
|
55
|
-
- lib/versionomy/
|
54
|
+
- lib/versionomy/interface.rb
|
55
|
+
- lib/versionomy/schema.rb
|
56
56
|
- lib/versionomy/standard.rb
|
57
|
+
- lib/versionomy/value.rb
|
57
58
|
- lib/versionomy/version.rb
|
58
59
|
- tests/tc_standard_basic.rb
|
59
60
|
- tests/tc_standard_bump.rb
|