2020-06-30 09:57:34 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "formula"
|
|
|
|
|
|
|
|
module Versions
|
|
|
|
def current_formula_version(formula_name)
|
|
|
|
Formula[formula_name].version.to_s.to_f
|
|
|
|
end
|
|
|
|
|
|
|
|
def bump_formula_pr(formula_name, url)
|
2020-07-01 10:58:13 -05:00
|
|
|
response = Utils.popen_read("brew", "bump-formula-pr", "--no-browse",
|
|
|
|
"--dry-run", formula_name, "--url=#{url}").chomp
|
2020-06-30 09:57:34 -05:00
|
|
|
|
|
|
|
parse_formula_bump_response(response)
|
|
|
|
end
|
|
|
|
|
2020-06-30 10:36:00 -05:00
|
|
|
def parse_formula_bump_response(formula_bump_response)
|
|
|
|
response, _status = formula_bump_response
|
2020-06-30 09:57:34 -05:00
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
def check_for_open_pr(formula_name, download_url)
|
2020-06-30 10:23:18 -05:00
|
|
|
ohai "- Checking for open PRs for formula : #{formula_name}"
|
2020-06-30 09:57:34 -05:00
|
|
|
|
|
|
|
response = bump_formula_pr(formula_name, download_url)
|
2020-06-30 10:23:18 -05:00
|
|
|
!response.include? "Error: These open pull requests may be duplicates"
|
2020-06-30 09:57:34 -05:00
|
|
|
end
|
|
|
|
end
|