Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changes for 0.2.1

  • Loading branch information...
commit f840e5b454dca7ec6d3929d2296396215e04b327 1 parent cd764ee
@dazuma authored
View
6 History.rdoc
@@ -1,3 +1,9 @@
+=== 0.2.1 / 2009-11-08
+
+* Added Versionomy#version_of.
+* Now lets Blockenspiel set its own VERSION instead of reaching into
+ Blockenspiel's namespace.
+
=== 0.2.0 / 2009-11-05
* 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.
View
4 README.rdoc
@@ -138,7 +138,7 @@ provides a schema and formatter/parser matching Gem::Version.
* Ruby 1.8.6 or later (1.8.7 recommended), Ruby 1.9.1 or later, or JRuby
1.4 or later.
-* blockenspiel 0.3 or later.
+* blockenspiel 0.3.1 or later.
=== Installation
@@ -149,6 +149,8 @@ provides a schema and formatter/parser matching Gem::Version.
* Test coverage is still a little skimpy. It is focused on the "standard"
version number format and schema, but doesn't fully exercise all the
capabilities of custom formats.
+* The standard format parser requires that "prerelease" versions have a
+ prerelease number. e.g. it accepts "1.9.2dev1" but not "1.9.2dev".
=== Development and support
View
2  Rakefile
@@ -89,7 +89,7 @@ gemspec_ = Gem::Specification.new do |s_|
s_.has_rdoc = true
s_.test_files = FileList['tests/tc_*.rb']
s_.platform = Gem::Platform::RUBY
- s_.add_dependency('blockenspiel', '>= 0.3.0')
+ s_.add_dependency('blockenspiel', '>= 0.3.1')
end
Rake::GemPackageTask.new(gemspec_) do |task_|
task_.need_zip = false
View
7 lib/versionomy.rb
@@ -34,12 +34,7 @@
;
-begin
- require 'blockenspiel'
-rescue ::LoadError
- require 'rubygems'
- require 'blockenspiel'
-end
+require 'blockenspiel'
dir_ = ::File.expand_path('versionomy', ::File.dirname(__FILE__))
View
24 lib/versionomy/interface.rb
@@ -130,6 +130,30 @@ def parse(str_, format_=nil, parse_params_=nil)
format_.parse(str_, parse_params_)
end
+
+ # Get the version of the given module as a Versionomy::Value.
+ # Attempts to find the version by querying the constants VERSION and
+ # VERSION_STRING. If a string is found, an attempt is made to parse it.
+ # Returns the version number, or nil if it wasn't found or wasn't
+ # parseable.
+
+ def version_of(mod_)
+ if mod_.const_defined?(:VERSION)
+ version_ = mod_.const_get(:VERSION)
+ elsif mod_.const_defined?(:VERSION_STRING)
+ version_ = mod_.const_get(:VERSION_STRING)
+ else
+ version_ = nil
+ end
+ if version_.kind_of?(::String)
+ version_ = parse(version_, :standard) rescue nil
+ elsif !version_.kind_of?(Value)
+ version_ = nil
+ end
+ version_
+ end
+
+
end
end
View
6 lib/versionomy/version.rb
@@ -37,13 +37,9 @@
module Versionomy
# Current gem version, as a frozen string.
- VERSION_STRING = '0.2.0'.freeze
+ VERSION_STRING = '0.2.1'.freeze
# Current gem version, as a Versionomy::Value.
VERSION = ::Versionomy.parse(VERSION_STRING, :standard)
end
-
-
-::Blockenspiel.const_set(:VERSION,
- ::Versionomy.parse(::Blockenspiel::VERSION_STRING, :standard))
View
1  tests/tc_custom_format.rb
@@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------
+require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
View
1  tests/tc_readme_examples.rb
@@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------
+require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
View
1  tests/tc_rubygems_basic.rb
@@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------
+require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
View
1  tests/tc_rubygems_conversions.rb
@@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------
+require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
View
1  tests/tc_standard_basic.rb
@@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------
+require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
View
1  tests/tc_standard_bump.rb
@@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------
+require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
View
1  tests/tc_standard_change.rb
@@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------
+require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
View
1  tests/tc_standard_comparison.rb
@@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------
+require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
View
1  tests/tc_standard_misc.rb
@@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------
+require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
View
1  tests/tc_standard_parse.rb
@@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------
+require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")
Please sign in to comment.
Something went wrong with that request. Please try again.