Skip to content
Snippets Groups Projects
Commit d83ed0d7 authored by Mike McQuaid's avatar Mike McQuaid
Browse files

bottle: improve bottle commit writing.

parent 7ed97b14
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment