From 9cd4fff051fa64d2c72ea55c97b819b3db9d1df9 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Fri, 6 Oct 2017 16:17:00 -0700 Subject: [PATCH] pull: Add --test-bot-user Infer the name of the test-bot GitHub user if it is not provided. --- Library/Homebrew/dev-cmd/pull.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 130e9ed5df..0e3b37e3f8 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -1,4 +1,4 @@ -#: * `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] [`--warn-on-publish-failure`] [`--bintray-org=`] []: +#: * `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] [`--warn-on-publish-failure`] [`--bintray-org=`] [`--test-bot-user=`] []: #: #: Gets a patch from a GitHub commit or pull request and applies it to Homebrew. #: Optionally, installs the formulae changed by the patch. @@ -44,6 +44,9 @@ #: #: If `--bintray-org=` is passed, publish at the given Bintray #: organisation. +#: +#: If `--test-bot-user=` is passed, pull the bottle block +#: commit from the specified user on GitHub. require "net/http" require "net/https" @@ -228,7 +231,7 @@ module Homebrew url else bottle_branch = "pull-bottle-#{issue}" - "https://github.com/BrewTestBot/homebrew-#{tap.repo}/compare/homebrew:master...pr-#{issue}" + "https://github.com/#{test_bot_user user}/homebrew-#{tap.repo}/compare/#{user}:master...pr-#{issue}" end curl "--silent", "--fail", "--output", "/dev/null", "--head", bottle_commit_url @@ -256,6 +259,13 @@ module Homebrew verify_bintray_published(bintray_published_formulae) end + def test_bot_user(user) + test_bot = ARGV.value "test-bot-user" + return test_bot if test_bot + return "BrewTestBot" if user.casecmp("homebrew").zero? + "#{user.capitalize}TestBot" + end + def force_utf8!(str) str.force_encoding("UTF-8") if str.respond_to?(:force_encoding) end