ruby-changes:35502
From: hsbt <ko1@a...>
Date: Sun, 14 Sep 2014 12:30:55 +0900 (JST)
Subject: [ruby-changes:35502] hsbt:r47582 (trunk): * lib/rubygems: Update to RubyGems 2.4.1 master(713ab65)
hsbt 2014-09-14 12:30:02 +0900 (Sun, 14 Sep 2014) New Revision: 47582 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47582 Log: * lib/rubygems: Update to RubyGems 2.4.1 master(713ab65) Complete history at: https://github.com/rubygems/rubygems/blob/master/History.txt#L3-L216 * test/rubygems: ditto. Added directories: trunk/lib/rubygems/request/ Added files: trunk/lib/rubygems/commands/open_command.rb trunk/lib/rubygems/package/file_source.rb trunk/lib/rubygems/package/io_source.rb trunk/lib/rubygems/package/source.rb trunk/lib/rubygems/request/connection_pools.rb trunk/lib/rubygems/request/http_pool.rb trunk/lib/rubygems/request/https_pool.rb trunk/test/rubygems/test_gem_commands_open_command.rb trunk/test/rubygems/test_gem_request_connection_pools.rb trunk/test/rubygems/test_gem_unsatisfiable_dependency_error.rb Modified files: trunk/ChangeLog trunk/lib/rubygems/available_set.rb trunk/lib/rubygems/basic_specification.rb trunk/lib/rubygems/command.rb trunk/lib/rubygems/command_manager.rb trunk/lib/rubygems/commands/cert_command.rb trunk/lib/rubygems/commands/cleanup_command.rb trunk/lib/rubygems/commands/contents_command.rb trunk/lib/rubygems/commands/dependency_command.rb trunk/lib/rubygems/commands/environment_command.rb trunk/lib/rubygems/commands/help_command.rb trunk/lib/rubygems/commands/install_command.rb trunk/lib/rubygems/commands/list_command.rb trunk/lib/rubygems/commands/owner_command.rb trunk/lib/rubygems/commands/search_command.rb trunk/lib/rubygems/commands/setup_command.rb trunk/lib/rubygems/commands/uninstall_command.rb trunk/lib/rubygems/commands/update_command.rb trunk/lib/rubygems/commands/yank_command.rb trunk/lib/rubygems/config_file.rb trunk/lib/rubygems/core_ext/kernel_gem.rb trunk/lib/rubygems/core_ext/kernel_require.rb trunk/lib/rubygems/defaults.rb trunk/lib/rubygems/dependency.rb trunk/lib/rubygems/dependency_installer.rb trunk/lib/rubygems/doctor.rb trunk/lib/rubygems/errors.rb trunk/lib/rubygems/exceptions.rb trunk/lib/rubygems/ext/builder.rb trunk/lib/rubygems/ext/ext_conf_builder.rb trunk/lib/rubygems/gemcutter_utilities.rb trunk/lib/rubygems/install_update_options.rb trunk/lib/rubygems/installer.rb trunk/lib/rubygems/installer_test_case.rb trunk/lib/rubygems/local_remote_options.rb trunk/lib/rubygems/name_tuple.rb trunk/lib/rubygems/package/old.rb trunk/lib/rubygems/package/tar_reader/entry.rb trunk/lib/rubygems/package.rb trunk/lib/rubygems/platform.rb trunk/lib/rubygems/rdoc.rb trunk/lib/rubygems/remote_fetcher.rb trunk/lib/rubygems/request.rb trunk/lib/rubygems/request_set/gem_dependency_api.rb trunk/lib/rubygems/request_set/lockfile.rb trunk/lib/rubygems/request_set.rb trunk/lib/rubygems/requirement.rb trunk/lib/rubygems/resolver/activation_request.rb trunk/lib/rubygems/resolver/api_set.rb trunk/lib/rubygems/resolver/api_specification.rb trunk/lib/rubygems/resolver/best_set.rb trunk/lib/rubygems/resolver/composed_set.rb trunk/lib/rubygems/resolver/conflict.rb trunk/lib/rubygems/resolver/dependency_request.rb trunk/lib/rubygems/resolver/git_set.rb trunk/lib/rubygems/resolver/git_specification.rb trunk/lib/rubygems/resolver/index_set.rb trunk/lib/rubygems/resolver/installed_specification.rb trunk/lib/rubygems/resolver/installer_set.rb trunk/lib/rubygems/resolver/local_specification.rb trunk/lib/rubygems/resolver/lock_set.rb trunk/lib/rubygems/resolver/lock_specification.rb trunk/lib/rubygems/resolver/set.rb trunk/lib/rubygems/resolver/spec_specification.rb trunk/lib/rubygems/resolver/specification.rb trunk/lib/rubygems/resolver/vendor_set.rb trunk/lib/rubygems/resolver/vendor_specification.rb trunk/lib/rubygems/resolver.rb trunk/lib/rubygems/security/policy.rb trunk/lib/rubygems/server.rb trunk/lib/rubygems/source/git.rb trunk/lib/rubygems/source/installed.rb trunk/lib/rubygems/source/specific_file.rb trunk/lib/rubygems/source.rb trunk/lib/rubygems/spec_fetcher.rb trunk/lib/rubygems/specification.rb trunk/lib/rubygems/stub_specification.rb trunk/lib/rubygems/test_case.rb trunk/lib/rubygems/test_utilities.rb trunk/lib/rubygems/text.rb trunk/lib/rubygems/uninstaller.rb trunk/lib/rubygems/user_interaction.rb trunk/lib/rubygems/version.rb trunk/lib/rubygems.rb trunk/test/rubygems/test_gem.rb trunk/test/rubygems/test_gem_available_set.rb trunk/test/rubygems/test_gem_command.rb trunk/test/rubygems/test_gem_commands_cert_command.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_help_command.rb trunk/test/rubygems/test_gem_commands_install_command.rb trunk/test/rubygems/test_gem_commands_setup_command.rb trunk/test/rubygems/test_gem_commands_uninstall_command.rb trunk/test/rubygems/test_gem_commands_update_command.rb trunk/test/rubygems/test_gem_commands_yank_command.rb trunk/test/rubygems/test_gem_config_file.rb trunk/test/rubygems/test_gem_dependency.rb trunk/test/rubygems/test_gem_dependency_installer.rb trunk/test/rubygems/test_gem_ext_builder.rb trunk/test/rubygems/test_gem_ext_ext_conf_builder.rb trunk/test/rubygems/test_gem_gemcutter_utilities.rb trunk/test/rubygems/test_gem_impossible_dependencies_error.rb trunk/test/rubygems/test_gem_install_update_options.rb trunk/test/rubygems/test_gem_installer.rb trunk/test/rubygems/test_gem_local_remote_options.rb trunk/test/rubygems/test_gem_name_tuple.rb trunk/test/rubygems/test_gem_package.rb trunk/test/rubygems/test_gem_remote_fetcher.rb trunk/test/rubygems/test_gem_request.rb trunk/test/rubygems/test_gem_request_set.rb trunk/test/rubygems/test_gem_request_set_gem_dependency_api.rb trunk/test/rubygems/test_gem_request_set_lockfile.rb trunk/test/rubygems/test_gem_requirement.rb trunk/test/rubygems/test_gem_resolver.rb trunk/test/rubygems/test_gem_resolver_activation_request.rb trunk/test/rubygems/test_gem_resolver_api_set.rb trunk/test/rubygems/test_gem_resolver_api_specification.rb trunk/test/rubygems/test_gem_resolver_best_set.rb trunk/test/rubygems/test_gem_resolver_composed_set.rb trunk/test/rubygems/test_gem_resolver_conflict.rb trunk/test/rubygems/test_gem_resolver_dependency_request.rb trunk/test/rubygems/test_gem_resolver_git_set.rb trunk/test/rubygems/test_gem_resolver_git_specification.rb trunk/test/rubygems/test_gem_resolver_index_set.rb trunk/test/rubygems/test_gem_resolver_installer_set.rb trunk/test/rubygems/test_gem_resolver_lock_set.rb trunk/test/rubygems/test_gem_resolver_lock_specification.rb trunk/test/rubygems/test_gem_resolver_specification.rb trunk/test/rubygems/test_gem_resolver_vendor_set.rb trunk/test/rubygems/test_gem_security_policy.rb trunk/test/rubygems/test_gem_server.rb trunk/test/rubygems/test_gem_source.rb trunk/test/rubygems/test_gem_source_git.rb trunk/test/rubygems/test_gem_source_installed.rb trunk/test/rubygems/test_gem_source_lock.rb trunk/test/rubygems/test_gem_source_specific_file.rb trunk/test/rubygems/test_gem_source_vendor.rb trunk/test/rubygems/test_gem_specification.rb trunk/test/rubygems/test_gem_stub_specification.rb trunk/test/rubygems/test_gem_uninstaller.rb trunk/test/rubygems/test_kernel.rb trunk/test/rubygems/test_require.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 47581) +++ ChangeLog (revision 47582) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Sep 14 12:29:02 2014 SHIBATA Hiroshi <shibata.hiroshi@g...> + + * lib/rubygems: Update to RubyGems 2.4.1 master(713ab65) + Complete history at: + https://github.com/rubygems/rubygems/blob/master/History.txt#L3-L216 + + * test/rubygems: ditto. + Sun Sep 14 11:03:24 2014 Aaron Patterson <aaron@t...> * ext/psych/lib/psych.rb: update version Index: lib/rubygems/local_remote_options.rb =================================================================== --- lib/rubygems/local_remote_options.rb (revision 47581) +++ lib/rubygems/local_remote_options.rb (revision 47582) @@ -100,8 +100,8 @@ module Gem::LocalRemoteOptions https://github.com/ruby/ruby/blob/trunk/lib/rubygems/local_remote_options.rb#L100 def add_source_option accept_uri_http - add_option(:"Local/Remote", '--source URL', URI::HTTP, - 'Add URL as a remote source for gems') do |source, options| + add_option(:"Local/Remote", '-s', '--source URL', URI::HTTP, + 'Append URL to list of remote gem sources') do |source, options| source << '/' if source !~ /\/\z/ Index: lib/rubygems/basic_specification.rb =================================================================== --- lib/rubygems/basic_specification.rb (revision 47581) +++ lib/rubygems/basic_specification.rb (revision 47582) @@ -15,6 +15,11 @@ class Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/basic_specification.rb#L15 attr_writer :extension_dir # :nodoc: ## + # Is this specification ignored for activation purposes? + + attr_writer :ignored # :nodoc: + + ## # The path this gemspec was loaded from. This attribute is not persisted. attr_reader :loaded_from @@ -53,7 +58,16 @@ class Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/basic_specification.rb#L58 # Return true if this spec can require +file+. def contains_requirable_file? file - build_extensions + if instance_variable_defined?(:@ignored) or + instance_variable_defined?('@ignored') then + return false + elsif missing_extensions? then + @ignored = true + + warn "Ignoring #{full_name} because its extensions are not built. " + + "Try: gem pristine #{full_name}" + return false + end suffixes = Gem.suffixes @@ -120,11 +134,11 @@ class Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/basic_specification.rb#L134 # activated. def full_require_paths - full_paths = @require_paths.map do |path| + full_paths = raw_require_paths.map do |path| File.join full_gem_path, path end - full_paths.unshift extension_dir unless @extensions.empty? + full_paths.unshift extension_dir unless @extensions.nil? || @extensions.empty? full_paths end @@ -176,7 +190,7 @@ class Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/basic_specification.rb#L190 end def raw_require_paths # :nodoc: - @require_paths + Array(@require_paths) end ## @@ -197,13 +211,9 @@ class Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/basic_specification.rb#L211 # spec.require_path = '.' def require_paths - return @require_paths if @extensions.empty? - - relative_extension_dir = - File.join '..', '..', 'extensions', Gem::Platform.local.to_s, - Gem.extension_api_version, full_name + return raw_require_paths if @extensions.nil? || @extensions.empty? - [relative_extension_dir].concat @require_paths + [extension_dir].concat raw_require_paths end ## Index: lib/rubygems/installer_test_case.rb =================================================================== --- lib/rubygems/installer_test_case.rb (revision 47581) +++ lib/rubygems/installer_test_case.rb (revision 47582) @@ -101,6 +101,8 @@ class Gem::InstallerTestCase < Gem::Test https://github.com/ruby/ruby/blob/trunk/lib/rubygems/installer_test_case.rb#L101 @installer = util_installer @spec, @gemhome @user_installer = util_installer @user_spec, Gem.user_dir, :user + + Gem::Installer.path_warning = false end def util_gem_bindir spec = @spec # :nodoc: Index: lib/rubygems/rdoc.rb =================================================================== --- lib/rubygems/rdoc.rb (revision 47581) +++ lib/rubygems/rdoc.rb (revision 47582) @@ -263,7 +263,7 @@ class Gem::RDoc # :nodoc: all https://github.com/ruby/ruby/blob/trunk/lib/rubygems/rdoc.rb#L263 Gem::Requirement.new('>= 2.4.0') =~ self.class.rdoc_version r = new_rdoc - say "rdoc #{args.join ' '}" if Gem.configuration.really_verbose + verbose { "rdoc #{args.join ' '}" } Dir.chdir @spec.full_gem_path do begin @@ -279,7 +279,6 @@ class Gem::RDoc # :nodoc: all https://github.com/ruby/ruby/blob/trunk/lib/rubygems/rdoc.rb#L279 ui.errs.puts "... RDOC args: #{args.join(' ')}" ui.backtrace ex ui.errs.puts "(continuing with the rest of the installation)" - ensure end end end Index: lib/rubygems/gemcutter_utilities.rb =================================================================== --- lib/rubygems/gemcutter_utilities.rb (revision 47581) +++ lib/rubygems/gemcutter_utilities.rb (revision 47582) @@ -86,7 +86,7 @@ module Gem::GemcutterUtilities https://github.com/ruby/ruby/blob/trunk/lib/rubygems/gemcutter_utilities.rb#L86 def sign_in sign_in_host = nil sign_in_host ||= self.host - return if Gem.configuration.rubygems_api_key + return if api_key pretty_host = if Gem::DEFAULT_HOST == sign_in_host then 'RubyGems.org' Index: lib/rubygems/spec_fetcher.rb =================================================================== --- lib/rubygems/spec_fetcher.rb (revision 47581) +++ lib/rubygems/spec_fetcher.rb (revision 47582) @@ -186,7 +186,7 @@ class Gem::SpecFetcher https://github.com/ruby/ruby/blob/trunk/lib/rubygems/spec_fetcher.rb#L186 def suggest_gems_from_name gem_name gem_name = gem_name.downcase.tr('_-', '') max = gem_name.size / 2 - names = available_specs(:complete).first.values.flatten(1) + names = available_specs(:latest).first.values.flatten(1) matches = names.map { |n| next unless n.match_platform? @@ -258,18 +258,11 @@ class Gem::SpecFetcher https://github.com/ruby/ruby/blob/trunk/lib/rubygems/spec_fetcher.rb#L258 # etc.). If +gracefully_ignore+ is true, errors are ignored. def tuples_for(source, type, gracefully_ignore=false) # :nodoc: - cache = @caches[type] - - tuples = - begin - cache[source.uri] ||= - source.load_specs(type).sort_by { |tup| tup.name } - rescue Gem::RemoteFetcher::FetchError - raise unless gracefully_ignore - [] - end - - tuples + @caches[type][source.uri] ||= + source.load_specs(type).sort_by { |tup| tup.name } + rescue Gem::RemoteFetcher::FetchError + raise unless gracefully_ignore + [] end end Index: lib/rubygems/available_set.rb =================================================================== --- lib/rubygems/available_set.rb (revision 47581) +++ lib/rubygems/available_set.rb (revision 47582) @@ -126,7 +126,7 @@ class Gem::AvailableSet https://github.com/ruby/ruby/blob/trunk/lib/rubygems/available_set.rb#L126 dep = req.dependency match = @set.find_all do |t| - dep.matches_spec? t.spec + dep.match? t.spec end match.map do |t| Index: lib/rubygems/dependency_installer.rb =================================================================== --- lib/rubygems/dependency_installer.rb (revision 47581) +++ lib/rubygems/dependency_installer.rb (revision 47582) @@ -72,6 +72,7 @@ class Gem::DependencyInstaller https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_installer.rb#L72 def initialize options = {} @only_install_dir = !!options[:install_dir] @install_dir = options[:install_dir] || Gem.dir + @build_root = options[:build_root] options = DEFAULT_OPTIONS.merge options @@ -102,7 +103,7 @@ class Gem::DependencyInstaller https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_installer.rb#L103 @cache_dir = options[:cache_dir] || @install_dir - @errors = nil + @errors = [] end ## @@ -157,6 +158,7 @@ class Gem::DependencyInstaller https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_installer.rb#L158 dependency_list.remove_specs_unsatisfied_by dependencies end + ## # Creates an AvailableSet to install from based on +dep_or_name+ and # +version+ @@ -243,9 +245,9 @@ class Gem::DependencyInstaller https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_installer.rb#L245 # FIX if there is a problem talking to the network, we either need to always tell # the user (no really_verbose) or fail hard, not silently tell them that we just # couldn't find their requested gem. - if Gem.configuration.really_verbose then - say "Error fetching remote data:\t\t#{e.message}" - say "Falling back to local-only install" + verbose do + "Error fetching remote data:\t\t#{e.message}\n" \ + "Falling back to local-only install" end @domain = :local end @@ -375,13 +377,16 @@ class Gem::DependencyInstaller https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_installer.rb#L377 options = { :bin_dir => @bin_dir, :build_args => @build_args, + :document => @document, :env_shebang => @env_shebang, :force => @force, :format_executable => @format_executable, :ignore_dependencies => @ignore_dependencies, + :prerelease => @prerelease, :security_policy => @security_policy, :user_install => @user_install, :wrappers => @wrappers, + :build_root => @build_root, :install_as_default => @install_as_default } options[:install_dir] = @install_dir if @only_install_dir @@ -415,25 +420,59 @@ class Gem::DependencyInstaller https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_installer.rb#L420 end def resolve_dependencies dep_or_name, version # :nodoc: - as = available_set_for dep_or_name, version - - request_set = as.to_request_set install_development_deps + request_set = Gem::RequestSet.new + request_set.development = @development + request_set.development_shallow = @dev_shallow request_set.soft_missing = @force + request_set.prerelease = @prerelease request_set.remote = false unless consider_remote? installer_set = Gem::Resolver::InstallerSet.new @domain - installer_set.always_install.concat request_set.always_install installer_set.ignore_installed = @only_install_dir + if consider_local? + if dep_or_name =~ /\.gem$/ and File.file? dep_or_name then + src = Gem::Source::SpecificFile.new dep_or_name + installer_set.add_local dep_or_name, src.spec, src + version = src.spec.version if version == Gem::Requirement.default + elsif dep_or_name =~ /\.gem$/ then + Dir[dep_or_name].each do |name| + begin + src = Gem::Source::SpecificFile.new name + installer_set.add_local dep_or_name, src.spec, src + rescue Gem::Package::FormatError + end + end + # else This is a dependency. InstallerSet handles this case + end + end + + dependency = + if spec = installer_set.local?(dep_or_name) then + Gem::Dependency.new spec.name, version + elsif String === dep_or_name then + Gem::Dependency.new dep_or_name, version + else + dep_or_name + end + + dependency.prerelease = @prerelease + + request_set.import [dependency] + + installer_set.add_always_install dependency + + request_set.always_install = installer_set.always_install + if @ignore_dependencies then installer_set.ignore_dependencies = true request_set.ignore_dependencies = true request_set.soft_missing = true end - composed_set = Gem::Resolver.compose_sets as, installer_set + request_set.resolve installer_set - request_set.resolve composed_set + @errors.concat request_set.errors request_set end Index: lib/rubygems/ext/builder.rb =================================================================== --- lib/rubygems/ext/builder.rb (revision 47581) +++ lib/rubygems/ext/builder.rb (revision 47582) @@ -161,7 +161,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/lib/rubygems/ext/builder.rb#L161 results = builder.build(extension, @gem_dir, dest_path, results, @build_args, lib_dir) - say results.join("\n") if Gem.configuration.really_verbose + verbose { results.join("\n") } end end Index: lib/rubygems/ext/ext_conf_builder.rb =================================================================== --- lib/rubygems/ext/ext_conf_builder.rb (revision 47581) +++ lib/rubygems/ext/ext_conf_builder.rb (revision 47582) @@ -11,13 +11,15 @@ class Gem::Ext::ExtConfBuilder < Gem::Ex https://github.com/ruby/ruby/blob/trunk/lib/rubygems/ext/ext_conf_builder.rb#L11 FileEntry = FileUtils::Entry_ # :nodoc: def self.build(extension, directory, dest_path, results, args=[], lib_dir=nil) - tmp_dest = Dir.mktmpdir(".gem.", ".") + # relative path required as some versions of mktmpdir return an absolute + # path which breaks make if it includes a space in the name + tmp_dest = get_relative_path(Dir.mktmpdir(".gem.", ".")) t = nil Tempfile.open %w"siteconf .rb", "." do |siteconf| t = siteconf siteconf.puts "require 'rbconfig'" - siteconf.puts "dest_path = #{(tmp_dest || dest_path).dump}" + siteconf.puts "dest_path = #{tmp_dest.dump}" %w[sitearchdir sitelibdir].each do |dir| siteconf.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path" siteconf.puts "RbConfig::CONFIG['#{dir}'] = dest_path" @@ -25,14 +27,10 @@ class Gem::Ext::ExtConfBuilder < Gem::Ex https://github.com/ruby/ruby/blob/trunk/lib/rubygems/ext/ext_conf_builder.rb#L27 siteconf.flush - siteconf_path = File.expand_path siteconf.path - - rubyopt = ENV["RUBYOPT"] destdir = ENV["DESTDIR"] begin - ENV["RUBYOPT"] = ["-r#{siteconf_path}", rubyopt].compact.join(' ') - cmd = [Gem.ruby, File.basename(extension), *args].join ' ' + cmd = [Gem.ruby, "-r", get_relative_path(siteconf.path), File.basename(extension), *args].join ' ' begin run cmd, results @@ -42,7 +40,6 @@ class Gem::Ext::ExtConfBuilder < Gem::Ex https://github.com/ruby/ruby/blob/trunk/lib/rubygems/ext/ext_conf_builder.rb#L40 end ENV["DESTDIR"] = nil - ENV["RUBYOPT"] = rubyopt make dest_path, results @@ -57,11 +54,10 @@ class Gem::Ext::ExtConfBuilder < Gem::Ex https://github.com/ruby/ruby/blob/trunk/lib/rubygems/ext/ext_conf_builder.rb#L54 FileEntry.new(tmp_dest).traverse do |ent| destent = ent.class.new(dest_path, ent.rel) - destent.exist? or File.rename(ent.path, destent.path) + destent.exist? or FileUtils.mv(ent.path, destent.path) end end ensure - ENV["RUBYOPT"] = rubyopt ENV["DESTDIR"] = destdir end end @@ -72,5 +68,11 @@ class Gem::Ext::ExtConfBuilder < Gem::Ex https://github.com/ruby/ruby/blob/trunk/lib/rubygems/ext/ext_conf_builder.rb#L68 FileUtils.rm_rf tmp_dest if tmp_dest end + private + def self.get_relative_path(path) + path[0..Dir.pwd.length-1] = '.' if path.start_with?(Dir.pwd) + path + end + end Index: lib/rubygems/request_set.rb =================================================================== --- lib/rubygems/request_set.rb (revision 47581) +++ lib/rubygems/request_set.rb (revision 47582) @@ -1,4 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set.rb#L1 -require 'rubygems' require 'tsort' ## @@ -21,13 +20,23 @@ class Gem::RequestSet https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set.rb#L20 ## # Array of gems to install even if already installed - attr_reader :always_install + attr_accessor :always_install attr_reader :dependencies attr_accessor :development ## + # Errors fetching gems during resolution. + + attr_reader :errors + + ## + # Set to true if you want to install only direct development dependencies. + + attr_accessor :development_shallow + + ## # The set of git gems imported via load_gemdeps. attr_reader :git_set # :nodoc: @@ -38,11 +47,20 @@ class Gem::RequestSet https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set.rb#L47 attr_accessor :ignore_dependencies + attr_reader :install_dir # :nodoc: + + ## + # If true, allow dependencies to match prerelease gems. + + attr_accessor :prerelease + ## # When false no remote sets are used for resolving gems. attr_accessor :remote + attr_reader :resolver # :nodoc: + ## # Sets used for resolution @@ -71,11 +89,15 @@ class Gem::RequestSet https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set.rb#L89 @dependencies = deps @always_install = [] + @conservative = false @dependency_names = {} @development = false + @development_shallow = false + @errors = [] @git_set = nil @ignore_dependencies = false @install_dir = Gem.dir + @prerelease = false @remote = true @requests = [] @sets = [] @@ -116,12 +138,14 @@ class Gem::RequestSet https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set.rb#L138 def install options, &block # :yields: request, installer if dir = options[:install_dir] - return install_into dir, false, options, &block + requests = install_into dir, false, options, &block + return requests end cache_dir = options[:cache_dir] || Gem.dir + @prerelease = options[:prerelease] - specs = [] + requests = [] sorted_requests.each do |req| if req.installed? then @@ -139,10 +163,30 @@ class Gem::RequestSet https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set.rb#L163 yield req, inst if block_given? - specs << inst.install + requests << inst.install + end + + requests + ensure + raise if $! + return requests if options[:gemdeps] + + specs = requests.map do |request| + case request + when Gem::Resolver::ActivationRequest then + request.spec.spec + else + request + end end - specs + require 'rubygems/dependency_installer' + inst = Gem::DependencyInstaller.new options + inst.installed_gems.replace specs + + Gem.done_installing_hooks.each do |hook| + hook.call inst, specs + end unless Gem.done_installing_hooks.empty? end ## @@ -156,17 +200,19 @@ class Gem::RequestSet https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set.rb#L200 gemdeps = options[:gemdeps] @install_dir = options[:install_dir] || Gem.dir + @prerelease = options[:prerelease] @remote = options[:domain] != :local + @conservative = true if options[:conservative] - load_gemdeps gemdeps, options[:without_groups] + gem_deps_api = load_gemdeps gemdeps, options[:without_groups], true resolve if options[:explain] (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/