--github improvements
* Only invoke git if --github was passed; speeds up brew info --all * Use current branch for --github instead of master.
This commit is contained in:
parent
8443c9be7d
commit
d391f7c70e
@ -47,6 +47,9 @@ Mercurial can be install thusly:
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
DEFAULT_USER = 'mxcl'
|
||||||
|
DEFAULT_BRANCH = 'master'
|
||||||
|
|
||||||
def __make url, name
|
def __make url, name
|
||||||
require 'formula'
|
require 'formula'
|
||||||
|
|
||||||
@ -152,25 +155,38 @@ ENV.libxml2 in your formula's install function.
|
|||||||
__make url, name
|
__make url, name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def github_info name
|
||||||
|
formula_name = Formula.path(name).basename
|
||||||
|
user = ''
|
||||||
|
branch = ''
|
||||||
|
|
||||||
|
if system "/usr/bin/which -s git"
|
||||||
|
user=`git config --global github.user`.chomp
|
||||||
|
all_branches = `git branch 2>/dev/null`
|
||||||
|
/^\*\s*(.*)/.match all_branches
|
||||||
|
branch = ($1 || '').chomp
|
||||||
|
end
|
||||||
|
|
||||||
|
user = DEFAULT_USER if user.empty?
|
||||||
|
branch = DEFAULT_BRANCH if user.empty?
|
||||||
|
|
||||||
|
history="http://github.com/#{user}/homebrew/commits/#{branch}/Library/Formula/#{formula_name}"
|
||||||
|
exec 'open', history
|
||||||
|
end
|
||||||
|
|
||||||
def info name
|
def info name
|
||||||
require 'formula'
|
require 'formula'
|
||||||
|
|
||||||
user=''
|
if ARGV.flag? '--github'
|
||||||
user=`git config --global github.user`.chomp if system "/usr/bin/which -s git"
|
github_info name
|
||||||
user='mxcl' if user.empty?
|
return
|
||||||
# FIXME it would be nice if we didn't assume the default branch is master
|
end
|
||||||
history="http://github.com/#{user}/homebrew/commits/master/Library/Formula/#{Formula.path(name).basename}"
|
|
||||||
|
|
||||||
exec 'open', history if ARGV.flag? '--github'
|
|
||||||
|
|
||||||
f=Formula.factory name
|
f=Formula.factory name
|
||||||
puts "#{f.name} #{f.version}"
|
puts "#{f.name} #{f.version}"
|
||||||
puts f.homepage
|
puts f.homepage
|
||||||
|
|
||||||
if not f.deps.empty?
|
puts "Depends on: #{f.deps.join(', ')}" unless f.deps.empty?
|
||||||
puts "Depends on: #{f.deps.join(', ')}"
|
|
||||||
end
|
|
||||||
|
|
||||||
if f.prefix.parent.directory?
|
if f.prefix.parent.directory?
|
||||||
kids=f.prefix.parent.children
|
kids=f.prefix.parent.children
|
||||||
@ -189,7 +205,7 @@ def info name
|
|||||||
puts
|
puts
|
||||||
end
|
end
|
||||||
|
|
||||||
puts history
|
puts history if history
|
||||||
|
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
# check for DIY installation
|
# check for DIY installation
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user