pull: Move test_bot_user to a new module GitHub

Address the style issue:
C: Module has too many lines. [364/360]
This commit is contained in:
Shaun Jackman 2017-10-17 17:08:11 -07:00
parent a7b4a4572b
commit 3ee3b78fbd

View File

@ -58,6 +58,18 @@ require "tap"
require "version"
require "pkg_version"
module GitHub
module_function
# Return the corresponding test-bot user name for the given GitHub organization.
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
end
module Homebrew
module_function
@ -231,7 +243,7 @@ module Homebrew
url
else
bottle_branch = "pull-bottle-#{issue}"
"https://github.com/#{test_bot_user user}/homebrew-#{tap.repo}/compare/#{user}:master...pr-#{issue}"
"https://github.com/#{GitHub.test_bot_user user}/homebrew-#{tap.repo}/compare/#{user}:master...pr-#{issue}"
end
curl "--silent", "--fail", "--output", "/dev/null", "--head", bottle_commit_url
@ -259,13 +271,6 @@ 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