diff options
| author | Jack Nagel | 2014-02-08 20:41:11 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-02-08 20:41:11 -0500 |
| commit | 25c4e336f48c4f9d549efc5511d87788a99d291c (patch) | |
| tree | ecdd835337434a9c9bc83eca29c4869d6d5ddae6 /Library/Homebrew/cmd/tap.rb | |
| parent | 3b818a19f9f3f94ae24b1907b49356155dbe7e96 (diff) | |
| download | brew-25c4e336f48c4f9d549efc5511d87788a99d291c.tar.bz2 | |
Use GitHub wrapper for private tap check
Diffstat (limited to 'Library/Homebrew/cmd/tap.rb')
| -rw-r--r-- | Library/Homebrew/cmd/tap.rb | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index 58132faca..cc8f63d0f 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -31,20 +31,14 @@ module Homebrew extend self link_tap_formula(files) puts "Tapped #{files.length} formula" - # Figure out if this repo is private - # curl will throw an exception if the repo is private (Github returns a 404) - begin - curl('-Ifso', '/dev/null', "https://api.github.com/repos/#{repouser}/homebrew-#{repo}") - rescue - puts - puts "It looks like you tapped a private repository" - puts "In order to not input your credentials every time" - puts "you can use git HTTP credential caching or issue the" - puts "following command:" - puts - puts " cd #{tapd}" - puts " git remote set-url origin git@github.com:#{repouser}/homebrew-#{repo}.git" - puts + if private_tap?(repouser, repo) then puts <<-EOS.undent + It looks like you tapped a private repository. To avoid entering your + credentials each time you update, you can use git HTTP credential caching + or issue the following command: + + cd #{tapd} + git remote set-url origin git@github.com:#{repouser}/homebrew-#{repo}.git + EOS end true @@ -114,6 +108,13 @@ module Homebrew extend self [$1, $3] end + def private_tap?(user, repo) + GitHub.private_repo?(user, "homebrew-#{repo}") + rescue GitHub::HTTPNotFoundError => e + true + rescue GitHub::Error + false + end end |
