Make clean.create
to accept a block
Like `File.open`, yield an IO to write the file.
This commit is contained in:
parent
2b41df2477
commit
7ba88e13e0
@ -384,8 +384,21 @@ def package(vcs, rev, destdir, tmp = nil)
|
|||||||
puts $colorize.fail("patching failed")
|
puts $colorize.fail("patching failed")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
def (clean = []).add(n) push(n); n end
|
|
||||||
def clean.create(file, content = "") File.binwrite(add(file), content) end
|
class << (clean = [])
|
||||||
|
def add(n) push(n)
|
||||||
|
n
|
||||||
|
end
|
||||||
|
def create(file, content = "", &block)
|
||||||
|
add(file)
|
||||||
|
if block
|
||||||
|
File.open(file, "wb", &block)
|
||||||
|
else
|
||||||
|
File.binwrite(file, content)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
Dir.chdir(v) do
|
Dir.chdir(v) do
|
||||||
unless File.exist?("ChangeLog")
|
unless File.exist?("ChangeLog")
|
||||||
vcs.export_changelog(url, nil, revision, "ChangeLog")
|
vcs.export_changelog(url, nil, revision, "ChangeLog")
|
||||||
@ -406,7 +419,7 @@ def package(vcs, rev, destdir, tmp = nil)
|
|||||||
puts
|
puts
|
||||||
end
|
end
|
||||||
|
|
||||||
File.open(clean.add("cross.rb"), "w") do |f|
|
clean.create("cross.rb") do |f|
|
||||||
f.puts "Object.__send__(:remove_const, :CROSS_COMPILING) if defined?(CROSS_COMPILING)"
|
f.puts "Object.__send__(:remove_const, :CROSS_COMPILING) if defined?(CROSS_COMPILING)"
|
||||||
f.puts "CROSS_COMPILING=true"
|
f.puts "CROSS_COMPILING=true"
|
||||||
f.puts "Object.__send__(:remove_const, :RUBY_PLATFORM)"
|
f.puts "Object.__send__(:remove_const, :RUBY_PLATFORM)"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user