bottle/test-bot: deep merge bottle JSON hashes.
This commit is contained in:
parent
28d99940de
commit
7829af7508
@ -336,7 +336,7 @@ module Homebrew
|
||||
write = ARGV.include? "--write"
|
||||
|
||||
bottles_hash = ARGV.named.reduce({}) do |hash, json_file|
|
||||
hash.merge! Utils::JSON.load(IO.read(json_file))
|
||||
deep_merge_hashes hash, Utils::JSON.load(IO.read(json_file))
|
||||
end
|
||||
|
||||
bottles_hash.each do |formula_name, bottle_hash|
|
||||
|
||||
@ -821,7 +821,7 @@ module Homebrew
|
||||
formula_packaged = {}
|
||||
|
||||
bottles_hash = json_files.reduce({}) do |hash, json_file|
|
||||
hash.merge! Utils::JSON.load(IO.read(json_file))
|
||||
deep_merge_hashes hash, Utils::JSON.load(IO.read(json_file))
|
||||
end
|
||||
|
||||
bottles_hash.each do |formula_name, bottle_hash|
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
require "pathname"
|
||||
require "exceptions"
|
||||
require "utils/hash"
|
||||
require "utils/json"
|
||||
require "utils/inreplace"
|
||||
require "utils/popen"
|
||||
|
||||
10
Library/Homebrew/utils/hash.rb
Normal file
10
Library/Homebrew/utils/hash.rb
Normal file
@ -0,0 +1,10 @@
|
||||
def deep_merge_hashes(hash1, hash2)
|
||||
merger = proc do |key, v1, v2|
|
||||
if Hash === v1 && Hash === v2
|
||||
v1.merge v2, &merger
|
||||
else
|
||||
v2
|
||||
end
|
||||
end
|
||||
hash1.merge hash2, &merger
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user