diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index 52e6136b6cc96ca71c109517b37b7c23718819f6..62721985bf710835b722b6e07e2f7296efba70d0 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -95,6 +95,11 @@ class Tap end end + # The default remote path to this {Tap}. + def default_remote + "https://github.com/#{user}/homebrew-#{repo}" + end + # True if this {Tap} is a git repository. def git? (path/".git").exist? @@ -185,7 +190,7 @@ class Tap full_clone = options.fetch(:full_clone, false) quiet = options.fetch(:quiet, false) - requested_remote = options[:clone_target] || "https://github.com/#{user}/homebrew-#{repo}" + requested_remote = options[:clone_target] || default_remote if installed? raise TapAlreadyTappedError, name unless full_clone @@ -293,7 +298,7 @@ class Tap # True if the {#remote} of {Tap} is customized. def custom_remote? return true unless remote - remote.casecmp("https://github.com/#{user}/homebrew-#{repo}") != 0 + remote.casecmp(default_remote) != 0 end # path to the directory of all {Formula} files for this {Tap}. @@ -500,9 +505,13 @@ end # A specialized {Tap} class for the core formulae class CoreTap < Tap if OS.mac? - OFFICIAL_REMOTE = "https://github.com/Homebrew/homebrew-core" + def default_remote + "https://github.com/Homebrew/homebrew-core" + end else - OFFICIAL_REMOTE = "https://github.com/Linuxbrew/homebrew-core" + def default_remote + "https://github.com/Linuxbrew/homebrew-core" + end end # @private @@ -521,11 +530,6 @@ class CoreTap < Tap safe_system HOMEBREW_BREW_FILE, *args end - def install(options = {}) - options[:clone_target] ||= OFFICIAL_REMOTE - super options - end - # @private def uninstall raise "Tap#uninstall is not available for CoreTap" @@ -546,11 +550,6 @@ class CoreTap < Tap false end - # @private - def custom_remote? - remote != OFFICIAL_REMOTE - end - # @private def core_tap? true