Permalink
Browse files

Import trunk changes

git-svn-id: svn+ssh://rubyforge.org/var/svn/rubygems/trunk@2456 3d4018f9-ac1a-0410-99e9-8a154d859a19
  • Loading branch information...
drbrain committed Feb 24, 2010
1 parent 805b754 commit 0495c7c0dd9878f9a7a74f5133d7892d28d01812
View
@@ -129,6 +129,7 @@ class LoadError < ::LoadError
:libdir => RbConfig::CONFIG["libdir"],
:ruby_install_name => RbConfig::CONFIG["ruby_install_name"],
:ruby_version => RbConfig::CONFIG["ruby_version"],
+ :rubylibprefix => RbConfig::CONFIG["rubylibprefix"],
:sitedir => RbConfig::CONFIG["sitedir"],
:sitelibdir => RbConfig::CONFIG["sitelibdir"],
:vendordir => RbConfig::CONFIG["vendordir"] ,
@@ -699,14 +700,15 @@ def self.pre_uninstall(&hook)
# The directory prefix this RubyGems was installed at.
def self.prefix
- prefix = File.dirname File.expand_path(__FILE__)
+ dir = File.dirname File.expand_path(__FILE__)
+ prefix = File.dirname dir
- if File.dirname(prefix) == File.expand_path(ConfigMap[:sitelibdir]) or
- File.dirname(prefix) == File.expand_path(ConfigMap[:libdir]) or
- 'lib' != File.basename(prefix) then
+ if prefix == File.expand_path(ConfigMap[:sitelibdir]) or
+ prefix == File.expand_path(ConfigMap[:libdir]) or
+ 'lib' != File.basename(dir) then
nil
else
- File.dirname prefix
+ prefix
end
end
@@ -1024,6 +1026,8 @@ class << self
module Kernel
+ undef gem if respond_to? :gem # defined in gem_prelude.rb on 1.9
+
##
# Use Kernel#gem to activate a specific version of +gem_name+.
#
@@ -156,11 +156,12 @@ def find_command_possibilities(cmd_name)
def load_and_instantiate(command_name)
command_name = command_name.to_s
+ const_name = command_name.capitalize.gsub(/_(.)/) { $1.upcase } << "Command"
+ commands = Gem::Commands
retried = false
begin
- const_name = command_name.capitalize.gsub(/_(.)/) { $1.upcase }
- Gem::Commands.const_get("#{const_name}Command").new
+ commands.const_get const_name
rescue NameError
if retried then
raise
@@ -169,7 +170,7 @@ def load_and_instantiate(command_name)
require "rubygems/commands/#{command_name}_command"
retry
end
- end
+ end.new
end
end
View
@@ -20,9 +20,8 @@ def self.default_dir
if defined? RUBY_FRAMEWORK_VERSION then
File.join File.dirname(ConfigMap[:sitedir]), 'Gems',
ConfigMap[:ruby_version]
- # 1.9.2dev reverted to 1.8 style path
- elsif RUBY_VERSION > '1.9' and RUBY_VERSION < '1.9.2' then
- File.join(ConfigMap[:libdir], ConfigMap[:ruby_install_name], 'gems',
+ elsif ConfigMap[:rubylibprefix] then
+ File.join(ConfigMap[:rubylibprefix], 'gems',
ConfigMap[:ruby_version])
else
File.join(ConfigMap[:libdir], ruby_engine, 'gems',
@@ -295,7 +295,7 @@ def generate_bin
@spec.executables.each do |filename|
filename.untaint
- bin_path = File.expand_path File.join(@gem_dir, @spec.bindir, filename)
+ bin_path = File.expand_path "#{@spec.bindir}/#{filename}", @gem_dir
mode = File.stat(bin_path).mode | 0111
File.chmod mode, bin_path
View
@@ -1,7 +1,8 @@
-#++
-# Copyright (C) 2004 Mauricio Julio Fernández Pradier
-# See LICENSE.txt for additional licensing information.
+# -*- coding: utf-8 -*-
#--
+# Copyright (C) 2004 Mauricio Julio Fernández Pradier
+# See LICENSE.txt for additional licensing information.
+#++
require 'fileutils'
require 'find'
@@ -12,8 +13,10 @@
require 'rubygems/security'
require 'rubygems/specification'
+##
# Wrapper for FileUtils meant to provide logging and additional operations if
# needed.
+
class Gem::FileOperations
def initialize(logger = nil)
@@ -1,7 +1,8 @@
-#++
-# Copyright (C) 2004 Mauricio Julio Fernández Pradier
-# See LICENSE.txt for additional licensing information.
+# -*- coding: utf-8 -*-
#--
+# Copyright (C) 2004 Mauricio Julio Fernández Pradier
+# See LICENSE.txt for additional licensing information.
+#++
module Gem::Package::FSyncDir
@@ -1,7 +1,8 @@
-#++
-# Copyright (C) 2004 Mauricio Julio Fernández Pradier
-# See LICENSE.txt for additional licensing information.
+# -*- coding: utf-8 -*-
#--
+# Copyright (C) 2004 Mauricio Julio Fernández Pradier
+# See LICENSE.txt for additional licensing information.
+#++
##
#--
@@ -1,7 +1,8 @@
-#++
-# Copyright (C) 2004 Mauricio Julio Fernández Pradier
-# See LICENSE.txt for additional licensing information.
+# -*- coding: utf-8 -*-
#--
+# Copyright (C) 2004 Mauricio Julio Fernández Pradier
+# See LICENSE.txt for additional licensing information.
+#++
##
# TarOutput is a wrapper to TarWriter that builds gem-format tar file.
@@ -1,7 +1,8 @@
-#++
-# Copyright (C) 2004 Mauricio Julio Fernández Pradier
-# See LICENSE.txt for additional licensing information.
+# -*- coding: utf-8 -*-
#--
+# Copyright (C) 2004 Mauricio Julio Fernández Pradier
+# See LICENSE.txt for additional licensing information.
+#++
##
# TarReader reads tar files and allows iteration over their items
@@ -1,7 +1,8 @@
-#++
-# Copyright (C) 2004 Mauricio Julio Fernández Pradier
-# See LICENSE.txt for additional licensing information.
+# -*- coding: utf-8 -*-
#--
+# Copyright (C) 2004 Mauricio Julio Fernández Pradier
+# See LICENSE.txt for additional licensing information.
+#++
##
# Allows writing of tar files
@@ -41,7 +41,7 @@
#
# require 'rubygems'
# require 'rubygems/package_task'
-#
+#
# spec = Gem::Specification.new do |s|
# s.platform = Gem::Platform::RUBY
# s.summary = "Ruby based make-like utility."
@@ -56,7 +56,7 @@
# and dependencies are specified in standard Ruby syntax.
# EOF
# end
-#
+#
# Gem::PackageTask.new(spec) do |pkg|
# pkg.need_zip = true
# pkg.need_tar = true
View
@@ -103,7 +103,7 @@ def to_a
def to_s
to_a.compact.join '-'
end
-
+
def empty?
to_s.empty?
end
View
@@ -218,7 +218,7 @@
#
# # signing key (still kept in an undisclosed location!)
# s.signing_key = '/mnt/floppy/alf-private_key.pem'
-#
+#
# # certificate chain (includes the issuer certificate now too)
# s.cert_chain = ['/home/alf/doc/seattlerb-public_cert.pem',
# '/home/alf/doc/alf_at_seattle-public_cert.pem']
@@ -274,15 +274,15 @@
# # convert a PEM format X509 certificate into DER format:
# # (note: Windows .cer files are X509 certificates in DER format)
# $ openssl x509 -in input.pem -outform der -out output.der
-#
+#
# # print out the certificate in a human-readable format:
# $ openssl x509 -in input.pem -noout -text
#
# And you can do the same thing with the private key file as well:
#
# # convert a PEM format RSA key into DER format:
# $ openssl rsa -in input_key.pem -outform der -out output_key.der
-#
+#
# # print out the key in a human readable format:
# $ openssl rsa -in input_key.pem -noout -text
#
@@ -85,10 +85,10 @@ def from_gems_in(*spec_dirs)
def load_specification(file_name)
return nil unless file_name and File.exist? file_name
- spec_code = if RUBY_VERSION < '1.9' then
- File.read file_name
- else
+ spec_code = if defined? Encoding then
File.read file_name, :encoding => 'UTF-8'
+ else
+ File.read file_name
end.untaint
begin
@@ -414,7 +414,7 @@ def update(source_uri, all)
end
def ==(other) # :nodoc:
- self.class === other and @gems == other.gems
+ self.class === other and @gems == other.gems
end
def dump
@@ -285,17 +285,19 @@ def search(pattern, platform_only = false, all = false)
cache_data.map do |source_uri, sic_entry|
next unless Gem.sources.include? source_uri
# TODO - Remove this gunk after 2008/11
- unless pattern.kind_of?(Gem::Dependency)
- pattern = Gem::Dependency.new(pattern, Gem::Requirement.default)
+ unless pattern.kind_of? Gem::Dependency then
+ pattern = Gem::Dependency.new pattern, Gem::Requirement.default
end
sic_entry.source_index.search pattern, platform_only
end.flatten.compact
end
+ ##
# Searches all source indexes for +pattern+. If +only_platform+ is true,
# only gems matching Gem.platforms will be selected. Returns an Array of
# pairs containing the Gem::Specification found and the source_uri it was
# found at.
+
def search_with_source(pattern, only_platform = false, all = false)
read_all_cache_data if all
@@ -184,7 +184,7 @@ def list(all = false, prerelease = false)
cache = { :latest => @latest_specs,
:prerelease => @prerelease_specs,
:all => @specs }[type]
-
+
Gem.sources.each do |source_uri|
source_uri = URI.parse source_uri
@@ -11,9 +11,9 @@
# @fetcher = Gem::FakeFetcher.new
# @fetcher.data['http://gems.example.com/yaml'] = source_index.to_yaml
# Gem::RemoteFetcher.fetcher = @fetcher
-#
+#
# # invoke RubyGems code
-#
+#
# paths = @fetcher.paths
# assert_equal 'http://gems.example.com/yaml', paths.shift
# assert paths.empty?, paths.join(', ')
@@ -10,12 +10,11 @@
require 'rubygems/format'
require 'rubygems/installer'
-# Load test-unit 2.x if it's a gem
begin
- Gem.activate('test-unit')
+ gem 'test-unit'
rescue Gem::LoadError
- # Ignore - use the test-unit library that's part of the standard library
-end
+ # Ignore - use the test-unit library that's part of the standard library
+end
##
# Validator performs various gem file and gem database validation
@@ -35,7 +35,7 @@ def assert_headers_equal(expected, actual)
linkname 100
magic 6
version 2
- uname 32
+ uname 32
gname 32
devmajor 8
devminor 8
@@ -54,7 +54,7 @@ def assert_headers_equal(expected, actual)
next
end
- assert_equal expected[offset, length], actual[offset, length],
+ assert_equal expected[offset, length], actual[offset, length],
"Field #{name} of the tar header differs."
offset += length
View
@@ -71,6 +71,13 @@ def setup
Gem.ensure_gem_subdirectories @gemhome
+ @orig_ruby = if ruby = ENV['RUBY'] then
+ Gem.class_eval { ruby, @ruby = @ruby, ruby }
+ ruby
+ end
+
+ Gem.ensure_gem_subdirectories @gemhome
+
@orig_ENV_HOME = ENV['HOME']
ENV['HOME'] = @userhome
Gem.instance_variable_set :@user_home, nil
@@ -147,6 +154,8 @@ def teardown
Gem.clear_paths
+ Gem.class_eval { @ruby = ruby } if ruby = @orig_ruby
+
if @orig_ENV_HOME then
ENV['HOME'] = @orig_ENV_HOME
else
View
@@ -15,7 +15,7 @@ def install_session
puts
puts "with the appropriate admin privileges."
puts "*****************************************************************"
- puts
+ puts
exit
end
gem 'session'
Oops, something went wrong.

2 comments on commit 0495c7c

@svetlyo

This comment has been minimized.

Show comment Hide comment
@svetlyo

svetlyo Jul 22, 2010

The changes made in lib/rubygems/defaults.rb (which are already part of RubyGems 1.3.7) cause
a wrong default gem directory when used with ruby 1.9.1 with --program-suffix=1.9.
eg. /opt/local/lib/ruby/gems/1.9.1/ instead of /opt/local/lib/ruby1.9/gems/1.9.1/

The changes are the result of importing this particular commit:
http://redmine.ruby-lang.org/repositories/diff/ruby-19?rev=26048

The changes made in lib/rubygems/defaults.rb (which are already part of RubyGems 1.3.7) cause
a wrong default gem directory when used with ruby 1.9.1 with --program-suffix=1.9.
eg. /opt/local/lib/ruby/gems/1.9.1/ instead of /opt/local/lib/ruby1.9/gems/1.9.1/

The changes are the result of importing this particular commit:
http://redmine.ruby-lang.org/repositories/diff/ruby-19?rev=26048

@luislavena

This comment has been minimized.

Show comment Hide comment
@luislavena

luislavena Jul 22, 2010

Member

Hello svetlyo, please open a bug report in RubyGems bug tracker:

http://rubyforge.org/tracker/?atid=575&group_id=126&func=browse

Member

luislavena replied Jul 22, 2010

Hello svetlyo, please open a bug report in RubyGems bug tracker:

http://rubyforge.org/tracker/?atid=575&group_id=126&func=browse

Please sign in to comment.