Skip to content
Snippets Groups Projects
Commit 19df0321 authored by ilovezfs's avatar ilovezfs
Browse files

bump-formula-pr: --mirror option

parent 743e9bbd
No related branches found
No related tags found
No related merge requests found
......@@ -100,6 +100,7 @@ module Homebrew
new_hash = ARGV.value(hash_type)
new_tag = ARGV.value("tag")
new_revision = ARGV.value("revision")
new_mirror = ARGV.value("mirror")
new_url_hash = if new_url && new_hash
true
elsif new_tag && new_revision
......@@ -132,6 +133,10 @@ module Homebrew
replacement_pairs << [/^ revision \d+\n(\n( head "))?/m, "\\2"]
end
if requested_spec == :stable
replacement_pairs << [/(^ mirror .*\n)?/, ""]
end
replacement_pairs += if new_url_hash
[
[formula_spec.url, new_url],
......@@ -146,6 +151,10 @@ module Homebrew
backup_file = File.read(formula.path) unless ARGV.dry_run?
if new_mirror
replacement_pairs << [/^( +)(url \"#{new_url}\"\n)/m, "\\1\\2\\1mirror \"#{new_mirror}\"\n"]
end
new_contents = inreplace_pairs(formula.path, replacement_pairs)
new_formula_version = formula_version(formula, requested_spec, new_contents)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment