diff options
| author | Xu Cheng | 2015-02-21 18:57:29 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-02-22 00:06:45 +0800 |
| commit | c98bbb5481a737ea99f16a52f0cc30c0fb4f697d (patch) | |
| tree | 0161c7b5e1e2a0f44938825505404365f499b436 /Library/Homebrew/cmd | |
| parent | 3e35f1880b29cdd93129b94ed634b72d0e68945d (diff) | |
| download | homebrew-c98bbb5481a737ea99f16a52f0cc30c0fb4f697d.tar.bz2 | |
bottle: better match for formulea with `stable do` block
It will only work if the indent is correct.
Closes #37024.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/bottle.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index 913a22b1e..ae3c1a154 100644 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -247,7 +247,12 @@ module Homebrew odie 'Bottle block update failed!' unless string else update_or_add = 'add' - string = s.sub!(/( ((url|sha1|sha256|head|version|mirror) ['"][\S ]+['"]|revision \d+)\n+)+/m, '\0' + output + "\n") + if s.include? 'stable do' + indent = s.slice(/^ +stable do/).length - "stable do".length + string = s.sub!(/^ {#{indent}}stable do(.|\n)+?^ {#{indent}}end\n/m, '\0' + output + "\n") + else + string = s.sub!(/( ((url|sha1|sha256|head|version|mirror) ['"][\S ]+['"]|revision \d+)\n+)+/m, '\0' + output + "\n") + end odie 'Bottle block addition failed!' unless string end end |
