diff options
| author | Mike McQuaid | 2016-05-28 16:46:34 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2016-05-28 16:46:34 +0100 |
| commit | 9edb1a7a87f9ce7383c8ec6322a0f74a5487a0c4 (patch) | |
| tree | fc45e1642ccded42859c68cad992af5f4e42c989 /Library | |
| parent | 53b280c592af009483fad9180bf68e9fea781008 (diff) | |
| download | brew-9edb1a7a87f9ce7383c8ec6322a0f74a5487a0c4.tar.bz2 | |
bottle: JSON-related tweaks/fixes.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/bottle.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index c63f19240..7c93b2d6b 100644 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -366,12 +366,14 @@ module Homebrew update_or_add = "update" if ARGV.include? "--keep-old" mismatches = [] - s =~ / bottle do(.+?)end\n/m - bottle_block_contents = $1 + bottle_block_contents = s[/ bottle do(.+?)end\n/m, 1] bottle_block_contents.lines.each do |line| line = line.strip next if line.empty? key, value, _, tag = line.split " ", 4 + valid_key = %w[root_url prefix cellar revision sha1 sha256].include? key + next unless valid_key + value = value.to_s.delete ":'\"" tag = tag.to_s.delete ":" @@ -397,7 +399,9 @@ module Homebrew string = s.sub!(/ bottle do.+?end\n/m, output) odie "Bottle block update failed!" unless string else - odie "--keep-old was passed but there was no existing bottle block!" + if ARGV.include? "--keep-old" + odie "--keep-old was passed but there was no existing bottle block!" + end puts output update_or_add = "add" if s.include? "stable do" |
