versionomy 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc CHANGED
@@ -1,3 +1,9 @@
1
+ === 0.2.1 / 2009-11-08
2
+
3
+ * Added Versionomy#version_of.
4
+ * Now lets Blockenspiel set its own VERSION instead of reaching into
5
+ Blockenspiel's namespace.
6
+
1
7
  === 0.2.0 / 2009-11-05
2
8
 
3
9
  * API CHANGE: Slight change to value comparison semantics. Value#eql? returns true only if the schemas are the same, whereas Value#== and the greater than and less than comparisons attempt to compare the semantic value, and thus may perform automatic schema conversion on the RHS.
data/README.rdoc CHANGED
@@ -138,7 +138,7 @@ provides a schema and formatter/parser matching Gem::Version.
138
138
 
139
139
  * Ruby 1.8.6 or later (1.8.7 recommended), Ruby 1.9.1 or later, or JRuby
140
140
  1.4 or later.
141
- * blockenspiel 0.3 or later.
141
+ * blockenspiel 0.3.1 or later.
142
142
 
143
143
  === Installation
144
144
 
@@ -149,6 +149,8 @@ provides a schema and formatter/parser matching Gem::Version.
149
149
  * Test coverage is still a little skimpy. It is focused on the "standard"
150
150
  version number format and schema, but doesn't fully exercise all the
151
151
  capabilities of custom formats.
152
+ * The standard format parser requires that "prerelease" versions have a
153
+ prerelease number. e.g. it accepts "1.9.2dev1" but not "1.9.2dev".
152
154
 
153
155
  === Development and support
154
156
 
data/Rakefile CHANGED
@@ -89,7 +89,7 @@ gemspec_ = Gem::Specification.new do |s_|
89
89
  s_.has_rdoc = true
90
90
  s_.test_files = FileList['tests/tc_*.rb']
91
91
  s_.platform = Gem::Platform::RUBY
92
- s_.add_dependency('blockenspiel', '>= 0.3.0')
92
+ s_.add_dependency('blockenspiel', '>= 0.3.1')
93
93
  end
94
94
  Rake::GemPackageTask.new(gemspec_) do |task_|
95
95
  task_.need_zip = false
@@ -130,6 +130,30 @@ module Versionomy
130
130
  format_.parse(str_, parse_params_)
131
131
  end
132
132
 
133
+
134
+ # Get the version of the given module as a Versionomy::Value.
135
+ # Attempts to find the version by querying the constants VERSION and
136
+ # VERSION_STRING. If a string is found, an attempt is made to parse it.
137
+ # Returns the version number, or nil if it wasn't found or wasn't
138
+ # parseable.
139
+
140
+ def version_of(mod_)
141
+ if mod_.const_defined?(:VERSION)
142
+ version_ = mod_.const_get(:VERSION)
143
+ elsif mod_.const_defined?(:VERSION_STRING)
144
+ version_ = mod_.const_get(:VERSION_STRING)
145
+ else
146
+ version_ = nil
147
+ end
148
+ if version_.kind_of?(::String)
149
+ version_ = parse(version_, :standard) rescue nil
150
+ elsif !version_.kind_of?(Value)
151
+ version_ = nil
152
+ end
153
+ version_
154
+ end
155
+
156
+
133
157
  end
134
158
 
135
159
  end
@@ -37,13 +37,9 @@
37
37
  module Versionomy
38
38
 
39
39
  # Current gem version, as a frozen string.
40
- VERSION_STRING = '0.2.0'.freeze
40
+ VERSION_STRING = '0.2.1'.freeze
41
41
 
42
42
  # Current gem version, as a Versionomy::Value.
43
43
  VERSION = ::Versionomy.parse(VERSION_STRING, :standard)
44
44
 
45
45
  end
46
-
47
-
48
- ::Blockenspiel.const_set(:VERSION,
49
- ::Versionomy.parse(::Blockenspiel::VERSION_STRING, :standard))
data/lib/versionomy.rb CHANGED
@@ -34,12 +34,7 @@
34
34
  ;
35
35
 
36
36
 
37
- begin
38
- require 'blockenspiel'
39
- rescue ::LoadError
40
- require 'rubygems'
41
- require 'blockenspiel'
42
- end
37
+ require 'blockenspiel'
43
38
 
44
39
 
45
40
  dir_ = ::File.expand_path('versionomy', ::File.dirname(__FILE__))
@@ -35,6 +35,7 @@
35
35
  # -----------------------------------------------------------------------------
36
36
 
37
37
 
38
+ require 'rubygems'
38
39
  require 'test/unit'
39
40
  require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
40
41
 
@@ -35,6 +35,7 @@
35
35
  # -----------------------------------------------------------------------------
36
36
 
37
37
 
38
+ require 'rubygems'
38
39
  require 'test/unit'
39
40
  require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
40
41
 
@@ -35,6 +35,7 @@
35
35
  # -----------------------------------------------------------------------------
36
36
 
37
37
 
38
+ require 'rubygems'
38
39
  require 'test/unit'
39
40
  require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
40
41
 
@@ -35,6 +35,7 @@
35
35
  # -----------------------------------------------------------------------------
36
36
 
37
37
 
38
+ require 'rubygems'
38
39
  require 'test/unit'
39
40
  require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
40
41
 
@@ -35,6 +35,7 @@
35
35
  # -----------------------------------------------------------------------------
36
36
 
37
37
 
38
+ require 'rubygems'
38
39
  require 'test/unit'
39
40
  require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
40
41
 
@@ -35,6 +35,7 @@
35
35
  # -----------------------------------------------------------------------------
36
36
 
37
37
 
38
+ require 'rubygems'
38
39
  require 'test/unit'
39
40
  require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
40
41
 
@@ -35,6 +35,7 @@
35
35
  # -----------------------------------------------------------------------------
36
36
 
37
37
 
38
+ require 'rubygems'
38
39
  require 'test/unit'
39
40
  require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
40
41
 
@@ -35,6 +35,7 @@
35
35
  # -----------------------------------------------------------------------------
36
36
 
37
37
 
38
+ require 'rubygems'
38
39
  require 'test/unit'
39
40
  require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
40
41
 
@@ -35,6 +35,7 @@
35
35
  # -----------------------------------------------------------------------------
36
36
 
37
37
 
38
+ require 'rubygems'
38
39
  require 'test/unit'
39
40
  require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
40
41
 
@@ -35,6 +35,7 @@
35
35
  # -----------------------------------------------------------------------------
36
36
 
37
37
 
38
+ require 'rubygems'
38
39
  require 'test/unit'
39
40
  require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
40
41
 
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.2.0
4
+ version: 0.2.1
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: 2009-11-05 00:00:00 -08:00
12
+ date: 2009-11-08 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.3.0
23
+ version: 0.3.1
24
24
  version:
25
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.
26
26
  email: dazuma@gmail.com