Permalink
Browse files

Restore normalization of GEM_HOME

After the implementation of Gem::PathSupport, the normalization of
GEM_HOME value from \\ to / was removed.

This normalization was in place to avoid GEM_HOME and GEM_PATH show
as duplicated values during `gem env` on Windows
  • Loading branch information...
1 parent 1618c00 commit 0cde38875bdb1de4f009e7d6ed6b21b29c140034 @luislavena luislavena committed Jun 10, 2011
Showing with 12 additions and 0 deletions.
  1. +5 −0 lib/rubygems/path_support.rb
  2. +7 −0 test/rubygems/test_gem_path_support.rb
@@ -22,6 +22,11 @@ def initialize(env=ENV)
# note 'env' vs 'ENV'...
@home = env["GEM_HOME"] || ENV["GEM_HOME"] || Gem.default_dir
+
+ if File::ALT_SEPARATOR then
+ @home = @home.gsub(File::ALT_SEPARATOR, File::SEPARATOR)
+ end
+
self.path = env["GEM_PATH"] || ENV["GEM_PATH"]
end
@@ -28,6 +28,13 @@ def test_initialize_home
assert_equal expected, ps.path
end
+ def test_initialize_home_normalize
+ alternate = @tempdir.gsub(File::SEPARATOR, File::ALT_SEPARATOR)
+ ps = Gem::PathSupport.new "GEM_HOME" => alternate
+
+ assert_equal @tempdir, ps.home, "normalize values"
+ end
+
def test_initialize_path
ps = Gem::PathSupport.new "GEM_PATH" => %W[#{@tempdir}/foo #{@tempdir}/bar]

0 comments on commit 0cde388

Please sign in to comment.