From 3ee3b78fbda48821e878feeafc313a9391c5729c Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Tue, 17 Oct 2017 17:08:11 -0700 Subject: pull: Move test_bot_user to a new module GitHub Address the style issue: C: Module has too many lines. [364/360] --- Library/Homebrew/dev-cmd/pull.rb | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 0e3b37e3f..79b9da9eb 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -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 -- cgit v1.2.3