aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/dev-cmd
diff options
context:
space:
mode:
authorilovezfs2016-09-04 11:28:02 -0700
committerilovezfs2016-09-27 02:46:08 -0700
commit19df03219bfedaf29f1ed92c6b0b26e757163197 (patch)
tree1f5f663096b63a6270667f9a5920c34b765601bf /Library/Homebrew/dev-cmd
parent743e9bbdaad1dc8cd23ae49ef3b42e3fc9f4a16a (diff)
downloadbrew-19df03219bfedaf29f1ed92c6b0b26e757163197.tar.bz2
bump-formula-pr: --mirror option
Diffstat (limited to 'Library/Homebrew/dev-cmd')
-rw-r--r--Library/Homebrew/dev-cmd/bump-formula-pr.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb
index 79bfe2010..b67b48730 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)