Skip to content
Permalink
Browse files

Alter #489 to use GEM_SPEC_CACHE

This name better matches the default name (gem_spec_cache_dir) and is a
little clearer than "GEM_SPEC" which has multiple meanings in RubyGems.
  • Loading branch information...
drbrain committed Apr 4, 2013
1 parent 2d932ff commit 4e6cc6d21a855d7adbedac2edd523563d0fdd684
Showing with 14 additions and 7 deletions.
  1. +2 −0 History.txt
  2. +3 −1 lib/rubygems/path_support.rb
  3. +1 −1 lib/rubygems/test_case.rb
  4. +8 −5 test/rubygems/test_gem_path_support.rb
@@ -19,6 +19,8 @@ Minor enhancements:
Pull Request #452 by Vít Ondruch
* RubyGems uses ENV['MAKE'] or ENV['make'] over rbconfig.rb's make if present.
Pull Request #443 by Erik Hollensbe
* RubyGems can now save remote source cache files in an alternate directory
controlled by `ENV["GEM_SPEC_CACHE"]`. Pull Request #489 by Michal Papis

=== 2.0.4

@@ -33,7 +33,9 @@ def initialize(env=ENV)

self.path = env["GEM_PATH"] || ENV["GEM_PATH"]

@spec_cache_dir = env["GEM_SPEC"] || ENV["GEM_SPEC"] || Gem.default_spec_cache_dir
@spec_cache_dir =
env["GEM_SPEC_CACHE"] || ENV["GEM_SPEC_CACHE"] ||
Gem.default_spec_cache_dir
end

private
@@ -142,7 +142,7 @@ def setup

@gemhome = File.join @tempdir, 'gemhome'
@userhome = File.join @tempdir, 'userhome'
ENV["GEM_SPEC"] = File.join @tempdir, 'spec_cache'
ENV["GEM_SPEC_CACHE"] = File.join @tempdir, 'spec_cache'

@orig_ruby = if ENV['RUBY'] then
ruby = Gem.instance_variable_get :@ruby
@@ -66,16 +66,19 @@ def util_path
end

def test_initialize_spec
ENV["GEM_SPEC"] = nil
ENV["GEM_SPEC_CACHE"] = nil

ps = Gem::PathSupport.new
assert_equal Gem.default_spec_cache_dir, ps.spec_cache_dir

ENV["GEM_SPEC"] = 'bar'
ENV["GEM_SPEC_CACHE"] = 'bar'

ps = Gem::PathSupport.new
assert_equal ENV["GEM_SPEC"], ps.spec_cache_dir
ENV["GEM_SPEC"] = File.join @tempdir, 'spec_cache'
assert_equal ENV["GEM_SPEC_CACHE"], ps.spec_cache_dir

ENV["GEM_SPEC_CACHE"] = File.join @tempdir, 'spec_cache'

ps = Gem::PathSupport.new "GEM_SPEC" => "foo"
ps = Gem::PathSupport.new "GEM_SPEC_CACHE" => "foo"
assert_equal "foo", ps.spec_cache_dir
end
end

0 comments on commit 4e6cc6d

Please sign in to comment.
You can’t perform that action at this time.