From fd254c3874ad949af9ad3d6510611a31ebc9bc47 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 31 Oct 2013 19:03:23 -0700 Subject: bottle: improve written bottle output. --- Library/Homebrew/cmd/bottle.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index 3927d84da..69ae64000 100644 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -200,15 +200,16 @@ module Homebrew extend self else formula_path = HOMEBREW_REPOSITORY+formula_relative_path end + has_bottle_block = f.class.send(:bottle).checksums.any? inreplace formula_path do |s| - if f.bottle - s.gsub!(/ bottle do.+?end\n/m, output) + if has_bottle_block + s.sub!(/ bottle do.+?end\n/m, output) else - s.gsub!(/( (url|sha1|head|version) '\S*'\n+)+/m, '\0' + output + "\n") + s.sub!(/( (url|sha1|head|version) '\S*'\n+)+/m, '\0' + output + "\n") end end - update_or_add = f.bottle.nil? ? 'add' : 'update' + update_or_add = has_bottle_block ? 'update' : 'add' safe_system 'git', 'commit', formula_path, '-m', "#{f.name}: #{update_or_add} bottle." -- cgit v1.2.3