Skip to content
Browse files

Honor RUBYGEMS_GEMDEPS on startup

  • Loading branch information...
1 parent 5feb53d commit bea78565fa8269843e5cbbb041f49498c5732c7a @evanphx evanphx committed Oct 6, 2012
Showing with 18 additions and 6 deletions.
  1. +2 −0 lib/rubygems.rb
  2. +16 −6 test/rubygems/test_gem.rb
View
2 lib/rubygems.rb
@@ -1083,3 +1083,5 @@ def gem(gem_name, *requirements) # :doc:
# Enables the require hook for RubyGems.
require 'rubygems/custom_require'
+
+Gem.detect_gemdeps
View
22 test/rubygems/test_gem.rb
@@ -1370,26 +1370,36 @@ def test_auto_activation_of_detected_gemdeps_file
assert_equal [a,b,c], Gem.detect_gemdeps
end
- def notest_auto_activation_of_gemdeps
+ LIB_PATH = File.expand_path "../../../lib".untaint, __FILE__.untaint
+
+ def test_looks_for_gemdeps_files_automatically_on_start
+ util_clear_gems
+
a = new_spec "a", "1", nil, "lib/a.rb"
b = new_spec "b", "1", nil, "lib/b.rb"
c = new_spec "c", "1", nil, "lib/c.rb"
install_specs a, b, c
- path = File.join(@tempdir, "gd-tmp")
+ path = File.join @tempdir, "gem.deps.rb"
- Gem.ensure_gem_subdirectories path
+ File.open path, "w" do |f|
+ f.puts "gem 'a'"
+ f.puts "gem 'b'"
+ f.puts "gem 'c'"
+ end
+ path = File.join(@tempdir, "gd-tmp")
install_gem a, :install_dir => path
install_gem b, :install_dir => path
install_gem c, :install_dir => path
- ENV['RUBYGEMS_GEMDEPS'] = path
+ ENV['GEM_PATH'] = path
+ ENV['RUBYGEMS_GEMDEPS'] = "-"
- util_clear_gems
+ out = `#{Gem.ruby} -I #{LIB_PATH} -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
- assert_equal [a,b,c], Gem.detect_gemdeps
+ assert_equal '["a-1", "b-1", "c-1"]', out.strip
end
def with_plugin(path)

0 comments on commit bea7856

Please sign in to comment.
Something went wrong with that request. Please try again.