unpack: use correct constant scope for DATA
Formula::DATA only worked by accident of implementation; DATA during the build is actually Object::DATA, so we should mirror that here. This reverts commit b12444ba6e1ac1d596a70ff4c777d9386d0791ac.
This commit is contained in:
parent
69573ba7a2
commit
32b7c9ff15
@ -28,22 +28,13 @@ module UnpackPatch
|
|||||||
return unless ARGV.flag? "--patch"
|
return unless ARGV.flag? "--patch"
|
||||||
|
|
||||||
begin
|
begin
|
||||||
# Silence complaints about re-setting constants.
|
|
||||||
old_verbose = $VERBOSE
|
old_verbose = $VERBOSE
|
||||||
$VERBOSE = nil
|
$VERBOSE = nil
|
||||||
Formula.const_set "DATA", ScriptDataReader.load(path)
|
Object.const_set "DATA", ScriptDataReader.load(path)
|
||||||
ensure
|
ensure
|
||||||
$VERBOSE = old_verbose
|
$VERBOSE = old_verbose
|
||||||
end
|
end
|
||||||
|
|
||||||
# Legacy patches are fixed by setting Formula::DATA.
|
|
||||||
# Now, handle instances of IOPatch.
|
|
||||||
patchlist.select{|p| p.is_a? IOPatch}.each do |patch|
|
|
||||||
if patch.instance_variable_get(:@io) == :DATA
|
|
||||||
patch.instance_variable_set :@io, ScriptDataReader.load(path)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user