diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-18 00:04:12 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-18 00:04:12 +0000 |
commit | 6c1da63bd77b4caa409b919f8c9893b27f9ae1be (patch) | |
tree | aa2133f45cc00ba879f1309a0a890b15d10dd4c2 /lib/rubygems/requirement.rb | |
parent | 5ab11990cb24bc31c400b21a07b10c48d0b0d5d1 (diff) | |
download | ruby-6c1da63bd77b4caa409b919f8c9893b27f9ae1be.tar.gz |
* lib/rubygems: Update to RubyGems 1.8.22 plus r33517 and r35337 which
were ported to the rubygems git repository.
See https://github.com/rubygems/rubygems/blob/1.8/History.txt for
changes since 1.8.11.
* test/rubygems: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/requirement.rb')
-rw-r--r-- | lib/rubygems/requirement.rb | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb index ed5cacc237..7abff01c39 100644 --- a/lib/rubygems/requirement.rb +++ b/lib/rubygems/requirement.rb @@ -1,35 +1,18 @@ require "rubygems/version" -# :stopdoc: - -# Hack to handle syck's DefaultKey bug with psych -# -# Quick note! If/when psych loads in 1.9, it will redefine -# YAML to point to Psych by removing the YAML constant. -# Thusly, over in Gem.load_yaml, we define DefaultKey again -# after proper yaml library has been loaded. -# -# All this is so that there is always a YAML::Syck::DefaultKey -# class no matter if the full yaml library has loaded or not. -# -module YAML - if !defined? Syck - module Syck - class DefaultKey - def to_s - '=' - end - end - end - end -end - -# :startdoc: - ## # A Requirement is a set of one or more version restrictions. It supports a # few (<tt>=, !=, >, <, >=, <=, ~></tt>) different restriction operators. +# REFACTOR: The fact that a requirement is singular or plural is kind of +# awkward. Is Requirement the right name for this? Or should it be one +# [op, number] pair, and we call the list of requirements something else? +# Since a Requirement is held by a Dependency, maybe this should be made +# singular and the list aspect should be pulled up into Dependency? + +require "rubygems/version" +require "rubygems/deprecate" + class Gem::Requirement include Comparable @@ -147,6 +130,18 @@ class Gem::Requirement fix_syck_default_key_in_requirements end + def yaml_initialize(tag, vals) # :nodoc: + vals.each do |ivar, val| + instance_variable_set "@#{ivar}", val + end + + fix_syck_default_key_in_requirements + end + + def init_with coder # :nodoc: + yaml_initialize coder.tag, coder.map + end + def prerelease? requirements.any? { |r| r.last.prerelease? } end @@ -188,9 +183,11 @@ class Gem::Requirement private def fix_syck_default_key_in_requirements + Gem.load_yaml + # Fixup the Syck DefaultKey bug @requirements.each do |r| - if r[0].kind_of? YAML::Syck::DefaultKey + if r[0].kind_of? Gem::SyckDefaultKey r[0] = "=" end end |