aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorXu Cheng2016-04-19 15:25:29 +0800
committerXu Cheng2016-04-19 16:29:29 +0800
commit9a6d5a4feed411a8799352833f7ec73d4332031b (patch)
tree84cf4ac68e9ddffa63e6d2d928770f89831645e1 /Library/Homebrew
parent71b6e0aa18215cb956dceb13f0381da1131734c0 (diff)
downloadbrew-9a6d5a4feed411a8799352833f7ec73d4332031b.tar.bz2
add Tap#default_remote
* without `default_remote`, `CoreTap#install` won't be able to tell whether user has passed to custom remote to it. * simplify some part of logics
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/tap.rb27
1 files changed, 13 insertions, 14 deletions
diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb
index 52e6136b6..62721985b 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"
@@ -547,11 +551,6 @@ class CoreTap < Tap
end
# @private
- def custom_remote?
- remote != OFFICIAL_REMOTE
- end
-
- # @private
def core_tap?
true
end