Permalink
Browse files

Updates for psych

  • Loading branch information...
1 parent 025d70e commit 06ae4f54b1e41b2b833e7f16f93459593cfdba30 @dazuma committed Feb 17, 2012
View
@@ -1,3 +1,7 @@
+=== 0.4.2 / 2012-02-17
+
+* Support psych interface for YAML serialization.
+
=== 0.4.1 / 2011-04-26
* Support underscore "_" as a delimiter.
View
@@ -1,15 +1,15 @@
# -----------------------------------------------------------------------------
-#
-# Versionomy Rakefile
-#
+#
+# Generic Gem Rakefile
+#
# -----------------------------------------------------------------------------
-# Copyright 2008-2009 Daniel Azuma
-#
+# Copyright 2010-2012 Daniel Azuma
+#
# All rights reserved.
-#
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
-#
+#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
@@ -18,7 +18,7 @@
# * Neither the name of the copyright holder, nor the names of any other
# contributors to this software, may be used to endorse or promote products
# derived from this software without specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -31,21 +31,27 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
+;
+
+
+# Load config if present
+
+config_path_ = ::File.expand_path('rakefile_config.rb', ::File.dirname(__FILE__))
+load(config_path_) if ::File.exists?(config_path_)
+RAKEFILE_CONFIG = {} unless defined?(::RAKEFILE_CONFIG)
# Gemspec
require 'rubygems'
-gemspec_file_ = ::File.read(::Dir.glob('*.gemspec').first)
-gemspec_ = eval(gemspec_file_)
-release_gemspec_ = eval(gemspec_file_)
+gemspec_ = eval(::File.read(::Dir.glob('*.gemspec').first))
+release_gemspec_ = eval(::File.read(::Dir.glob('*.gemspec').first))
release_gemspec_.version = gemspec_.version.to_s.sub(/\.build\d+$/, '')
-::RAKEFILE_CONFIG = {} unless defined?(::RAKEFILE_CONFIG)
# Platform info
-dlext_ = ::Config::CONFIG['DLEXT']
+dlext_ = ::RbConfig::CONFIG['DLEXT']
platform_ =
case ::RUBY_DESCRIPTION
@@ -142,9 +148,9 @@ end
clean_files_ = [doc_directory_, pkg_directory_, tmp_directory_] +
::Dir.glob('ext/**/Makefile*') +
::Dir.glob('ext/**/*.{o,class,log,dSYM}') +
- ::Dir.glob("**/*.{#{dlext_},rbc,jar}") +
+ ::Dir.glob("**/*.{bundle,so,dll,rbc,jar}") +
(::RAKEFILE_CONFIG[:extra_clean_files] || [])
-task :clean do
+task :clean do
clean_files_.each{ |path_| rm_rf path_ }
end
@@ -179,13 +185,15 @@ end
# Gem release tasks
-task :build_gem do
+task :build_other
+
+task :build_gem => :build_other do
::Gem::Builder.new(gemspec_).build
mkdir_p(pkg_directory_)
mv "#{gemspec_.name}-#{gemspec_.version}.gem", "#{pkg_directory_}/"
end
-task :build_release do
+task :build_release => :build_other do
::Gem::Builder.new(release_gemspec_).build
mkdir_p(pkg_directory_)
mv "#{release_gemspec_.name}-#{release_gemspec_.version}.gem", "#{pkg_directory_}/"
@@ -200,7 +208,7 @@ end
# Unit test task
-task :test => :build_ext do
+task :test => [:build_ext, :build_other] do
$:.unshift(::File.expand_path('lib', ::File.dirname(__FILE__)))
if ::ENV['TESTCASE']
test_files_ = ::Dir.glob("test/#{::ENV['TESTCASE']}.rb")
View
@@ -1 +1 @@
-0.4.1
+0.4.2
View
@@ -1,15 +1,15 @@
# -----------------------------------------------------------------------------
-#
+#
# Versionomy entry point
-#
+#
# -----------------------------------------------------------------------------
# Copyright 2008-2009 Daniel Azuma
-#
+#
# All rights reserved.
-#
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
-#
+#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
@@ -18,7 +18,7 @@
# * Neither the name of the copyright holder, nor the names of any other
# contributors to this software, may be used to endorse or promote products
# derived from this software without specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -36,22 +36,16 @@
require 'blockenspiel'
-
-dir_ = ::File.expand_path('versionomy', ::File.dirname(__FILE__))
-
-includes_ = [
- 'errors',
- 'schema',
- 'schema/field',
- 'schema/wrapper',
- 'format',
- 'format/base',
- 'format/delimiter',
- 'value',
- 'conversion',
- 'conversion/base',
- 'conversion/parsing',
- 'interface',
- 'version',
-]
-includes_.each{ |file_| require "#{dir_}/#{file_}" }
+require 'versionomy/errors'
+require 'versionomy/schema'
+require 'versionomy/schema/field'
+require 'versionomy/schema/wrapper'
+require 'versionomy/format'
+require 'versionomy/format/base'
+require 'versionomy/format/delimiter'
+require 'versionomy/value'
+require 'versionomy/conversion'
+require 'versionomy/conversion/base'
+require 'versionomy/conversion/parsing'
+require 'versionomy/interface'
+require 'versionomy/version'
@@ -1,15 +1,15 @@
# -----------------------------------------------------------------------------
-#
+#
# Versionomy conversion interface and registry
-#
+#
# -----------------------------------------------------------------------------
# Copyright 2008-2009 Daniel Azuma
-#
+#
# All rights reserved.
-#
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
-#
+#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
@@ -18,7 +18,7 @@
# * Neither the name of the copyright holder, nor the names of any other
# contributors to this software, may be used to endorse or promote products
# derived from this software without specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -38,14 +38,14 @@
module Versionomy
-
-
+
+
# === Conversion between version schemas.
- #
+ #
# Conversions are algorithms for converting from one schema to another.
# This is useful for performing conversions as well as comparing version
# numbers that use different schemas.
- #
+ #
# To implement a conversion algorithm, implement the API defined by
# Versionomy::Conversion::Base. Then, register your conversion by calling
# Versionomy::Conversion#register. You will need to specify which schemas
@@ -54,49 +54,49 @@ module Versionomy
# it will use your conversion. You can register the same conversion object
# for multiple pairs of schemas, but you can register only one conversion
# object for any pair.
- #
+ #
# A common technique for doing conversions is to unparse the version to a
# string, and then parse it in the new format. Versionomy provides a tool,
# Versionomy::Conversion::Parsing, for performing such conversions. The
# conversions between the standard and rubygems formats uses this tool.
# See Versionomy::Conversion::Rubygems for annotated examples.
-
+
module Conversion
-
+
@registry = {}
@mutex = ::Mutex.new
-
+
class << self
-
-
+
+
# Convert the given value to the given format. This is identical to
# calling <tt>value_.convert(format_, convert_params_)</tt>.
- #
+ #
# The format may be specified as a format object or as the name of a
# format in the Format registry.
- #
+ #
# Raises Versionomy::Errors::ConversionError if the value could not
# be converted.
-
+
def convert(value_, format_, convert_params_=nil)
value_.convert(format_, convert_params_)
end
-
-
+
+
# Get a conversion capable of converting between the given schemas.
- #
+ #
# The schemas may be specified as format names, Format objects,
# schema wrapper objects, or the root field of the schema.
- #
+ #
# If strict is set to false, returns nil if no such conversion could
# be found. If strict is set to true, may raise one of these errors:
- #
+ #
# Raises Versionomy::Errors::UnknownFormatError if a format was
# specified by name but the name is not known.
- #
+ #
# Raises Versionomy::Errors::UnknownConversionError if the formats
# were recognized but no conversion was found to handle them.
-
+
def get(from_schema_, to_schema_, strict_=false)
key_ = _get_key(from_schema_, to_schema_)
conversion_ = @mutex.synchronize{ @registry[key_] }
@@ -105,19 +105,19 @@ def get(from_schema_, to_schema_, strict_=false)
end
conversion_
end
-
-
+
+
# Register the given conversion as the handler for the given schemas.
- #
+ #
# The schemas may be specified as format names, Format objects,
# schema wrapper objects, or the root field of the schema.
- #
+ #
# Raises Versionomy::Errors::ConversionRedefinedError if a conversion
# has already been registered for the given schemas.
- #
+ #
# Raises Versionomy::Errors::UnknownFormatError if a format was
# specified by name but the name is not known.
-
+
def register(from_schema_, to_schema_, conversion_, silent_=false)
key_ = _get_key(from_schema_, to_schema_)
@mutex.synchronize do
@@ -130,25 +130,25 @@ def register(from_schema_, to_schema_, conversion_, silent_=false)
end
end
end
-
-
+
+
private
-
+
def _get_key(from_schema_, to_schema_) # :nodoc:
[_get_schema(from_schema_), _get_schema(to_schema_)]
end
-
+
def _get_schema(schema_) # :nodoc:
schema_ = Format.get(schema_, true) if schema_.kind_of?(::String) || schema_.kind_of?(::Symbol)
schema_ = schema_.schema if schema_.respond_to?(:schema)
schema_ = schema_.root_field if schema_.respond_to?(:root_field)
schema_
end
-
-
+
+
end
-
+
end
-
-
+
+
end
Oops, something went wrong.

0 comments on commit 06ae4f5

Please sign in to comment.