From 08aa6d59a2bc35556125d373f90f5286440c6f84 Mon Sep 17 00:00:00 2001 From: drbrain Date: Fri, 18 Oct 2013 21:56:18 +0000 Subject: * lib/rubygems: Update to RubyGems master 0a3814b. Changes: Fixed extension directory in Gem::Specification#require_paths. Allow installation of gems when $HOME is nonexistent or unwritable. Use proper API in InstallCommand. Improve support for path option in gem dependency files. Remove warnings. * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/basic_specification.rb | 2 +- lib/rubygems/commands/install_command.rb | 6 +++--- lib/rubygems/request_set.rb | 10 +++++++++- lib/rubygems/request_set/gem_dependency_api.rb | 4 ++-- lib/rubygems/source.rb | 14 +++++++------- lib/rubygems/source/installed.rb | 1 + lib/rubygems/spec_fetcher.rb | 7 ++++++- lib/rubygems/stub_specification.rb | 7 +++++++ lib/rubygems/test_case.rb | 6 +++++- 9 files changed, 41 insertions(+), 16 deletions(-) (limited to 'lib/rubygems') diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb index 7f738155c9..7d0469000b 100644 --- a/lib/rubygems/basic_specification.rb +++ b/lib/rubygems/basic_specification.rb @@ -176,7 +176,7 @@ class Gem::BasicSpecification return @require_paths if @extensions.empty? relative_extension_install_dir = - File.join '..', '..', '..', 'extensions', Gem::Platform.local.to_s, + File.join '..', '..', 'extensions', Gem::Platform.local.to_s, Gem.extension_api_version, full_name @require_paths + [relative_extension_install_dir] diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb index 0bb40ed633..1f3210ff5d 100644 --- a/lib/rubygems/commands/install_command.rb +++ b/lib/rubygems/commands/install_command.rb @@ -135,7 +135,7 @@ to write the specification by hand. For example: def execute if gf = options[:gemdeps] then install_from_gemdeps gf - return + return # not reached end @installed_specs = [] @@ -151,7 +151,7 @@ to write the specification by hand. For example: show_installed - raise Gem::SystemExitException, exit_code + terminate_interaction exit_code end def install_from_gemdeps gf # :nodoc: @@ -173,7 +173,7 @@ to write the specification by hand. For example: @installed_specs = specs - raise Gem::SystemExitException, 0 + terminate_interaction end def install_gem name, version # :nodoc: diff --git a/lib/rubygems/request_set.rb b/lib/rubygems/request_set.rb index eb45516cfb..9a7ac83e91 100644 --- a/lib/rubygems/request_set.rb +++ b/lib/rubygems/request_set.rb @@ -159,7 +159,15 @@ class Gem::RequestSet # Resolve the requested dependencies and return an Array of Specification # objects to be activated. - def resolve set = nil + def resolve set = Gem::DependencyResolver::IndexSet.new + sets = [set, @vendor_set].compact + + set = if sets.size == 1 then + sets.first + else + Gem::DependencyResolver.compose_sets(*sets) + end + resolver = Gem::DependencyResolver.new @dependencies, set resolver.development = @development resolver.soft_missing = @soft_missing diff --git a/lib/rubygems/request_set/gem_dependency_api.rb b/lib/rubygems/request_set/gem_dependency_api.rb index 40dccb6433..f11ffb12c3 100644 --- a/lib/rubygems/request_set/gem_dependency_api.rb +++ b/lib/rubygems/request_set/gem_dependency_api.rb @@ -51,8 +51,8 @@ class Gem::RequestSet::GemDependencyAPI @vendor_set.add_vendor_gem name, directory end - group = options.delete :group - all_groups = group ? Array(group) : [] + g = options.delete :group + all_groups = g ? Array(g) : [] groups = options.delete :groups all_groups |= groups if groups diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb index ecfb6c8897..394ea6cf22 100644 --- a/lib/rubygems/source.rb +++ b/lib/rubygems/source.rb @@ -47,12 +47,7 @@ class Gem::Source include Comparable def ==(other) - case other - when self.class - @uri == other.uri - else - false - end + self.class === other and @uri == other.uri end alias_method :eql?, :== @@ -71,7 +66,12 @@ class Gem::Source end def update_cache? - @update_cache ||= File.stat(Gem.user_home).uid == Process.uid + @update_cache ||= + begin + File.stat(Gem.user_home).uid == Process.uid + rescue Errno::ENOENT + false + end end def fetch_spec(name) diff --git a/lib/rubygems/source/installed.rb b/lib/rubygems/source/installed.rb index 7709778791..8e3a3560bf 100644 --- a/lib/rubygems/source/installed.rb +++ b/lib/rubygems/source/installed.rb @@ -1,6 +1,7 @@ class Gem::Source::Installed < Gem::Source def initialize + @uri = nil end ## diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb index 3ae7afc9d9..4bef93351f 100644 --- a/lib/rubygems/spec_fetcher.rb +++ b/lib/rubygems/spec_fetcher.rb @@ -38,7 +38,12 @@ class Gem::SpecFetcher end def initialize - @update_cache = File.stat(Gem.user_home).uid == Process.uid + @update_cache = + begin + File.stat(Gem.user_home).uid == Process.uid + rescue Errno::EACCES, Errno::ENOENT + false + end @specs = {} @latest_specs = {} diff --git a/lib/rubygems/stub_specification.rb b/lib/rubygems/stub_specification.rb index ffa2d3f964..221dc1d404 100644 --- a/lib/rubygems/stub_specification.rb +++ b/lib/rubygems/stub_specification.rb @@ -165,5 +165,12 @@ class Gem::StubSpecification < Gem::BasicSpecification @version ||= data.version end + ## + # Is there a stub line present for this StubSpecification? + + def stubbed? + data.is_a? StubLine + end + end diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index a5a81d72a2..1e6d9feeeb 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -1098,11 +1098,15 @@ Also, a list: ## # A vendor_gem is used with a gem dependencies file. The gem created here # has no files, just a gem specification for the given +name+ and +version+. + # + # Yields the +specification+ to the block, if given def vendor_gem name = 'a', version = 1 directory = File.join 'vendor', name - vendor_spec = Gem::Specification.new name, version + vendor_spec = Gem::Specification.new name, version do |specification| + yield specification if block_given? + end FileUtils.mkdir_p directory -- cgit v1.2.3