summaryrefslogtreecommitdiff
path: root/lib/rubygems/requirement.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-17 20:50:00 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-17 20:50:00 +0000
commit22d9456b7917fe96fa81fd1d994073312753af8b (patch)
treebe157928ed84f75988ceb82a070797c3482b66a6 /lib/rubygems/requirement.rb
parent22263729af357eb86e8bc2165a9eaa6f25eec8a6 (diff)
* 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@35370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/requirement.rb')
-rw-r--r--lib/rubygems/requirement.rb51
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