Skip to content

Commit

Permalink
Changes for 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dazuma committed Nov 8, 2009
1 parent cd764ee commit f840e5b
Show file tree
Hide file tree
Showing 16 changed files with 46 additions and 13 deletions.
6 changes: 6 additions & 0 deletions 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.
Expand Down
4 changes: 3 additions & 1 deletion README.rdoc
Expand Up @@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions lib/versionomy.rb
Expand Up @@ -34,12 +34,7 @@
;


begin
require 'blockenspiel'
rescue ::LoadError
require 'rubygems'
require 'blockenspiel'
end
require 'blockenspiel'


dir_ = ::File.expand_path('versionomy', ::File.dirname(__FILE__))
Expand Down
24 changes: 24 additions & 0 deletions lib/versionomy/interface.rb
Expand Up @@ -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
6 changes: 1 addition & 5 deletions lib/versionomy/version.rb
Expand Up @@ -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))
1 change: 1 addition & 0 deletions tests/tc_custom_format.rb
Expand Up @@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------


require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")

Expand Down
1 change: 1 addition & 0 deletions tests/tc_readme_examples.rb
Expand Up @@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------


require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")

Expand Down
1 change: 1 addition & 0 deletions tests/tc_rubygems_basic.rb
Expand Up @@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------


require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")

Expand Down
1 change: 1 addition & 0 deletions tests/tc_rubygems_conversions.rb
Expand Up @@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------


require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")

Expand Down
1 change: 1 addition & 0 deletions tests/tc_standard_basic.rb
Expand Up @@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------


require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")

Expand Down
1 change: 1 addition & 0 deletions tests/tc_standard_bump.rb
Expand Up @@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------


require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")

Expand Down
1 change: 1 addition & 0 deletions tests/tc_standard_change.rb
Expand Up @@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------


require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")

Expand Down
1 change: 1 addition & 0 deletions tests/tc_standard_comparison.rb
Expand Up @@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------


require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")

Expand Down
1 change: 1 addition & 0 deletions tests/tc_standard_misc.rb
Expand Up @@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------


require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")

Expand Down
1 change: 1 addition & 0 deletions tests/tc_standard_parse.rb
Expand Up @@ -35,6 +35,7 @@
# -----------------------------------------------------------------------------


require 'rubygems'
require 'test/unit'
require ::File.expand_path("#{::File.dirname(__FILE__)}/../lib/versionomy.rb")

Expand Down

0 comments on commit f840e5b

Please sign in to comment.