summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-26 01:10:50 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-26 01:10:50 +0000
commite93d882d96cc536857e6c181b5f0194f15316b7d (patch)
treed5810ac15991fc2d4eeb19138e49ba4b892e866d /lib
parent4544b3824c8ce74e0a92c58a3167f900904f506b (diff)
* lib/rubygems: Update to RubyGems 1.8.10. Fixes security issue in
creating ruby-format gemspecs. Fixes Gem.dir not being at the front of Gem.path to fix uninstall and cleanup commands. Fixes gem uninstall stopping on the first missing gem. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems.rb12
-rw-r--r--lib/rubygems/commands/uninstall_command.rb2
-rw-r--r--lib/rubygems/path_support.rb21
-rw-r--r--lib/rubygems/requirement.rb3
-rw-r--r--lib/rubygems/specification.rb10
5 files changed, 27 insertions, 21 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index f469deb9a8..632b5e0a60 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -118,7 +118,7 @@ require "rubygems/deprecate"
# -The RubyGems Team
module Gem
- VERSION = '1.8.9'
+ VERSION = '1.8.10'
##
# Raised when RubyGems is unable to load or activate a gem. Contains the
@@ -644,7 +644,15 @@ module Gem
def self.load_yaml
begin
- require 'psych'
+ gem 'psych', '~> 1.2', '>= 1.2.1' unless ENV['TEST_SYCK']
+ rescue Gem::LoadError
+ # It's OK if the user does not have the psych gem installed. We will
+ # attempt to require the stdlib version
+ end
+
+ begin
+ # Try requiring the gem version *or* stdlib version of psych.
+ require 'psych' unless ENV['TEST_SYCK']
rescue ::LoadError
ensure
require 'yaml'
diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb
index 67a3d38bba..aaadb762b5 100644
--- a/lib/rubygems/commands/uninstall_command.rb
+++ b/lib/rubygems/commands/uninstall_command.rb
@@ -78,6 +78,8 @@ class Gem::Commands::UninstallCommand < Gem::Command
get_all_gem_names.each do |gem_name|
begin
Gem::Uninstaller.new(gem_name, options).uninstall
+ rescue Gem::InstallError => e
+ alert e.message
rescue Gem::GemNotInHomeException => e
spec = e.spec
alert("In order to remove #{spec.name}, please execute:\n" \
diff --git a/lib/rubygems/path_support.rb b/lib/rubygems/path_support.rb
index 059e372112..0aaf2c1bed 100644
--- a/lib/rubygems/path_support.rb
+++ b/lib/rubygems/path_support.rb
@@ -1,5 +1,4 @@
##
-#
# Gem::PathSupport facilitates the GEM_HOME and GEM_PATH environment settings
# to the rest of RubyGems.
#
@@ -43,18 +42,16 @@ class Gem::PathSupport
# Set the Gem search path (as reported by Gem.path).
def path=(gpaths)
- # FIX: it should be [home, *path], not [*path, home]
-
- gem_path = []
+ gem_path = [@home]
# FIX: I can't tell wtf this is doing.
gpaths ||= (ENV['GEM_PATH'] || "").empty? ? nil : ENV["GEM_PATH"]
- if gpaths
- if gpaths.kind_of?(Array)
- gem_path = gpaths.dup
+ if gpaths then
+ if gpaths.kind_of?(Array) then
+ gem_path.push(*gpaths)
else
- gem_path = gpaths.split(File::PATH_SEPARATOR)
+ gem_path.push(*gpaths.split(File::PATH_SEPARATOR))
end
if File::ALT_SEPARATOR then
@@ -62,14 +59,10 @@ class Gem::PathSupport
this_path.gsub File::ALT_SEPARATOR, File::SEPARATOR
end
end
-
- gem_path << @home
else
- gem_path = Gem.default_path + [@home]
+ gem_path.push(*Gem.default_path)
- if defined?(APPLE_GEM_HOME)
- gem_path << APPLE_GEM_HOME
- end
+ gem_path << APPLE_GEM_HOME if defined?(APPLE_GEM_HOME)
end
@path = gem_path.uniq
diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb
index 99bfd49364..ed5cacc237 100644
--- a/lib/rubygems/requirement.rb
+++ b/lib/rubygems/requirement.rb
@@ -16,6 +16,9 @@ module YAML
if !defined? Syck
module Syck
class DefaultKey
+ def to_s
+ '='
+ end
end
end
end
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 44e31dc357..2059e0762d 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -1459,7 +1459,7 @@ class Gem::Specification
# TODO: do we need these?? Kill it
glob = File.join(self.lib_dirs_glob, glob)
- Dir[glob].map { |f| f.untaint } # FIX our tests are brokey, run w/ SAFE=1
+ Dir[glob].map { |f| f.untaint } # FIX our tests are broken, run w/ SAFE=1
end
##
@@ -1690,11 +1690,11 @@ class Gem::Specification
def ruby_code(obj)
case obj
- when String then '%q{' + obj + '}'
+ when String then obj.dump
when Array then '[' + obj.map { |x| ruby_code x }.join(", ") + ']'
- when Gem::Version then obj.to_s.inspect
- when Date then '%q{' + obj.strftime('%Y-%m-%d') + '}'
- when Time then '%q{' + obj.strftime('%Y-%m-%d') + '}'
+ when Gem::Version then obj.to_s.dump
+ when Date then obj.strftime('%Y-%m-%d').dump
+ when Time then obj.strftime('%Y-%m-%d').dump
when Numeric then obj.inspect
when true, false, nil then obj.inspect
when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"