From 4b355399789cd79009d42a05a742efc7954cf380 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 8 Jun 2013 16:48:43 +0100 Subject: [PATCH] brew-bottle: merge arg for bottle metadata files. Closes Homebrew/homebrew#20266. --- Library/Homebrew/cmd/bottle.rb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index 4f817b82e0..83dd729c76 100644 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -3,6 +3,13 @@ require 'bottles' require 'tab' require 'keg' +class BottleMerger < Formula + # This provides a URL and Version which are the only needed properties of + # a Formula. This object is used to access the Formula bottle DSL to merge + # multiple outputs of `brew bottle`. + url '1' +end + module Homebrew extend self def keg_contains string, keg quiet_system 'fgrep', '--recursive', '--quiet', '--max-count=1', string, keg @@ -79,7 +86,17 @@ module Homebrew extend self end def bottle - ARGV.formulae.each do|f| + if ARGV.include? '--merge' + ARGV.named.each do |argument| + bottle_block = IO.read(argument) + BottleMerger.class_eval bottle_block + end + bottle = BottleMerger.new.bottle + bottle_output bottle if bottle + exit 0 + end + + ARGV.formulae.each do |f| bottle_formula Formula.factory f end end