1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rubygems/test_case.rb: Use Dir.tmpdir for rubygems tests instead

of ./tmp/test.  Fixes [ruby-trunk - Bug #7717]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2013-01-22 21:43:44 +00:00
parent ddb9c34d16
commit 4cdb64316c
2 changed files with 18 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Wed Jan 23 06:43:26 2013 Eric Hodel <drbrain@segment7.net>
* lib/rubygems/test_case.rb: Use Dir.tmpdir for rubygems tests instead
of ./tmp/test. Fixes [ruby-trunk - Bug #7717]
Tue Jan 22 22:58:03 2013 Akinori MUSHA <knu@iDaemons.org> Tue Jan 22 22:58:03 2013 Akinori MUSHA <knu@iDaemons.org>
* misc/ruby-electric.el (ruby-electric-curlies): Fix the bug where * misc/ruby-electric.el (ruby-electric-curlies): Fix the bug where

View file

@ -118,8 +118,8 @@ class Gem::TestCase < MiniTest::Unit::TestCase
@current_dir = Dir.pwd @current_dir = Dir.pwd
@ui = Gem::MockGemUi.new @ui = Gem::MockGemUi.new
# Need to do this in the project because $SAFE fucks up _everything_ tmpdir = File.expand_path Dir.tmpdir
tmpdir = File.expand_path("tmp/test") tmpdir.untaint
if ENV['KEEP_FILES'] then if ENV['KEEP_FILES'] then
@tempdir = File.join(tmpdir, "test_rubygems_#{$$}.#{Time.now.to_i}") @tempdir = File.join(tmpdir, "test_rubygems_#{$$}.#{Time.now.to_i}")
@ -127,6 +127,17 @@ class Gem::TestCase < MiniTest::Unit::TestCase
@tempdir = File.join(tmpdir, "test_rubygems_#{$$}") @tempdir = File.join(tmpdir, "test_rubygems_#{$$}")
end end
@tempdir.untaint @tempdir.untaint
FileUtils.mkdir_p @tempdir
# This makes the tempdir consistent on OS X.
# File.expand_path Dir.tmpdir #=> "/var/..."
# Dir.chdir Dir.tmpdir do File.expand_path '.' end #=> "/private/var/..."
Dir.chdir @tempdir do
@tempdir = File.expand_path '.'
@tempdir.untaint
end
@gemhome = File.join @tempdir, 'gemhome' @gemhome = File.join @tempdir, 'gemhome'
@userhome = File.join @tempdir, 'userhome' @userhome = File.join @tempdir, 'userhome'