diff options
| author | ilovezfs | 2018-01-24 06:37:27 -0800 |
|---|---|---|
| committer | ilovezfs | 2018-01-28 08:10:53 -0800 |
| commit | 99bb068ca734c7096bf82c72730f1babc7f72431 (patch) | |
| tree | d2d0bb4d98fe7d1e1138a6d2ca16a33569691fff /Library/Homebrew | |
| parent | 5244755a5283f72ec1684a9e4b44a6aed2d51a82 (diff) | |
| download | brew-99bb068ca734c7096bf82c72730f1babc7f72431.tar.bz2 | |
bump-formula-pr: improve formula name guessing.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/dev-cmd/bump-formula-pr.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 7069a4816..334269a0a 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -137,9 +137,16 @@ module Homebrew new_url = ARGV.value("url") if new_url && !formula - is_devel = ARGV.include?("--devel") - base_url = new_url.split("/")[0..4].join("/") + # Split the new URL on / and find any formulae that have the same URL + # except for the last component, but don't try to match any more than the + # first five components since sometimes the last component isn't the only + # one to change. + new_url_split = new_url.split("/") + maximum_url_components_to_match = 5 + components_to_match = [new_url_split.count - 1, maximum_url_components_to_match].min + base_url = new_url_split.first(components_to_match).join("/") base_url = /#{Regexp.escape(base_url)}/ + is_devel = ARGV.include?("--devel") guesses = [] Formula.each do |f| if is_devel && f.devel && f.devel.url && f.devel.url.match(base_url) |
