diff options
Diffstat (limited to 'lib/rubygems/requirement.rb')
-rw-r--r-- | lib/rubygems/requirement.rb | 40 |
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: |