bottle: improve bottle commit writing.
This commit is contained in:
parent
7ed97b14fd
commit
d83ed0d793
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user