mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Revert changes to rdoc & rubygems regarding Tempfile.open(&block)
* They likely want to support older Ruby/tempfile versions
* Reverts part of e8c3872555
This commit is contained in:
parent
3beecafc2c
commit
d7492a0be8
7 changed files with 38 additions and 12 deletions
|
@ -36,6 +36,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|||
siteconf.close
|
||||
|
||||
destdir = ENV["DESTDIR"]
|
||||
|
||||
begin
|
||||
cmd = Gem.ruby.shellsplit << "-I" << File.expand_path("../../..", __FILE__) <<
|
||||
"-r" << get_relative_path(siteconf.path) << File.basename(extension)
|
||||
|
@ -75,6 +76,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|||
end
|
||||
ensure
|
||||
ENV["DESTDIR"] = destdir
|
||||
siteconf.close!
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ class TestRDocParser < RDoc::TestCase
|
|||
def test_class_for_forbidden
|
||||
omit 'chmod not supported' if Gem.win_platform?
|
||||
|
||||
Tempfile.open 'forbidden' do |io|
|
||||
tf = Tempfile.open 'forbidden' do |io|
|
||||
begin
|
||||
File.chmod 0000, io.path
|
||||
forbidden = @store.add_file io.path
|
||||
|
@ -117,7 +117,9 @@ class TestRDocParser < RDoc::TestCase
|
|||
ensure
|
||||
File.chmod 0400, io.path
|
||||
end
|
||||
io
|
||||
end
|
||||
tf.close!
|
||||
end
|
||||
|
||||
def test_class_for_modeline
|
||||
|
|
|
@ -154,7 +154,7 @@ class TestRDocRdBlockParser < RDoc::TestCase
|
|||
blank_line,
|
||||
blank_line)
|
||||
|
||||
Tempfile.open %w[parse_include .rd] do |io|
|
||||
tf = Tempfile.open %w[parse_include .rd] do |io|
|
||||
io.puts "=begin\ninclude ((*worked*))\n=end"
|
||||
io.flush
|
||||
|
||||
|
@ -163,7 +163,9 @@ class TestRDocRdBlockParser < RDoc::TestCase
|
|||
STR
|
||||
|
||||
assert_equal expected, parse(str)
|
||||
io
|
||||
end
|
||||
tf.close!
|
||||
end
|
||||
|
||||
def test_parse_heading
|
||||
|
|
|
@ -342,14 +342,16 @@ class TestRDocRDoc < RDoc::TestCase
|
|||
@rdoc.options.encoding = Encoding::ISO_8859_1
|
||||
@rdoc.store = RDoc::Store.new
|
||||
|
||||
Tempfile.open 'test.txt' do |io|
|
||||
tf = Tempfile.open 'test.txt' do |io|
|
||||
io.write 'hi'
|
||||
io.rewind
|
||||
|
||||
top_level = @rdoc.parse_file io.path
|
||||
|
||||
assert_equal Encoding::ISO_8859_1, top_level.absolute_name.encoding
|
||||
io
|
||||
end
|
||||
tf.close!
|
||||
end
|
||||
|
||||
def test_parse_file_forbidden
|
||||
|
@ -358,7 +360,7 @@ class TestRDocRDoc < RDoc::TestCase
|
|||
|
||||
@rdoc.store = RDoc::Store.new
|
||||
|
||||
Tempfile.open 'test.txt' do |io|
|
||||
tf = Tempfile.open 'test.txt' do |io|
|
||||
io.write 'hi'
|
||||
io.rewind
|
||||
|
||||
|
@ -377,7 +379,9 @@ class TestRDocRDoc < RDoc::TestCase
|
|||
ensure
|
||||
File.chmod 0400, io.path
|
||||
end
|
||||
io
|
||||
end
|
||||
tf.close!
|
||||
end
|
||||
|
||||
def test_remove_unparseable
|
||||
|
@ -474,7 +478,7 @@ class TestRDocRDoc < RDoc::TestCase
|
|||
end
|
||||
|
||||
def test_setup_output_dir_exists_file
|
||||
Tempfile.open 'test_rdoc_rdoc' do |tempfile|
|
||||
tf = Tempfile.open 'test_rdoc_rdoc' do |tempfile|
|
||||
path = tempfile.path
|
||||
|
||||
e = assert_raise RDoc::Error do
|
||||
|
@ -483,7 +487,9 @@ class TestRDocRDoc < RDoc::TestCase
|
|||
|
||||
assert_match(%r%#{Regexp.escape path} exists and is not a directory%,
|
||||
e.message)
|
||||
tempfile
|
||||
end
|
||||
tf.close!
|
||||
end
|
||||
|
||||
def test_setup_output_dir_exists_not_rdoc
|
||||
|
|
|
@ -887,7 +887,7 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|||
|
||||
def test_verify_corrupt
|
||||
skip "jruby strips the null byte and does not think it's corrupt" if Gem.java_platform?
|
||||
Tempfile.open 'corrupt' do |io|
|
||||
tf = Tempfile.open 'corrupt' do |io|
|
||||
data = Gem::Util.gzip 'a' * 10
|
||||
io.write \
|
||||
tar_file_header('metadata.gz', "\000x", 0644, data.length, Time.now)
|
||||
|
@ -902,7 +902,9 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|||
|
||||
assert_equal "tar is corrupt, name contains null byte in #{io.path}",
|
||||
e.message
|
||||
io
|
||||
end
|
||||
tf.close!
|
||||
end
|
||||
|
||||
def test_verify_empty
|
||||
|
|
|
@ -261,14 +261,16 @@ ruby "0"
|
|||
def test_load_gemdeps
|
||||
rs = Gem::RequestSet.new
|
||||
|
||||
Tempfile.open 'gem.deps.rb' do |io|
|
||||
tf = Tempfile.open 'gem.deps.rb' do |io|
|
||||
io.puts 'gem "a"'
|
||||
io.flush
|
||||
|
||||
gem_deps = rs.load_gemdeps io.path
|
||||
|
||||
assert_kind_of Gem::RequestSet::GemDependencyAPI, gem_deps
|
||||
io
|
||||
end
|
||||
tf.close!
|
||||
|
||||
assert_equal [dep('a')], rs.dependencies
|
||||
|
||||
|
@ -279,7 +281,7 @@ ruby "0"
|
|||
def test_load_gemdeps_installing
|
||||
rs = Gem::RequestSet.new
|
||||
|
||||
Tempfile.open 'gem.deps.rb' do |io|
|
||||
tf = Tempfile.open 'gem.deps.rb' do |io|
|
||||
io.puts 'ruby "0"'
|
||||
io.puts 'gem "a"'
|
||||
io.flush
|
||||
|
@ -287,7 +289,9 @@ ruby "0"
|
|||
gem_deps = rs.load_gemdeps io.path, [], true
|
||||
|
||||
assert_kind_of Gem::RequestSet::GemDependencyAPI, gem_deps
|
||||
io
|
||||
end
|
||||
tf.close!
|
||||
|
||||
assert_equal [dep('a')], rs.dependencies
|
||||
end
|
||||
|
@ -295,12 +299,14 @@ ruby "0"
|
|||
def test_load_gemdeps_without_groups
|
||||
rs = Gem::RequestSet.new
|
||||
|
||||
Tempfile.open 'gem.deps.rb' do |io|
|
||||
tf = Tempfile.open 'gem.deps.rb' do |io|
|
||||
io.puts 'gem "a", :group => :test'
|
||||
io.flush
|
||||
|
||||
rs.load_gemdeps io.path, [:test]
|
||||
io
|
||||
end
|
||||
tf.close!
|
||||
|
||||
assert_empty rs.dependencies
|
||||
end
|
||||
|
@ -388,7 +394,7 @@ ruby "0"
|
|||
|
||||
rs = Gem::RequestSet.new
|
||||
|
||||
Tempfile.open 'gem.deps.rb' do |io|
|
||||
tf = Tempfile.open 'gem.deps.rb' do |io|
|
||||
io.puts <<-GEMS_DEPS_RB
|
||||
gem "#{name}", :git => "#{repository}"
|
||||
GEMS_DEPS_RB
|
||||
|
@ -396,7 +402,9 @@ ruby "0"
|
|||
io.flush
|
||||
|
||||
rs.load_gemdeps io.path
|
||||
io
|
||||
end
|
||||
tf.close!
|
||||
|
||||
res = rs.resolve
|
||||
assert_equal 1, res.size
|
||||
|
@ -449,7 +457,7 @@ ruby "0"
|
|||
|
||||
rs = Gem::RequestSet.new
|
||||
|
||||
Tempfile.open 'gem.deps.rb' do |io|
|
||||
tf = Tempfile.open 'gem.deps.rb' do |io|
|
||||
io.puts <<-GEMS_DEPS_RB
|
||||
gem "#{a_name}", :path => "#{a_directory}"
|
||||
gem "#{b_name}", :path => "#{b_directory}"
|
||||
|
@ -458,7 +466,9 @@ ruby "0"
|
|||
io.flush
|
||||
|
||||
rs.load_gemdeps io.path
|
||||
io
|
||||
end
|
||||
tf.close!
|
||||
|
||||
res = rs.resolve
|
||||
assert_equal 2, res.size
|
||||
|
|
|
@ -632,7 +632,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_load
|
||||
Tempfile.open 'gem.deps.rb' do |io|
|
||||
tf = Tempfile.open 'gem.deps.rb' do |io|
|
||||
io.write <<-GEM_DEPS
|
||||
gem 'a'
|
||||
|
||||
|
@ -647,7 +647,9 @@ end
|
|||
assert_equal gda, gda.load
|
||||
|
||||
assert_equal [dep('a'), dep('b')], @set.dependencies
|
||||
io
|
||||
end
|
||||
tf.close!
|
||||
end
|
||||
|
||||
def test_pin_gem_source
|
||||
|
|
Loading…
Add table
Reference in a new issue