diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-01 21:50:14 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-01 21:50:14 +0000 |
commit | effdbf5936cc090a618e13c8f9a1b5412ebab2fa (patch) | |
tree | c8410a18cbbe7ad013470fc06fef0c75ce0fd230 /lib/rubygems/test_utilities.rb | |
parent | 9c4ef4b191a1e6b9abdbb21c7c709d1d0f2397e6 (diff) | |
download | ruby-effdbf5936cc090a618e13c8f9a1b5412ebab2fa.tar.gz |
* lib/rubygems: Update to RubyGems HEAD(c202db2).
this version contains many enhancements see http://git.io/vtNwF
* test/rubygems: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/test_utilities.rb')
-rw-r--r-- | lib/rubygems/test_utilities.rb | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/rubygems/test_utilities.rb b/lib/rubygems/test_utilities.rb index 25786e6a21..6789f6efc5 100644 --- a/lib/rubygems/test_utilities.rb +++ b/lib/rubygems/test_utilities.rb @@ -186,7 +186,6 @@ end # f.gem 'a', 1 # f.spec 'a', 2 # f.gem 'b', 1' 'a' => '~> 1.0' -# f.clear # end # # The above declaration creates two gems, a-1 and b-1, with a dependency from @@ -214,19 +213,12 @@ class Gem::TestCase::SpecFetcherSetup @repository = repository @gems = {} + @downloaded = [] @installed = [] @operations = [] end ## - # Removes any created gems or specifications from Gem.dir (the default - # install location). - - def clear - @operations << [:clear] - end - - ## # Returns a Hash of created Specification full names and the corresponding # Specification. @@ -254,9 +246,6 @@ class Gem::TestCase::SpecFetcherSetup def execute_operations # :nodoc: @operations.each do |operation, *arguments| case operation - when :clear then - @test.util_clear_gems - @installed.clear when :gem then spec, gem = @test.util_gem(*arguments, &arguments.pop) @@ -264,6 +253,11 @@ class Gem::TestCase::SpecFetcherSetup @gems[spec] = gem @installed << spec + when :download then + spec, gem = @test.util_gem(*arguments, &arguments.pop) + + @gems[spec] = gem + @downloaded << spec when :spec then spec = @test.util_spec(*arguments, &arguments.pop) @@ -287,6 +281,17 @@ class Gem::TestCase::SpecFetcherSetup end ## + # Creates a gem with +name+, +version+ and +deps+. The created gem is + # downloaded in to the cache directory but is not installed + # + # The specification will be yielded before gem creation for customization, + # but only the block or the dependencies may be set, not both. + + def download name, version, dependencies = nil, &block + @operations << [:download, name, version, dependencies, block] + end + + ## # Creates a legacy platform spec with the name 'pl' and version 1 def legacy_platform @@ -312,17 +317,12 @@ class Gem::TestCase::SpecFetcherSetup gem_repo, @test.gem_repo = @test.gem_repo, @repository @test.uri = URI @repository - @test.util_setup_spec_fetcher(*@gems.keys) + @test.util_setup_spec_fetcher(*@downloaded) ensure @test.gem_repo = gem_repo @test.uri = URI gem_repo end - # This works around util_setup_spec_fetcher adding all created gems to the - # installed set. - Gem::Specification.reset - Gem::Specification.add_specs(*@installed) - @gems.each do |spec, gem| next unless gem |