aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/tap.rb
diff options
context:
space:
mode:
authorXu Cheng2015-07-30 16:51:00 +0800
committerXu Cheng2015-07-30 21:28:52 +0800
commita9b9c5ade798ca8378f9e8bf3d82f6f2b01d8312 (patch)
tree436a8b69df1efb5d6fc80b1c611ac6fe5dd65b79 /Library/Homebrew/tap.rb
parent8c7b6291491ec0a6d50c7b0dfcc4912d12253418 (diff)
downloadbrew-a9b9c5ade798ca8378f9e8bf3d82f6f2b01d8312.tar.bz2
Tap: allow enumerate non-git taps
Also add a `Tap#git?` method to indicate whether the tap is a git repository. Closes Homebrew/homebrew#42264. Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/tap.rb')
-rw-r--r--Library/Homebrew/tap.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb
index 6dc83473b..27777e431 100644
--- a/Library/Homebrew/tap.rb
+++ b/Library/Homebrew/tap.rb
@@ -37,7 +37,7 @@ class Tap
# e.g. `https://github.com/user/homebrew-repo`
def remote
@remote ||= if installed?
- if (@path/".git").exist?
+ if git?
@path.cd do
Utils.popen_read("git", "config", "--get", "remote.origin.url").chomp
end
@@ -49,6 +49,11 @@ class Tap
end
end
+ # True if this {Tap} is a git repository.
+ def git?
+ (@path/".git").exist?
+ end
+
def to_s
name
end
@@ -117,9 +122,7 @@ class Tap
TAP_DIRECTORY.subdirs.each do |user|
user.subdirs.each do |repo|
- if (repo/".git").directory?
- yield new(user.basename.to_s, repo.basename.to_s.sub("homebrew-", ""))
- end
+ yield new(user.basename.to_s, repo.basename.to_s.sub("homebrew-", ""))
end
end
end