bottle: fix --merge with multiple formulae.

This commit is contained in:
Mike McQuaid 2013-09-21 15:16:16 +01:00
parent 5d3d385a65
commit 36f3617494

View File

@ -8,6 +8,7 @@ class BottleMerger < Formula
# a Formula. This object is used to access the Formula bottle DSL to merge
# multiple outputs of `brew bottle`.
url '1'
def self.reset_bottle; @bottle = Bottle.new; end
end
module Homebrew extend self
@ -104,17 +105,30 @@ module Homebrew extend self
end
end
def bottle
if ARGV.include? '--merge'
def merge
merge_hash = {}
ARGV.named.each do |argument|
bottle_block = IO.read(argument)
formula_name = bottle_filename_formula_name argument
merge_hash[formula_name] ||= []
bottle_block = IO.read argument
merge_hash[formula_name] << bottle_block
end
merge_hash.keys.each do |formula_name|
BottleMerger.reset_bottle
ohai formula_name
bottle_blocks = merge_hash[formula_name]
bottle_blocks.each do |bottle_block|
BottleMerger.class_eval bottle_block
end
bottle = BottleMerger.new.bottle
bottle_output bottle if bottle
end
exit 0
end
def bottle
merge if ARGV.include? '--merge'
ARGV.formulae.each do |f|
bottle_formula f
end