aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2012-03-06 17:35:10 +0000
committerMax Howell2012-03-16 21:06:16 +0000
commit6c0950999f0614d5a0b35dd0700d5928e5d95af0 (patch)
tree7f04f890ec66222efa7e44eaaf8b988f48a16d81 /Library
parent765ae9618050e415c039edabce02671581c1ffb1 (diff)
downloadbrew-6c0950999f0614d5a0b35dd0700d5928e5d95af0.tar.bz2
`brew info` understands taps
Note I removed some of the code that changed the URL to be that of the github.user. Because this doesn't make any sense really. We want people to reference the commit history for whatever fork of homebrew they have checked out. So this is now what it does.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/info.rb37
1 files changed, 23 insertions, 14 deletions
diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb
index 0c6b3829e..bb5f1f991 100644
--- a/Library/Homebrew/cmd/info.rb
+++ b/Library/Homebrew/cmd/info.rb
@@ -20,21 +20,30 @@ module Homebrew extend self
end
end
+ def github_fork
+ if system "/usr/bin/which -s git"
+ if `git remote -v` =~ %r{origin\s+(https?://|git@)github.com[:/](.+)/homebrew}
+ $2
+ end
+ end
+ end
+
def github_info name
- formula_name = Formula.path(name).basename
- user = 'mxcl'
- branch = 'master'
+ path = Formula.path(name).realpath
- if system "/usr/bin/which -s git"
- gh_user=`git config --global github.user 2>/dev/null`.chomp
- /^\*\s*(.*)/.match(`git --git-dir=#{HOMEBREW_REPOSITORY}/.git branch 2>/dev/null`)
- unless $1.nil? || $1.empty? || $1.chomp == 'master' || gh_user.empty?
- branch = $1.chomp
- user = gh_user
+ if path.to_s =~ %r{#{HOMEBREW_REPOSITORY}/Library/Taps/(\w+)-(\w+)/(.*)}
+ user = $1
+ repo = "homebrew-#$2"
+ path = $3
+ else
+ path.parent.cd do
+ user = github_fork
end
+ repo = "homebrew"
+ path = "Library/Formula/#{path.basename}"
end
- "http://github.com/#{user}/homebrew/commits/#{branch}/Library/Formula/#{formula_name}"
+ "https://github.com/#{user}/#{repo}/commits/master/#{path}"
end
def info_formula f
@@ -68,16 +77,16 @@ module Homebrew extend self
puts "Not installed"
end
+ history = github_info f.name
+ puts history if history
+
the_caveats = (f.caveats || "").strip
unless the_caveats.empty?
puts
+ ohai "Caveats"
puts f.caveats
- puts
end
- history = github_info f.name
- puts history if history
-
rescue FormulaUnavailableError
# check for DIY installation
d = HOMEBREW_PREFIX+name