diff options
| author | phinze | 2013-07-08 19:56:43 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-07-09 20:52:51 -0500 |
| commit | 9a94a77fa3438277d453674bb745ddcdd639a0a8 (patch) | |
| tree | cdfefed649413c29f05c4a9ea64848f6ad0eee66 /Library/Homebrew/cmd | |
| parent | 81984411b0d9d4295b4782a9490bee928f460155 (diff) | |
| download | brew-9a94a77fa3438277d453674bb745ddcdd639a0a8.tar.bz2 | |
Properly define tapped formulae in update
A tapped formula is a ruby file present:
- in the root of the tap
- in directory of the tap called Formula
- in a directory of the tap called HomebrewFormula
And nowhere else. This corrects an overzealous definition of tapped
formula in the updater. (the correct definition has been in Pathname
since e613cbe5783cea2abb8100b56c22126a1ab6b9f2)
Refs Homebrew/homebrew#19743.
Closes Homebrew/homebrew#21087.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/update.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb index 6f4992dee..b3248c5cb 100644 --- a/Library/Homebrew/cmd/update.rb +++ b/Library/Homebrew/cmd/update.rb @@ -146,11 +146,24 @@ class Report < Hash def tapped_formula_for key fetch(key, []).map do |path| case path when %r{^Library/Taps/(\w+-\w+/.*)} - Pathname.new($1) + relative_path = $1 + if valid_formula_location?(relative_path) + Pathname.new(relative_path) + end end end.compact end + def valid_formula_location?(relative_path) + ruby_file = /\A.*\.rb\Z/ + parts = relative_path.split('/')[1..-1] + [ + parts.length == 1 && parts.first =~ ruby_file, + parts.length == 2 && parts.first == 'Formula' && parts.last =~ ruby_file, + parts.length == 2 && parts.first == 'HomebrewFormula' && parts.last =~ ruby_file, + ].any? + end + def new_tapped_formula tapped_formula_for :A end |
