ruby-changes:32436
From: drbrain <ko1@a...>
Date: Tue, 7 Jan 2014 10:19:39 +0900 (JST)
Subject: [ruby-changes:32436] drbrain:r44515 (trunk): * ChangeLog:
drbrain 2014-01-07 10:19:28 +0900 (Tue, 07 Jan 2014) New Revision: 44515 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44515 Log: * ChangeLog: * lib/rubygems/basic_specification.rb (class Gem): * lib/rubygems/commands/contents_command.rb (prefix or only the files that are requir): * lib/rubygems/commands/install_command.rb (to write the specification by hand): * lib/rubygems/commands/setup_command.rb (class Gem): * lib/rubygems/commands/setup_command.rb (TEXT): * lib/rubygems/compatibility.rb (module Gem): * lib/rubygems/defaults.rb (module Gem): * lib/rubygems/deprecate.rb (module Gem): * lib/rubygems/installer.rb (class Gem): * lib/rubygems/platform.rb (class Gem): * lib/rubygems/rdoc.rb (class Gem): * lib/rubygems/request_set/lockfile.rb (class Gem): * lib/rubygems/resolver/installer_set.rb (class Gem): * lib/rubygems/resolver.rb (class Gem): * lib/rubygems/specification.rb (class Gem): * lib/rubygems/test_case.rb (class Gem): * lib/rubygems/test_case.rb (Also): * lib/rubygems/uninstaller.rb (class Gem): * lib/rubygems.rb (module Gem): * test/rubygems/test_gem.rb (class TestGem): * test/rubygems/test_gem_commands_contents_command.rb (lib): * test/rubygems/test_gem_commands_environment_command.rb (class TestGemCommandsEnvironmentCommand): * test/rubygems/test_gem_commands_install_command.rb (ERROR): * test/rubygems/test_gem_commands_update_command.rb (class TestGemCommandsUpdateCommand): * test/rubygems/test_gem_dependency_installer.rb (class TestGemDependencyInstaller): * test/rubygems/test_gem_installer.rb (load Gem): * test/rubygems/test_gem_installer.rb (gem): * test/rubygems/test_gem_request_set_lockfile.rb (GEM): * test/rubygems/test_gem_request_set_lockfile.rb (DEPENDENCIES): * test/rubygems/test_gem_specification.rb (dependencies): * test/rubygems/test_gem_specification.rb (duplicate dependency on b): * test/rubygems/test_gem_uninstaller.rb (class TestGemUninstaller): Modified files: trunk/ChangeLog trunk/lib/rubygems/basic_specification.rb trunk/lib/rubygems/commands/contents_command.rb trunk/lib/rubygems/commands/install_command.rb trunk/lib/rubygems/commands/setup_command.rb trunk/lib/rubygems/compatibility.rb trunk/lib/rubygems/defaults.rb trunk/lib/rubygems/deprecate.rb trunk/lib/rubygems/installer.rb trunk/lib/rubygems/platform.rb trunk/lib/rubygems/rdoc.rb trunk/lib/rubygems/request_set/lockfile.rb trunk/lib/rubygems/resolver/installer_set.rb trunk/lib/rubygems/resolver.rb trunk/lib/rubygems/specification.rb trunk/lib/rubygems/test_case.rb trunk/lib/rubygems/uninstaller.rb trunk/lib/rubygems.rb trunk/test/rubygems/test_gem.rb trunk/test/rubygems/test_gem_commands_contents_command.rb trunk/test/rubygems/test_gem_commands_environment_command.rb trunk/test/rubygems/test_gem_commands_install_command.rb trunk/test/rubygems/test_gem_commands_update_command.rb trunk/test/rubygems/test_gem_dependency_installer.rb trunk/test/rubygems/test_gem_installer.rb trunk/test/rubygems/test_gem_request_set_lockfile.rb trunk/test/rubygems/test_gem_specification.rb trunk/test/rubygems/test_gem_uninstaller.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 44514) +++ ChangeLog (revision 44515) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Jan 7 10:16:02 2014 Eric Hodel <drbrain@s...> + + * lib/rubygems: Update to RubyGems master 21e409d / RubyGems 2.2.1. + + See http://rubygems.rubyforge.org/rubygems-update/History_txt.html + for a list of bug fixes. + + * test/rubygems: ditto. + Tue Jan 7 10:10:46 2014 Eric Wong <e@8...> * ext/json/generator/depend: add build dependencies for json extension Index: lib/rubygems/basic_specification.rb =================================================================== --- lib/rubygems/basic_specification.rb (revision 44514) +++ lib/rubygems/basic_specification.rb (revision 44515) @@ -207,6 +207,24 @@ class Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/basic_specification.rb#L207 end ## + # Returns the paths to the source files for use with analysis and + # documentation tools. These paths are relative to full_gem_path. + + def source_paths + paths = raw_require_paths.dup + + if @extensions then + ext_dirs = @extensions.map do |extension| + extension.split(File::SEPARATOR, 2).first + end.uniq + + paths.concat ext_dirs + end + + paths.uniq + end + + ## # Return a Gem::Specification from this gem def to_spec Index: lib/rubygems/rdoc.rb =================================================================== --- lib/rubygems/rdoc.rb (revision 44514) +++ lib/rubygems/rdoc.rb (revision 44515) @@ -193,7 +193,7 @@ class Gem::RDoc # :nodoc: all https://github.com/ruby/ruby/blob/trunk/lib/rubygems/rdoc.rb#L193 ::RDoc::Parser::C.reset args = @spec.rdoc_options - args.concat @spec.require_paths + args.concat @spec.source_paths args.concat @spec.extra_rdoc_files case config_args = Gem.configuration[:rdoc] Index: lib/rubygems/compatibility.rb =================================================================== --- lib/rubygems/compatibility.rb (revision 44514) +++ lib/rubygems/compatibility.rb (revision 44515) @@ -33,6 +33,8 @@ end https://github.com/ruby/ruby/blob/trunk/lib/rubygems/compatibility.rb#L33 module Gem RubyGemsVersion = VERSION + # TODO remove at RubyGems 3 + RbConfigPriorities = %w[ MAJOR MINOR @@ -45,7 +47,7 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/compatibility.rb#L47 unless defined?(ConfigMap) ## # Configuration settings from ::RbConfig - ConfigMap = Hash.new do |cm, key| + ConfigMap = Hash.new do |cm, key| # TODO remove at RubyGems 3 cm[key] = RbConfig::CONFIG[key.to_s] end else Index: lib/rubygems/specification.rb =================================================================== --- lib/rubygems/specification.rb (revision 44514) +++ lib/rubygems/specification.rb (revision 44515) @@ -327,7 +327,7 @@ class Gem::Specification < Gem::BasicSpe https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L327 add_bindir(@executables), @extra_rdoc_files, @extensions, - ].flatten.sort.uniq.compact + ].flatten.uniq.compact.sort end ###################################################################### Index: lib/rubygems/commands/contents_command.rb =================================================================== --- lib/rubygems/commands/contents_command.rb (revision 44514) +++ lib/rubygems/commands/contents_command.rb (revision 44515) @@ -94,11 +94,11 @@ prefix or only the files that are requir https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/contents_command.rb#L94 spec.files.sort.map do |file| case file when /\A#{spec.bindir}\// - [Gem::ConfigMap[:bindir], $POSTMATCH] + [RbConfig::CONFIG['bindir'], $POSTMATCH] when /\.so\z/ - [Gem::ConfigMap[:archdir], file] + [RbConfig::CONFIG['archdir'], file] else - [Gem::ConfigMap[:rubylibdir], file] + [RbConfig::CONFIG['rubylibdir'], file] end end end Index: lib/rubygems/commands/setup_command.rb =================================================================== --- lib/rubygems/commands/setup_command.rb (revision 44514) +++ lib/rubygems/commands/setup_command.rb (revision 44515) @@ -13,7 +13,7 @@ class Gem::Commands::SetupCommand < Gem: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/setup_command.rb#L13 super 'setup', 'Install RubyGems', :format_executable => true, :document => %w[ri], - :site_or_vendor => :sitelibdir, + :site_or_vendor => 'sitelibdir', :destdir => '', :prefix => '', :previous_version => '' add_option '--previous-version=VERSION', @@ -36,7 +36,7 @@ class Gem::Commands::SetupCommand < Gem: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/setup_command.rb#L36 add_option '--[no-]vendor', 'Install into vendorlibdir not sitelibdir' do |vendor, options| - options[:site_or_vendor] = vendor ? :vendorlibdir : :sitelibdir + options[:site_or_vendor] = vendor ? 'vendorlibdir' : 'sitelibdir' end add_option '--[no-]format-executable', @@ -343,19 +343,19 @@ TEXT https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/setup_command.rb#L343 site_or_vendor = options[:site_or_vendor] if prefix.empty? then - lib_dir = Gem::ConfigMap[site_or_vendor] - bin_dir = Gem::ConfigMap[:bindir] + lib_dir = RbConfig::CONFIG[site_or_vendor] + bin_dir = RbConfig::CONFIG['bindir'] else # Apple installed RubyGems into libdir, and RubyGems <= 1.1.0 gets # confused about installation location, so switch back to # sitelibdir/vendorlibdir. if defined?(APPLE_GEM_HOME) and # just in case Apple and RubyGems don't get this patched up proper. - (prefix == Gem::ConfigMap[:libdir] or + (prefix == RbConfig::CONFIG['libdir'] or # this one is important - prefix == File.join(Gem::ConfigMap[:libdir], 'ruby')) then - lib_dir = Gem::ConfigMap[site_or_vendor] - bin_dir = Gem::ConfigMap[:bindir] + prefix == File.join(RbConfig::CONFIG['libdir'], 'ruby')) then + lib_dir = RbConfig::CONFIG[site_or_vendor] + bin_dir = RbConfig::CONFIG['bindir'] else lib_dir = File.join prefix, 'lib' bin_dir = File.join prefix, 'bin' Index: lib/rubygems/commands/install_command.rb =================================================================== --- lib/rubygems/commands/install_command.rb (revision 44514) +++ lib/rubygems/commands/install_command.rb (revision 44515) @@ -228,7 +228,18 @@ to write the specification by hand. For https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/install_command.rb#L228 def install_gem_without_dependencies name, req # :nodoc: gem = nil - if remote? then + if local? then + if name =~ /\.gem$/ and File.file? name then + source = Gem::Source::SpecificFile.new name + spec = source.spec + else + source = Gem::Source::Local.new + spec = source.find_gem name, req + end + gem = source.download spec if spec + end + + if remote? and not gem then dependency = Gem::Dependency.new name, req dependency.prerelease = options[:prerelease] @@ -236,13 +247,6 @@ to write the specification by hand. For https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/install_command.rb#L247 gem = fetcher.download_to_cache dependency end - if local? and not gem then - source = Gem::Source::Local.new - spec = source.find_gem name, req - - gem = source.download spec - end - inst = Gem::Installer.new gem, options inst.install Index: lib/rubygems/deprecate.rb =================================================================== --- lib/rubygems/deprecate.rb (revision 44514) +++ lib/rubygems/deprecate.rb (revision 44515) @@ -50,7 +50,7 @@ module Gem::Deprecate https://github.com/ruby/ruby/blob/trunk/lib/rubygems/deprecate.rb#L50 class_eval { old = "_deprecated_#{name}" alias_method old, name - define_method name do |*args, &block| # TODO: really works on 1.8.7? + define_method name do |*args, &block| klass = self.kind_of? Module target = klass ? "#{self}." : "#{self.class}#" msg = [ "NOTE: #{target}#{name} is deprecated", Index: lib/rubygems/request_set/lockfile.rb =================================================================== --- lib/rubygems/request_set/lockfile.rb (revision 44514) +++ lib/rubygems/request_set/lockfile.rb (revision 44515) @@ -303,7 +303,12 @@ class Gem::RequestSet::Lockfile https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set/lockfile.rb#L303 type, data, = get [:text, :requirement] if type == :text and column == 4 then - last_spec = set.add name, data, Gem::Platform::RUBY + version, platform = data.split '-', 2 + + platform = + platform ? Gem::Platform.new(platform) : Gem::Platform::RUBY + + last_spec = set.add name, version, platform else dependency = parse_dependency name, data Index: lib/rubygems/platform.rb =================================================================== --- lib/rubygems/platform.rb (revision 44514) +++ lib/rubygems/platform.rb (revision 44515) @@ -16,7 +16,7 @@ class Gem::Platform https://github.com/ruby/ruby/blob/trunk/lib/rubygems/platform.rb#L16 attr_accessor :version def self.local - arch = Gem::ConfigMap[:arch] + arch = RbConfig::CONFIG['arch'] arch = "#{arch}_60" if arch =~ /mswin32$/ @local ||= new(arch) end Index: lib/rubygems/installer.rb =================================================================== --- lib/rubygems/installer.rb (revision 44514) +++ lib/rubygems/installer.rb (revision 44515) @@ -480,7 +480,7 @@ class Gem::Installer https://github.com/ruby/ruby/blob/trunk/lib/rubygems/installer.rb#L480 # def shebang(bin_file_name) - ruby_name = Gem::ConfigMap[:ruby_install_name] if @env_shebang + ruby_name = RbConfig::CONFIG['ruby_install_name'] if @env_shebang path = File.join gem_dir, spec.bindir, bin_file_name first_line = File.open(path, "rb") {|file| file.gets} @@ -493,7 +493,7 @@ class Gem::Installer https://github.com/ruby/ruby/blob/trunk/lib/rubygems/installer.rb#L493 if which = Gem.configuration[:custom_shebang] # replace bin_file_name with "ruby" to avoid endless loops - which = which.gsub(/ #{bin_file_name}$/," #{Gem::ConfigMap[:ruby_install_name]}") + which = which.gsub(/ #{bin_file_name}$/," #{RbConfig::CONFIG['ruby_install_name']}") which = which.gsub(/\$(\w+)/) do case $1 Index: lib/rubygems/resolver/installer_set.rb =================================================================== --- lib/rubygems/resolver/installer_set.rb (revision 44514) +++ lib/rubygems/resolver/installer_set.rb (revision 44515) @@ -28,11 +28,10 @@ class Gem::Resolver::InstallerSet < Gem: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/resolver/installer_set.rb#L28 @f = Gem::SpecFetcher.fetcher - @all = Hash.new { |h,k| h[k] = [] } @always_install = [] @ignore_dependencies = false @ignore_installed = false - @loaded_remote_specs = [] + @remote_set = Gem::Resolver::BestSet.new if consider_remote? @specs = {} end @@ -79,16 +78,7 @@ class Gem::Resolver::InstallerSet < Gem: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/resolver/installer_set.rb#L78 end end - if consider_remote? then - load_remote_specs dep - - @all[name].each do |remote_source, n| - if dep.match? n then - res << Gem::Resolver::IndexSpecification.new( - self, n.name, n.version, remote_source, n.platform) - end - end - end + res.concat @remote_set.find_all req if consider_remote? res end @@ -102,27 +92,6 @@ class Gem::Resolver::InstallerSet < Gem: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/resolver/installer_set.rb#L92 end ## - # Loads remote prerelease specs if +dep+ is a prerelease dependency - - def load_remote_specs dep # :nodoc: - types = [:released] - types << :prerelease if dep.prerelease? - - types.each do |type| - next if @loaded_remote_specs.include? type - @loaded_remote_specs << type - - list, = @f.available_specs type - - list.each do |uri, specs| - specs.each do |n| - @all[n.name] << [uri, n] - end - end - end - end - - ## # Called from IndexSpecification to get a true Specification # object. Index: lib/rubygems/uninstaller.rb =================================================================== --- lib/rubygems/uninstaller.rb (revision 44514) +++ lib/rubygems/uninstaller.rb (revision 44515) @@ -237,7 +237,7 @@ class Gem::Uninstaller https://github.com/ruby/ruby/blob/trunk/lib/rubygems/uninstaller.rb#L237 unless path_ok?(@gem_home, spec) or (@user_install and path_ok?(Gem.user_dir, spec)) then e = Gem::GemNotInHomeException.new \ - "Gem is not installed in directory #{@gem_home}" + "Gem '#{spec.full_name}' is not installed in directory #{@gem_home}" e.spec = spec raise e Index: lib/rubygems/resolver.rb =================================================================== --- lib/rubygems/resolver.rb (revision 44514) +++ lib/rubygems/resolver.rb (revision 44515) @@ -179,27 +179,6 @@ class Gem::Resolver https://github.com/ruby/ruby/blob/trunk/lib/rubygems/resolver.rb#L179 end ## - # Finds the State in +states+ that matches the +conflict+ so that we can try - # other possible sets. - # - # If no good candidate is found, the first state is tried. - - def find_conflict_state conflict, states # :nodoc: - until states.empty? do - state = states.pop - - explain :consider, state.dep, conflict.failed_dep - - if conflict.for_spec? state.spec - state.conflicts << [state.spec, conflict] - return state - end - end - - nil - end - - ## # Extracts the specifications that may be able to fulfill +dependency+ and # returns those that match the local platform and all those that match. Index: lib/rubygems/defaults.rb =================================================================== --- lib/rubygems/defaults.rb (revision 44514) +++ lib/rubygems/defaults.rb (revision 44515) @@ -29,22 +29,22 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/defaults.rb#L29 def self.default_dir path = if defined? RUBY_FRAMEWORK_VERSION then [ - File.dirname(ConfigMap[:sitedir]), + File.dirname(RbConfig::CONFIG['sitedir']), 'Gems', - ConfigMap[:ruby_version] + RbConfig::CONFIG['ruby_version'] ] - elsif ConfigMap[:rubylibprefix] then + elsif RbConfig::CONFIG['rubylibprefix'] then [ - ConfigMap[:rubylibprefix], + RbConfig::CONFIG['rubylibprefix'], 'gems', - ConfigMap[:ruby_version] + RbConfig::CONFIG['ruby_version'] ] else [ - ConfigMap[:libdir], + RbConfig::CONFIG['libdir'], ruby_engine, 'gems', - ConfigMap[:ruby_version] + RbConfig::CONFIG['ruby_version'] ] end @@ -74,7 +74,7 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/defaults.rb#L74 def self.user_dir parts = [Gem.user_home, '.gem', ruby_engine] - parts << ConfigMap[:ruby_version] unless ConfigMap[:ruby_version].empty? + parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty? File.join parts end @@ -100,7 +100,7 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/defaults.rb#L100 # Deduce Ruby's --program-prefix and --program-suffix from its install name def self.default_exec_format - exec_format = ConfigMap[:ruby_install_name].sub('ruby', '%s') rescue '%s' + exec_format = RbConfig::CONFIG['ruby_install_name'].sub('ruby', '%s') rescue '%s' unless exec_format =~ /%s/ then raise Gem::Exception, @@ -117,7 +117,7 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/defaults.rb#L117 if defined? RUBY_FRAMEWORK_VERSION then # mac framework support '/usr/bin' else # generic install - ConfigMap[:bindir] + RbConfig::CONFIG['bindir'] end end Index: lib/rubygems/test_case.rb =================================================================== --- lib/rubygems/test_case.rb (revision 44514) +++ lib/rubygems/test_case.rb (revision 44515) @@ -294,10 +294,10 @@ class Gem::TestCase < MiniTest::Unit::Te https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L294 Gem.searcher = nil Gem::SpecFetcher.fetcher = nil - @orig_BASERUBY = Gem::ConfigMap[:BASERUBY] - Gem::ConfigMap[:BASERUBY] = Gem::ConfigMap[:ruby_install_name] + @orig_BASERUBY = RbConfig::CONFIG['BASERUBY'] + RbConfig::CONFIG['BASERUBY'] = RbConfig::CONFIG['ruby_install_name'] - @orig_arch = Gem::ConfigMap[:arch] + @orig_arch = RbConfig::CONFIG['arch'] if win_platform? util_set_arch 'i386-mswin32' @@ -315,8 +315,8 @@ class Gem::TestCase < MiniTest::Unit::Te https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L315 def teardown $LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH - Gem::ConfigMap[:BASERUBY] = @orig_BASERUBY - Gem::ConfigMap[:arch] = @orig_arch + RbConfig::CONFIG['BASERUBY'] = @orig_BASERUBY + RbConfig::CONFIG['arch'] = @orig_arch if defined? Gem::RemoteFetcher then Gem::RemoteFetcher.fetcher = nil @@ -898,7 +898,7 @@ Also, a list: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L898 # Set the platform to +arch+ def util_set_arch(arch) - Gem::ConfigMap[:arch] = arch + RbConfig::CONFIG['arch'] = arch platform = Gem::Platform.new arch Gem.instance_variable_set :@platforms, nil Index: lib/rubygems.rb =================================================================== --- lib/rubygems.rb (revision 44514) +++ lib/rubygems.rb (revision 44515) @@ -8,7 +8,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L8 require 'rbconfig' module Gem - VERSION = '2.2.0' + VERSION = '2.2.1' end # Must be first since it unloads the prelude from 1.9.2 @@ -572,7 +572,7 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L572 # gem's paths are inserted before site lib directory by default. def self.load_path_insert_index - index = $LOAD_PATH.index ConfigMap[:sitelibdir] + index = $LOAD_PATH.index RbConfig::CONFIG['sitelibdir'] index end @@ -743,8 +743,8 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L743 def self.prefix prefix = File.dirname RUBYGEMS_DIR - if prefix != File.expand_path(ConfigMap[:sitelibdir]) and - prefix != File.expand_path(ConfigMap[:libdir]) and + if prefix != File.expand_path(RbConfig::CONFIG['sitelibdir']) and + prefix != File.expand_path(RbConfig::CONFIG['libdir']) and 'lib' == File.basename(RUBYGEMS_DIR) then prefix end @@ -765,6 +765,10 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L765 f.flock(File::LOCK_EX) f.read end + rescue Errno::EACCES + open path, 'rb' do |f| + f.read + end end ## @@ -772,8 +776,8 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/