Print an appropriate message if the tapped repository appears to be private

Closes Homebrew/homebrew#12247.
Closes Homebrew/homebrew#12244.

Signed-off-by: Max Howell <mxcl@me.com>
This commit is contained in:
Stafford Brunk 2012-05-14 16:18:24 -06:00 committed by Max Howell
parent 8c8701f268
commit cbee0bd2ee

View File

@ -29,6 +29,22 @@ module Homebrew extend self
tapd.find_formula{ |file| files << tapd.basename.join(file) }
tapped = link_tap_formula(files)
puts "Tapped #{tapped} 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
end
end
def link_tap_formula formulae