diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-30 23:27:52 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-30 23:27:52 +0000 |
commit | 73fc703f7cbb2e6dfd50897d26b37fe8e76064e3 () | |
tree | 0296426c8ac01331f2d33dde54fd9f1e183ea974 | |
parent | 6727297dfecddaef6b1166a7f442db2a22929c65 (diff) |
* lib/rubygems: Update to RubyGems master 66e5c39. Notable changes:
Implement gem.deps.rb (Gemfile) .lock support Fixed `gem uninstall` for a relative directory in GEM_HOME. * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
31 files changed, 598 insertions, 26 deletions
@@ -1,3 +1,13 @@ Sun Dec 1 06:00:49 2013 Aman Gupta <[email protected]> * test/ruby/test_gc.rb (test_gc_reason): Force minor GC by consuming @@ -178,8 +178,8 @@ module Gem def self.try_activate path # finds the _latest_ version... regardless of loaded specs and their deps # if another gem had a requirement that would mean we shouldn't - # activate the latest version, then either it would alreaby be activated - # or if it was ambigious (and thus unresolved) the code in our custom # require will try to activate the more specific version. spec = Gem::Specification.find_inactive_by_path path @@ -5,6 +5,16 @@ class Gem::BasicSpecification ## # The path this gemspec was loaded from. This attribute is not persisted. attr_reader :loaded_from @@ -68,8 +78,9 @@ class Gem::BasicSpecification # end def extension_install_dir - File.join base_dir, 'extensions', Gem::Platform.local.to_s, - Gem.extension_api_version, full_name end def find_full_gem_path # :nodoc: @@ -141,9 +152,10 @@ class Gem::BasicSpecification def loaded_from= path @loaded_from = path && path.to_s - @full_gem_path = nil - @gems_dir = nil - @base_dir = nil end ## @@ -98,7 +98,7 @@ class Gem::Ext::Builder def initialize spec, build_args = spec.build_args @spec = spec @build_args = build_args - @gem_dir = spec.gem_dir @ran_rake = nil end @@ -19,7 +19,7 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder rake = ENV['rake'] rake ||= begin - "\"#{Gem.ruby}\" -rubygems #{Gem.bin_path('rake', 'rake')}" rescue Gem::Exception end @@ -8,7 +8,7 @@ rescue Gem::LoadError # swallow else # This will force any deps that 'rdoc' might have - # (such as json) that are ambigious to be activated, which # is important because we end up using Specification.reset # and we don't want the warning it pops out. Gem.finish_resolve @@ -67,6 +67,7 @@ class Gem::RequestSet @dependency_names = {} @development = false @git_set = nil @requests = [] @sets = [] @soft_missing = false @@ -143,7 +144,11 @@ class Gem::RequestSet # dependencies file are not used. See Gem::Installer for other +options+. def install_from_gemdeps options, &block - load_gemdeps options[:gemdeps], options[:without_groups] resolve @@ -154,7 +159,12 @@ class Gem::RequestSet puts " #{s}" end else - install options, &block end end @@ -194,6 +204,11 @@ class Gem::RequestSet @git_set = Gem::Resolver::GitSet.new @vendor_set = Gem::Resolver::VendorSet.new gf = Gem::RequestSet::GemDependencyAPI.new self, path gf.without_groups = without_groups if without_groups gf.load @@ -264,3 +279,4 @@ class Gem::RequestSet end require 'rubygems/request_set/gem_dependency_api' @@ -1,3 +1,8 @@ class Gem::RequestSet::Lockfile ## @@ -100,7 +105,7 @@ class Gem::RequestSet::Lockfile out << nil end - def relative_path_from(dest, base) dest = File.expand_path(dest) base = File.expand_path(base) @@ -263,6 +268,9 @@ class Gem::RequestSet::Lockfile get while not @tokens.empty? and peek.first == type end def to_s @set.resolve @@ -293,6 +301,10 @@ class Gem::RequestSet::Lockfile [byte_offset - @line_pos, @line] end def tokenize # :nodoc: @line = 0 @line_pos = 0 @@ -343,6 +355,8 @@ class Gem::RequestSet::Lockfile end @tokens end ## @@ -352,5 +366,14 @@ class Gem::RequestSet::Lockfile @tokens.unshift @current_token end end @@ -17,5 +17,15 @@ class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet end end end @@ -11,6 +11,12 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set ## # Contains repositories needing submodules attr_reader :need_submodules # :nodoc: @@ -30,6 +36,7 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set @git = ENV['git'] || 'git' @need_submodules = {} @repositories = {} @specs = {} end @@ -57,6 +64,7 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set @repositories.each do |name, (repository, reference)| source = Gem::Source::Git.new name, repository, reference source.specs.each do |spec| git_spec = Gem::Resolver::GitSpecification.new self, spec, source @@ -66,5 +74,20 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set end end end @@ -46,5 +46,29 @@ class Gem::Resolver::IndexSet < Gem::Resolver::Set res end end @@ -9,7 +9,7 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set # Creates a new LockSet from the given +source+ def initialize source - @source = source @specs = [] end @@ -56,5 +56,21 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set found.source.fetch_spec tuple end end @@ -64,5 +64,20 @@ class Gem::Resolver::VendorSet < Gem::Resolver::Set @specs.fetch key end end @@ -49,6 +49,7 @@ class Gem::Source case other when Gem::Source::Installed, Gem::Source::Local, Gem::Source::SpecificFile, Gem::Source::Git, Gem::Source::Vendor then @@ -213,5 +214,6 @@ require 'rubygems/source/git' require 'rubygems/source/installed' require 'rubygems/source/specific_file' require 'rubygems/source/local' require 'rubygems/source/vendor' @@ -31,6 +31,11 @@ class Gem::Source::Git < Gem::Source attr_reader :repository ## # Does this repository need submodules checked out too? attr_reader :need_submodules @@ -50,14 +55,16 @@ class Gem::Source::Git < Gem::Source @reference = reference @need_submodules = submodules - @git = ENV['git'] || 'git' end def <=> other case other when Gem::Source::Git then 0 - when Gem::Source::Installed then -1 when Gem::Source then 1 @@ -114,6 +121,13 @@ class Gem::Source::Git < Gem::Source end ## # A short reference for use in git gem directories def dir_shortref # :nodoc: @@ -130,14 +144,14 @@ class Gem::Source::Git < Gem::Source # The directory where the git gem will be installed. def install_dir # :nodoc: - File.join Gem.dir, 'bundler', 'gems', "#{@name}-#{dir_shortref}" end ## # The directory where the git gem's repository will be cached. def repo_cache_dir # :nodoc: - File.join Gem.dir, 'cache', 'bundler', 'git', "#{@name}-#{uri_hash}" end ## @@ -162,7 +176,17 @@ class Gem::Source::Git < Gem::Source Dir.chdir directory do spec = Gem::Specification.load file - spec.full_gem_path = File.expand_path '.' if spec spec end end.compact @@ -12,7 +12,8 @@ class Gem::Source::Installed < Gem::Source def <=> other case other - when Gem::Source::Vendor then -1 when Gem::Source::Installed then 0 @@ -15,7 +15,8 @@ class Gem::Source::Local < Gem::Source def <=> other case other - when Gem::Source::Installed then -1 when Gem::Source::Local then 0 @@ -0,0 +1,44 @@ @@ -12,6 +12,8 @@ class Gem::Source::Vendor < Gem::Source::Installed def <=> other case other when Gem::Source::Vendor then 0 when Gem::Source then @@ -1031,7 +1031,7 @@ class Gem::Specification < Gem::BasicSpecification spec = eval code, binding, file if Gem::Specification === spec - spec.loaded_from = file.to_s LOAD_CACHE[file] = spec return spec end @@ -101,6 +101,24 @@ class Gem::FakeFetcher response end def fetch_size(path) path = path.to_s @paths << path @@ -86,6 +86,7 @@ class Gem::Validator Gem::Specification.each do |spec| next unless gems.include? spec.name unless gems.empty? gem_name = spec.file_name gem_path = spec.cache_file @@ -45,16 +45,88 @@ class TestGemRequestSet < Gem::TestCase rs = Gem::RequestSet.new installed = [] Tempfile.open 'gem.deps.rb' do |io| io.puts 'gem "a"' io.flush - rs.install_from_gemdeps :gemdeps => io.path do |req, installer| installed << req.full_name end end assert_includes installed, 'a-2' end def test_load_gemdeps @@ -104,6 +104,16 @@ DEPENDENCIES assert_equal %w[a-2], lockfile_set.specs.map { |tuple| tuple.full_name } end def test_peek @lockfile.instance_variable_set :@tokens, [:token] @@ -211,6 +221,12 @@ DEPENDENCIES e.message end def test_to_s_gem spec_fetcher do |fetcher| fetcher.spec 'a', 2 @@ -400,5 +416,15 @@ DEPENDENCIES assert_equal :token, @lockfile.get end end @@ -52,6 +52,14 @@ class TestGemResolverGitSet < Gem::TestCase assert_equal [@set.specs['a']], found end def test_prefetch name, _, repository, = git_gem @@ -98,5 +106,25 @@ class TestGemResolverGitSet < Gem::TestCase refute_empty @set.specs, 'the git source does not filter' end end @@ -46,5 +46,39 @@ class TestGemResolverGitSpecification < Gem::TestCase assert called end end @@ -5,7 +5,8 @@ class TestGemResolverLockSet < Gem::TestCase def setup super - @source = Gem::Source.new @gem_repo @set = Gem::Resolver::LockSet.new @source end @@ -21,7 +22,7 @@ class TestGemResolverLockSet < Gem::TestCase assert_equal 'a', spec.name assert_equal v(2), spec.version assert_equal Gem::Platform::RUBY, spec.platform - assert_equal @source, spec.source end def test_find_all @@ -41,7 +42,7 @@ class TestGemResolverLockSet < Gem::TestCase version = v(2) @set.add 'a', version, Gem::Platform::RUBY - loaded = @set.load_spec 'a', version, Gem::Platform::RUBY, @source assert_kind_of Gem::Specification, loaded @@ -13,6 +13,14 @@ class TestGemSourceGit < Gem::TestCase @source = Gem::Source::Git.new @name, @repository, 'master', false end def test_checkout @source.checkout @@ -96,6 +104,13 @@ class TestGemSourceGit < Gem::TestCase File.join Gem.dir, 'cache', 'bundler', 'git', "a-#{@hash}" assert_equal expected, @source.repo_cache_dir end def test_rev_parse @@ -118,6 +133,14 @@ class TestGemSourceGit < Gem::TestCase refute_equal master_head, source.rev_parse end def test_spaceship git = Gem::Source::Git.new 'a', 'git/a', 'master', false remote = Gem::Source.new @gem_repo @@ -165,11 +188,27 @@ class TestGemSourceGit < Gem::TestCase a_spec = specs.shift assert_equal source.install_dir, a_spec.full_gem_path b_spec = specs.shift assert_equal File.join(source.install_dir, 'b'), b_spec.full_gem_path end def test_uri_hash @@ -0,0 +1,107 @@ @@ -716,6 +716,20 @@ dependencies: [] assert_equal @a2, spec end def test_self_load_tainted full_path = @a2.spec_file write_file full_path do |io| @@ -32,5 +32,14 @@ class TestGemValidator < Gem::TestCase assert_equal expected, alien end end |