diff options
| author | Mike McQuaid | 2014-01-31 19:07:49 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2014-01-31 19:07:57 +0100 |
| commit | d83ed0d793210bd692fe72830b8f3c0b0f41f5ab (patch) | |
| tree | f8d97de5c1af94890f0a34f568dc3594f80c669e /Library | |
| parent | 7ed97b14fd0ea9dd92e561c75dee43a9a6d5c571 (diff) | |
| download | brew-d83ed0d793210bd692fe72830b8f3c0b0f41f5ab.tar.bz2 | |
bottle: improve bottle commit writing.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/bottle.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index a299fa3be..4c602478b 100644 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -207,19 +207,20 @@ module Homebrew extend self if ARGV.include? '--write' f = Formula.factory formula_name - has_bottle_block = f.class.bottle.checksums.any? + update_or_add = nil inreplace f.path do |s| - if has_bottle_block - s.sub!(/ bottle do.+?end\n/m, output) + if s.include? 'bottle do' + update_or_add = 'add' + string = s.sub!(/ bottle do.+?end\n/m, output) + odie 'Bottle block replacement failed!' unless string else - s.sub!(/( (url|sha1|sha256|head|version) '\S*'\n+)+/m, '\0' + output + "\n") + update_or_add = 'update' + string = s.sub!(/( (url|sha1|sha256|head|version) '\S*'\n+)+/m, '\0' + output + "\n") + odie 'Bottle block addition failed!' unless string end end - update_or_add = has_bottle_block ? 'update' : 'add' - - system 'git', 'diff' safe_system 'git', 'commit', '--no-edit', '--verbose', "--message=#{f.name}: #{update_or_add} #{f.version} bottle.", '--', f.path |
