From a9a62972bdce95a2b94db1be2e732480d88e17eb Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Wed, 6 Jul 2016 05:00:45 -0700 Subject: [PATCH] bump-formula-pr: handle explicit version DSL --version=1.2.3 option to set `version "1.2.3"` Note that --version=0 will remove a no-longer-needed explicit version --- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index b67b487306..2d89d85e8e 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -101,6 +101,7 @@ module Homebrew new_tag = ARGV.value("tag") new_revision = ARGV.value("revision") new_mirror = ARGV.value("mirror") + forced_version = ARGV.value("version") new_url_hash = if new_url && new_hash true elsif new_tag && new_revision @@ -155,6 +156,11 @@ module Homebrew replacement_pairs << [/^( +)(url \"#{new_url}\"\n)/m, "\\1\\2\\1mirror \"#{new_mirror}\"\n"] end + if forced_version && forced_version != "0" + replacement_pairs << [old_formula_version, forced_version] + elsif forced_version && forced_version == "0" + replacement_pairs << [/^ version \"[a-z\d+\.]+\"\n/m, ""] + end new_contents = inreplace_pairs(formula.path, replacement_pairs) new_formula_version = formula_version(formula, requested_spec, new_contents)