summaryrefslogtreecommitdiff
path: root/lib/rubygems/requirement.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-27 01:40:07 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-27 01:40:07 +0000
commit035ef0a3475943d92f813a6449a33dc07b6d4e4c (patch)
tree67116d189b67fad9406635921f7aaf088e69495d /lib/rubygems/requirement.rb
parentb9c485aa0d6f13303e7e9ab05c6d2b2496610a35 (diff)
* lib/rubygems: Update to RubyGems 1.8.6.1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/requirement.rb')
-rw-r--r--lib/rubygems/requirement.rb40
1 files changed, 34 insertions, 6 deletions
diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb
index f7bda10cf7..3809dfad98 100644
--- a/lib/rubygems/requirement.rb
+++ b/lib/rubygems/requirement.rb
@@ -1,11 +1,24 @@
-######################################################################
-# This file is imported from the rubygems project.
-# DO NOT make modifications in this repo. They _will_ be reverted!
-# File a patch instead and assign it to Ryan Davis or Eric Hodel.
-######################################################################
-
require "rubygems/version"
+# 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
+ end
+ end
+ end
+end
+
##
# A Requirement is a set of one or more version restrictions. It supports a
# few (<tt>=, !=, >, <, >=, <=, ~></tt>) different restriction operators.
@@ -116,11 +129,15 @@ class Gem::Requirement
end
def marshal_dump # :nodoc:
+ fix_syck_default_key_in_requirements
+
[@requirements]
end
def marshal_load array # :nodoc:
@requirements = array[0]
+
+ fix_syck_default_key_in_requirements
end
def prerelease?
@@ -160,6 +177,17 @@ class Gem::Requirement
def <=> other # :nodoc:
to_s <=> other.to_s
end
+
+ private
+
+ def fix_syck_default_key_in_requirements
+ # Fixup the Syck DefaultKey bug
+ @requirements.each do |r|
+ if r[0].kind_of? YAML::Syck::DefaultKey
+ r[0] = "="
+ end
+ end
+ end
end
# :stopdoc: