bump-formula-pr: improve formula name guessing.
This commit is contained in:
parent
5244755a52
commit
99bb068ca7
@ -137,9 +137,16 @@ module Homebrew
|
|||||||
|
|
||||||
new_url = ARGV.value("url")
|
new_url = ARGV.value("url")
|
||||||
if new_url && !formula
|
if new_url && !formula
|
||||||
is_devel = ARGV.include?("--devel")
|
# Split the new URL on / and find any formulae that have the same URL
|
||||||
base_url = new_url.split("/")[0..4].join("/")
|
# 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)}/
|
base_url = /#{Regexp.escape(base_url)}/
|
||||||
|
is_devel = ARGV.include?("--devel")
|
||||||
guesses = []
|
guesses = []
|
||||||
Formula.each do |f|
|
Formula.each do |f|
|
||||||
if is_devel && f.devel && f.devel.url && f.devel.url.match(base_url)
|
if is_devel && f.devel && f.devel.url && f.devel.url.match(base_url)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user