ruby-changes:27093
From: drbrain <ko1@a...>
Date: Fri, 8 Feb 2013 09:05:45 +0900 (JST)
Subject: [ruby-changes:27093] drbrain:r39145 (trunk): * lib/rubygems/package/old.rb: Fix loading old format gems on ruby
drbrain 2013-02-08 08:58:42 +0900 (Fri, 08 Feb 2013) New Revision: 39145 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39145 Log: * lib/rubygems/package/old.rb: Fix loading old format gems on ruby 1.8. This commit is only so trunk and rubygems master have the same code. Modified files: trunk/ChangeLog trunk/lib/rubygems/package/old.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 39144) +++ ChangeLog (revision 39145) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Feb 8 08:58:26 2013 Eric Hodel <drbrain@s...> + + * lib/rubygems/package/old.rb: Fix loading old format gems on ruby + 1.8. This commit is only so trunk and rubygems master have the same + code. + Fri Feb 8 08:53:27 2013 Aaron Patterson <aaron@t...> * ext/psych/lib/psych/visitors/yaml_tree.rb: fixing string quotation Index: lib/rubygems/package/old.rb =================================================================== --- lib/rubygems/package/old.rb (revision 39144) +++ lib/rubygems/package/old.rb (revision 39145) @@ -142,9 +142,19 @@ class Gem::Package::Old < Gem::Package https://github.com/ruby/ruby/blob/trunk/lib/rubygems/package/old.rb#L142 end end - @spec = Gem::Specification.from_yaml yaml - rescue YAML::SyntaxError => e - raise Gem::Exception, "Failed to parse gem specification out of gem file" + yaml_error = if RUBY_VERSION < '1.8' then + YAML::ParseError + elsif YAML::ENGINE.yamler == 'syck' then + YAML::ParseError + else + YAML::SyntaxError + end + + begin + @spec = Gem::Specification.from_yaml yaml + rescue yaml_error => e + raise Gem::Exception, "Failed to parse gem specification out of gem file" + end rescue ArgumentError => e raise Gem::Exception, "Failed to parse gem specification out of gem file" end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/