Fix brew info

Removed DEFAULT_USER, etc. constants, as code is clearer with actual values IMO, in this case.
This commit is contained in:
Max Howell 2009-12-12 16:22:54 +00:00
parent 02208387c2
commit 3762bbf56a

View File

@ -47,9 +47,6 @@ 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'
@ -167,20 +164,16 @@ def github_info name
branch = ($1 || '').chomp branch = ($1 || '').chomp
end end
user = DEFAULT_USER if user.empty? user = 'mxcl' if user.empty?
branch = DEFAULT_BRANCH if user.empty? branch = 'master' if user.empty?
history="http://github.com/#{user}/homebrew/commits/#{branch}/Library/Formula/#{formula_name}" return "http://github.com/#{user}/homebrew/commits/#{branch}/Library/Formula/#{formula_name}"
exec 'open', history
end end
def info name def info name
require 'formula' require 'formula'
if ARGV.flag? '--github' exec 'open', github_info(name) if ARGV.flag? '--github'
github_info name
return
end
f=Formula.factory name f=Formula.factory name
puts "#{f.name} #{f.version}" puts "#{f.name} #{f.version}"
@ -205,6 +198,7 @@ def info name
puts puts
end end
history = github_info
puts history if history puts history if history
rescue FormulaUnavailableError rescue FormulaUnavailableError