From 19df03219bfedaf29f1ed92c6b0b26e757163197 Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Sun, 4 Sep 2016 11:28:02 -0700 Subject: [PATCH] bump-formula-pr: --mirror option --- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 79bfe20106..b67b487306 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -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)