2009-05-21 00:04:43 +01:00
|
|
|
#!/usr/bin/ruby
|
2009-09-03 17:10:35 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2009-10-02 16:57:48 -04:00
|
|
|
|
2009-10-23 14:49:48 +01:00
|
|
|
# Many Pathname operations use getwd when they shouldn't, and then throw
|
|
|
|
|
# odd exceptions. Reduce our support burden by showing a user-friendly error.
|
|
|
|
|
Dir.getwd rescue abort "The current working directory doesn't exist, cannot proceed."
|
|
|
|
|
|
2009-11-07 18:10:30 +00:00
|
|
|
HOMEBREW_BREW_FILE = ENV['HOMEBREW_BREW_FILE'] = File.expand_path(__FILE__)
|
Rewrite of HOMEBREW_ folder locations
This rewrite attempts to sort out where the Prefix, Cellar, and
Repository are relative to the real and symlinked 'brew' command.
Also included is a --config option which dumps all of these variables.
Any top-level script must define a "BREW_FILE" that gives the path
to brew as it exists in the path. 'brew' itself just uses __FILE__ and
install.rb does a `which brew` (there may be a better way?)
The Prefix is always relative to the location of brew as it exists in
the path. Thus, whether or not /usr/local/bin/brew is a symlink or real
file, the Prefix is always /usr/local. If you have brew in some other
prefix, such as /nonstandard/bin/brew, then '/nonstandard/ will be
managed by brew instead.
The Repository, Cellar, and "Library/Homebrew" required code is always
found relative to the "real" path or brew. If brew is a real file in
/usr/local/bin/brew, then everything else will be found in /usr/local
and we'll expect a /usr/local/.git
Otherwise, we dereference brew's symlink and look for everything else
relative to that path instead.
2009-10-05 11:52:05 -07:00
|
|
|
|
2009-11-07 18:10:30 +00:00
|
|
|
require 'pathname'
|
|
|
|
|
$:.unshift((Pathname.new(__FILE__).realpath.dirname.parent+"Library"+"Homebrew").to_s)
|
2009-09-04 15:28:18 +01:00
|
|
|
require 'global'
|
2009-08-10 16:48:30 +01:00
|
|
|
|
2009-10-15 14:54:11 +01:00
|
|
|
case ARGV.first
|
|
|
|
|
when '--cache'
|
|
|
|
|
puts HOMEBREW_CACHE
|
|
|
|
|
exit 0
|
2009-10-26 18:22:22 +00:00
|
|
|
when '-h', '--help', '--usage', '-?', nil
|
2009-10-15 14:54:11 +01:00
|
|
|
puts ARGV.usage
|
|
|
|
|
exit 0
|
|
|
|
|
when '--version'
|
|
|
|
|
puts HOMEBREW_VERSION
|
|
|
|
|
exit 0
|
|
|
|
|
when '-v'
|
|
|
|
|
if ARGV.length > 1
|
|
|
|
|
puts "Homebrew #{HOMEBREW_VERSION}"
|
|
|
|
|
# continue in verbose mode
|
|
|
|
|
ARGV << ARGV.shift
|
|
|
|
|
else
|
|
|
|
|
puts HOMEBREW_VERSION
|
|
|
|
|
exit 0
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
case HOMEBREW_PREFIX.to_s when '/', '/usr'
|
|
|
|
|
# it may work, but I only see pain this route and don't want to support it
|
|
|
|
|
abort "Cowardly refusing to continue at this prefix: #{HOMEBREW_PREFIX}"
|
2009-06-02 13:39:39 +01:00
|
|
|
end
|
2009-09-25 18:12:19 +01:00
|
|
|
if MACOS_VERSION < 10.5
|
2009-10-02 16:57:48 -04:00
|
|
|
abort "Homebrew requires Leopard or higher, but you could fork it and fix that..."
|
2009-08-12 01:56:40 +01:00
|
|
|
end
|
2009-09-18 19:16:39 +01:00
|
|
|
|
Rewrite of HOMEBREW_ folder locations
This rewrite attempts to sort out where the Prefix, Cellar, and
Repository are relative to the real and symlinked 'brew' command.
Also included is a --config option which dumps all of these variables.
Any top-level script must define a "BREW_FILE" that gives the path
to brew as it exists in the path. 'brew' itself just uses __FILE__ and
install.rb does a `which brew` (there may be a better way?)
The Prefix is always relative to the location of brew as it exists in
the path. Thus, whether or not /usr/local/bin/brew is a symlink or real
file, the Prefix is always /usr/local. If you have brew in some other
prefix, such as /nonstandard/bin/brew, then '/nonstandard/ will be
managed by brew instead.
The Repository, Cellar, and "Library/Homebrew" required code is always
found relative to the "real" path or brew. If brew is a real file in
/usr/local/bin/brew, then everything else will be found in /usr/local
and we'll expect a /usr/local/.git
Otherwise, we dereference brew's symlink and look for everything else
relative to that path instead.
2009-10-05 11:52:05 -07:00
|
|
|
def dump_config
|
2009-11-08 15:00:44 -08:00
|
|
|
require 'hardware'
|
|
|
|
|
bits = Hardware.is_64_bit? ? 64 : 32
|
2009-11-09 18:48:05 +00:00
|
|
|
cores = case Hardware.processor_count
|
|
|
|
|
when 1 then 'single'
|
|
|
|
|
when 2 then 'dual'
|
|
|
|
|
when 4 then 'quad'
|
|
|
|
|
else
|
|
|
|
|
Hardware.processor_count
|
|
|
|
|
end
|
|
|
|
|
llvm = llvm_build
|
2009-11-11 18:37:13 +00:00
|
|
|
sha = `git rev-parse --verify HEAD`.chomp
|
Rewrite of HOMEBREW_ folder locations
This rewrite attempts to sort out where the Prefix, Cellar, and
Repository are relative to the real and symlinked 'brew' command.
Also included is a --config option which dumps all of these variables.
Any top-level script must define a "BREW_FILE" that gives the path
to brew as it exists in the path. 'brew' itself just uses __FILE__ and
install.rb does a `which brew` (there may be a better way?)
The Prefix is always relative to the location of brew as it exists in
the path. Thus, whether or not /usr/local/bin/brew is a symlink or real
file, the Prefix is always /usr/local. If you have brew in some other
prefix, such as /nonstandard/bin/brew, then '/nonstandard/ will be
managed by brew instead.
The Repository, Cellar, and "Library/Homebrew" required code is always
found relative to the "real" path or brew. If brew is a real file in
/usr/local/bin/brew, then everything else will be found in /usr/local
and we'll expect a /usr/local/.git
Otherwise, we dereference brew's symlink and look for everything else
relative to that path instead.
2009-10-05 11:52:05 -07:00
|
|
|
|
2009-11-08 15:00:44 -08:00
|
|
|
puts <<-EOS
|
|
|
|
|
HOMEBREW_VERSION: #{HOMEBREW_VERSION}
|
2009-11-11 18:37:13 +00:00
|
|
|
HEAD: #{sha}
|
2009-11-09 18:48:05 +00:00
|
|
|
HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}
|
|
|
|
|
HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}
|
|
|
|
|
HOMEBREW_CACHE: #{HOMEBREW_CACHE}
|
Rewrite of HOMEBREW_ folder locations
This rewrite attempts to sort out where the Prefix, Cellar, and
Repository are relative to the real and symlinked 'brew' command.
Also included is a --config option which dumps all of these variables.
Any top-level script must define a "BREW_FILE" that gives the path
to brew as it exists in the path. 'brew' itself just uses __FILE__ and
install.rb does a `which brew` (there may be a better way?)
The Prefix is always relative to the location of brew as it exists in
the path. Thus, whether or not /usr/local/bin/brew is a symlink or real
file, the Prefix is always /usr/local. If you have brew in some other
prefix, such as /nonstandard/bin/brew, then '/nonstandard/ will be
managed by brew instead.
The Repository, Cellar, and "Library/Homebrew" required code is always
found relative to the "real" path or brew. If brew is a real file in
/usr/local/bin/brew, then everything else will be found in /usr/local
and we'll expect a /usr/local/.git
Otherwise, we dereference brew's symlink and look for everything else
relative to that path instead.
2009-10-05 11:52:05 -07:00
|
|
|
HOMEBREW_REPOSITORY: #{HOMEBREW_REPOSITORY}
|
2009-11-08 15:00:44 -08:00
|
|
|
Library path: #{$:.first}
|
2009-11-09 18:48:05 +00:00
|
|
|
Hardware: #{cores}-core #{bits}-bit #{Hardware.intel_family}
|
2009-11-08 15:00:44 -08:00
|
|
|
OS X: #{MACOS_FULL_VERSION}
|
|
|
|
|
Ruby: #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}
|
2009-11-11 18:37:34 +00:00
|
|
|
GCC: 4.2 build #{gcc_build}
|
2009-11-09 18:48:05 +00:00
|
|
|
LLVM: #{llvm ? "build #{llvm}" : "N/A" }
|
2009-11-11 18:37:34 +00:00
|
|
|
MacPorts or Fink? #{macports_or_fink_installed?}
|
Rewrite of HOMEBREW_ folder locations
This rewrite attempts to sort out where the Prefix, Cellar, and
Repository are relative to the real and symlinked 'brew' command.
Also included is a --config option which dumps all of these variables.
Any top-level script must define a "BREW_FILE" that gives the path
to brew as it exists in the path. 'brew' itself just uses __FILE__ and
install.rb does a `which brew` (there may be a better way?)
The Prefix is always relative to the location of brew as it exists in
the path. Thus, whether or not /usr/local/bin/brew is a symlink or real
file, the Prefix is always /usr/local. If you have brew in some other
prefix, such as /nonstandard/bin/brew, then '/nonstandard/ will be
managed by brew instead.
The Repository, Cellar, and "Library/Homebrew" required code is always
found relative to the "real" path or brew. If brew is a real file in
/usr/local/bin/brew, then everything else will be found in /usr/local
and we'll expect a /usr/local/.git
Otherwise, we dereference brew's symlink and look for everything else
relative to that path instead.
2009-10-05 11:52:05 -07:00
|
|
|
EOS
|
|
|
|
|
end
|
|
|
|
|
|
2009-06-02 13:39:39 +01:00
|
|
|
begin
|
2009-10-15 14:54:11 +01:00
|
|
|
require 'brew.h'
|
|
|
|
|
|
2009-10-26 18:13:38 +00:00
|
|
|
case arg = ARGV.shift
|
2009-10-15 14:54:11 +01:00
|
|
|
when '--prefix'
|
|
|
|
|
puts HOMEBREW_PREFIX
|
Rewrite of HOMEBREW_ folder locations
This rewrite attempts to sort out where the Prefix, Cellar, and
Repository are relative to the real and symlinked 'brew' command.
Also included is a --config option which dumps all of these variables.
Any top-level script must define a "BREW_FILE" that gives the path
to brew as it exists in the path. 'brew' itself just uses __FILE__ and
install.rb does a `which brew` (there may be a better way?)
The Prefix is always relative to the location of brew as it exists in
the path. Thus, whether or not /usr/local/bin/brew is a symlink or real
file, the Prefix is always /usr/local. If you have brew in some other
prefix, such as /nonstandard/bin/brew, then '/nonstandard/ will be
managed by brew instead.
The Repository, Cellar, and "Library/Homebrew" required code is always
found relative to the "real" path or brew. If brew is a real file in
/usr/local/bin/brew, then everything else will be found in /usr/local
and we'll expect a /usr/local/.git
Otherwise, we dereference brew's symlink and look for everything else
relative to that path instead.
2009-10-05 11:52:05 -07:00
|
|
|
when '--config'
|
|
|
|
|
dump_config
|
2009-07-24 15:10:01 +01:00
|
|
|
|
2009-07-31 22:10:50 -07:00
|
|
|
when 'home', 'homepage'
|
2009-10-26 18:20:18 +00:00
|
|
|
if ARGV.named.empty?
|
2009-08-10 16:48:30 +01:00
|
|
|
exec "open", HOMEBREW_WWW
|
|
|
|
|
else
|
|
|
|
|
exec "open", *ARGV.formulae.collect {|f| f.homepage}
|
|
|
|
|
end
|
2009-07-31 22:10:50 -07:00
|
|
|
|
2009-07-24 15:10:01 +01:00
|
|
|
when 'ls', 'list'
|
2009-09-25 19:04:34 +12:00
|
|
|
if ARGV.flag? '--unbrewed'
|
2009-09-29 21:17:44 +01:00
|
|
|
dirs = HOMEBREW_PREFIX.children.select { |pn| pn.directory? }.collect { |pn| pn.basename.to_s }
|
|
|
|
|
dirs -= ['Library', 'Cellar', '.git']
|
|
|
|
|
Dir.chdir HOMEBREW_PREFIX
|
|
|
|
|
exec 'find', *dirs + %w[-type f ( ! -iname .ds_store ! -iname brew )]
|
2009-10-26 18:20:18 +00:00
|
|
|
elsif ARGV.named.empty?
|
2009-08-23 13:09:15 +01:00
|
|
|
ENV['CLICOLOR']=nil
|
2009-10-04 10:15:42 +01:00
|
|
|
exec 'ls', *ARGV.options<<HOMEBREW_CELLAR if HOMEBREW_CELLAR.exist?
|
2009-09-25 17:45:34 +01:00
|
|
|
elsif ARGV.verbose? or not $stdout.tty?
|
2009-08-23 13:09:15 +01:00
|
|
|
exec "find", *ARGV.kegs+%w[-not -type d -print]
|
2009-09-24 21:46:04 +01:00
|
|
|
else
|
|
|
|
|
ARGV.kegs.each { |keg| PrettyListing.new keg }
|
2009-08-23 13:09:15 +01:00
|
|
|
end
|
2009-07-24 15:10:01 +01:00
|
|
|
|
2009-09-04 15:22:25 -07:00
|
|
|
when 'search', '-S'
|
Rewrite of HOMEBREW_ folder locations
This rewrite attempts to sort out where the Prefix, Cellar, and
Repository are relative to the real and symlinked 'brew' command.
Also included is a --config option which dumps all of these variables.
Any top-level script must define a "BREW_FILE" that gives the path
to brew as it exists in the path. 'brew' itself just uses __FILE__ and
install.rb does a `which brew` (there may be a better way?)
The Prefix is always relative to the location of brew as it exists in
the path. Thus, whether or not /usr/local/bin/brew is a symlink or real
file, the Prefix is always /usr/local. If you have brew in some other
prefix, such as /nonstandard/bin/brew, then '/nonstandard/ will be
managed by brew instead.
The Repository, Cellar, and "Library/Homebrew" required code is always
found relative to the "real" path or brew. If brew is a real file in
/usr/local/bin/brew, then everything else will be found in /usr/local
and we'll expect a /usr/local/.git
Otherwise, we dereference brew's symlink and look for everything else
relative to that path instead.
2009-10-05 11:52:05 -07:00
|
|
|
formulae = (HOMEBREW_REPOSITORY+'Library/Formula').children.sort.map{|f| f.basename('.rb') }
|
2009-09-17 16:06:56 -07:00
|
|
|
if ARGV.first =~ /^\/(.*)\/$/
|
|
|
|
|
puts_columns formulae.grep(Regexp.new($1))
|
|
|
|
|
else
|
|
|
|
|
puts_columns formulae.grep(/.*#{ARGV.first}.*/)
|
|
|
|
|
end
|
2009-09-04 15:22:25 -07:00
|
|
|
|
2009-06-26 13:03:49 +01:00
|
|
|
when 'edit'
|
2009-10-26 18:20:18 +00:00
|
|
|
if ARGV.named.empty?
|
2009-09-05 14:03:41 -04:00
|
|
|
# EDITOR isn't a good fit here, we need a GUI client that actually has
|
|
|
|
|
# a UI for projects, so apologies if this wasn't what you expected,
|
|
|
|
|
# please improve it! :)
|
Rewrite of HOMEBREW_ folder locations
This rewrite attempts to sort out where the Prefix, Cellar, and
Repository are relative to the real and symlinked 'brew' command.
Also included is a --config option which dumps all of these variables.
Any top-level script must define a "BREW_FILE" that gives the path
to brew as it exists in the path. 'brew' itself just uses __FILE__ and
install.rb does a `which brew` (there may be a better way?)
The Prefix is always relative to the location of brew as it exists in
the path. Thus, whether or not /usr/local/bin/brew is a symlink or real
file, the Prefix is always /usr/local. If you have brew in some other
prefix, such as /nonstandard/bin/brew, then '/nonstandard/ will be
managed by brew instead.
The Repository, Cellar, and "Library/Homebrew" required code is always
found relative to the "real" path or brew. If brew is a real file in
/usr/local/bin/brew, then everything else will be found in /usr/local
and we'll expect a /usr/local/.git
Otherwise, we dereference brew's symlink and look for everything else
relative to that path instead.
2009-10-05 11:52:05 -07:00
|
|
|
exec 'mate', *Dir["#{HOMEBREW_REPOSITORY}/Library/*"]<<
|
|
|
|
|
"#{HOMEBREW_REPOSITORY}/bin/brew"<<
|
|
|
|
|
"#{HOMEBREW_REPOSITORY}/README.md"
|
2009-11-05 23:11:42 +00:00
|
|
|
else
|
|
|
|
|
# we don't use ARGV.formulae as that will throw if the file doesn't parse
|
|
|
|
|
paths = ARGV.named.collect do |name|
|
|
|
|
|
unless File.exist? path = "#{HOMEBREW_REPOSITORY}/Library/Formula/#{name}.rb"
|
|
|
|
|
require 'formula'
|
|
|
|
|
raise FormulaUnavailableError, name
|
|
|
|
|
else
|
|
|
|
|
path
|
|
|
|
|
end
|
2009-06-26 13:03:49 +01:00
|
|
|
end
|
2009-11-05 23:11:42 +00:00
|
|
|
exec_editor *paths
|
|
|
|
|
end
|
2009-06-26 13:03:49 +01:00
|
|
|
|
2009-09-08 00:02:28 +02:00
|
|
|
when 'up', 'update'
|
2009-09-17 18:39:47 +01:00
|
|
|
require 'update'
|
2009-09-08 00:02:28 +02:00
|
|
|
updater = RefreshBrew.new
|
2009-09-11 20:09:39 +02:00
|
|
|
old_revision = updater.current_revision
|
2009-09-08 00:02:28 +02:00
|
|
|
unless updater.update_from_masterbrew!
|
2009-09-21 21:41:14 +01:00
|
|
|
puts "Already up-to-date."
|
2009-09-08 00:02:28 +02:00
|
|
|
else
|
2009-09-20 18:09:45 +02:00
|
|
|
puts "Updated Homebrew from #{old_revision[0,8]} to #{updater.current_revision[0,8]}."
|
2009-09-11 19:24:37 +02:00
|
|
|
if updater.pending_formulae_changes?
|
2009-09-21 21:41:14 +01:00
|
|
|
ohai "The following formulae were updated:"
|
|
|
|
|
puts_columns updater.updated_formulae
|
2009-09-11 19:24:37 +02:00
|
|
|
else
|
2009-09-21 21:41:14 +01:00
|
|
|
puts "No formulae were updated." unless updater.pending_formulae_changes?
|
2009-09-11 19:24:37 +02:00
|
|
|
end
|
2009-09-08 00:02:28 +02:00
|
|
|
end
|
|
|
|
|
|
2009-07-24 15:10:01 +01:00
|
|
|
when 'ln', 'link'
|
2009-08-10 16:48:30 +01:00
|
|
|
ARGV.kegs.each {|keg| puts "#{keg.link} links created for #{keg}"}
|
|
|
|
|
|
|
|
|
|
when 'unlink'
|
|
|
|
|
ARGV.kegs.each {|keg| puts "#{keg.unlink} links removed for #{keg}"}
|
2009-07-22 20:27:58 +01:00
|
|
|
|
2009-08-10 16:48:30 +01:00
|
|
|
when 'rm', 'uninstall', 'remove'
|
|
|
|
|
ARGV.kegs.each do |keg|
|
|
|
|
|
puts "Uninstalling #{keg}..."
|
|
|
|
|
keg.uninstall
|
2009-10-26 18:10:23 +00:00
|
|
|
keg.unlink
|
2009-07-24 15:10:01 +01:00
|
|
|
end
|
2009-08-10 16:48:30 +01:00
|
|
|
|
2009-07-24 15:10:01 +01:00
|
|
|
when 'prune'
|
2009-08-10 16:48:30 +01:00
|
|
|
prune
|
2009-07-24 15:10:01 +01:00
|
|
|
|
2009-09-07 01:34:40 +01:00
|
|
|
# 'make' supported until 0.7 for historic reasons
|
2009-07-24 15:10:01 +01:00
|
|
|
when 'mk', 'make'
|
2009-09-07 01:34:40 +01:00
|
|
|
opoo "`brew make' has changed to `brew create'"
|
|
|
|
|
puts "This is because make can be confused with the `make' tool."
|
|
|
|
|
puts "brew make will continue working until Homebrew 0.7"
|
|
|
|
|
exec __FILE__, "create", *ARGV
|
|
|
|
|
|
|
|
|
|
when 'create'
|
2009-08-10 16:48:30 +01:00
|
|
|
if ARGV.include? '--macports'
|
|
|
|
|
exec "open", "http://www.macports.org/ports.php?by=name&substr=#{ARGV.next}"
|
2009-10-26 18:20:18 +00:00
|
|
|
elsif ARGV.named.empty?
|
|
|
|
|
raise UsageError
|
2009-06-08 15:59:59 +01:00
|
|
|
else
|
2009-10-15 16:33:12 +01:00
|
|
|
exec_editor *ARGV.named.collect {|name| make name}
|
2009-06-08 15:59:59 +01:00
|
|
|
end
|
|
|
|
|
|
2009-08-22 15:54:26 +01:00
|
|
|
when 'diy', 'configure'
|
2009-08-12 13:43:51 +01:00
|
|
|
puts diy
|
|
|
|
|
|
2009-07-24 15:10:01 +01:00
|
|
|
when 'info', 'abv'
|
2009-10-26 18:20:18 +00:00
|
|
|
if ARGV.named.empty?
|
2009-08-10 16:48:30 +01:00
|
|
|
puts `ls #{HOMEBREW_CELLAR} | wc -l`.strip+" kegs, "+HOMEBREW_CELLAR.abv
|
2009-07-24 15:10:01 +01:00
|
|
|
elsif ARGV[0][0..6] == 'http://'
|
|
|
|
|
puts Pathname.new(ARGV.shift).version
|
2009-06-13 12:59:18 +01:00
|
|
|
else
|
2009-08-10 16:48:30 +01:00
|
|
|
ARGV.named.each {|name| info name}
|
2009-06-05 12:57:00 +01:00
|
|
|
end
|
2009-07-24 15:10:01 +01:00
|
|
|
|
2009-10-26 18:13:38 +00:00
|
|
|
when 'install'
|
|
|
|
|
require 'formula_installer'
|
2009-11-03 19:03:56 +00:00
|
|
|
require 'hardware'
|
2009-10-26 18:13:38 +00:00
|
|
|
|
|
|
|
|
############################################################ sanity checks
|
|
|
|
|
case Hardware.cpu_type when :ppc, :dunno
|
|
|
|
|
abort "Sorry, Homebrew does not support your computer's CPU architecture."
|
|
|
|
|
end
|
|
|
|
|
|
2009-11-08 16:23:08 +00:00
|
|
|
raise "Cannot write to #{HOMEBREW_CELLAR}" if HOMEBREW_CELLAR.exist? and not HOMEBREW_CELLAR.writable?
|
2009-10-26 18:13:38 +00:00
|
|
|
raise "Cannot write to #{HOMEBREW_PREFIX}" unless HOMEBREW_PREFIX.writable?
|
|
|
|
|
|
|
|
|
|
################################################################# warnings
|
|
|
|
|
if MACOS_VERSION >= 10.6
|
2009-11-09 18:47:26 +00:00
|
|
|
opoo "You should upgrade to Xcode 3.2.1" if llvm_build < 2206
|
2009-11-08 16:22:15 +00:00
|
|
|
else
|
2009-11-09 12:07:47 -08:00
|
|
|
opoo "You should upgrade to Xcode 3.1.4" if gcc_build < 5577
|
2009-10-26 18:13:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if macports_or_fink_installed?
|
|
|
|
|
opoo "It appears you have Macports or Fink installed"
|
|
|
|
|
puts "Although, unlikely, this can break builds or cause obscure runtime issues."
|
|
|
|
|
puts "If you experience problems try uninstalling these tools."
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
################################################################# install!
|
|
|
|
|
installer = FormulaInstaller.new
|
|
|
|
|
installer.install_deps = !ARGV.include?('--ignore-dependencies')
|
|
|
|
|
|
|
|
|
|
ARGV.formulae.each do |f|
|
|
|
|
|
if not f.installed? or ARGV.force?
|
|
|
|
|
installer.install f
|
|
|
|
|
else
|
|
|
|
|
puts "Formula already installed: #{f.prefix}"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2009-09-24 19:19:57 +01:00
|
|
|
when 'log'
|
2009-10-26 18:21:30 +00:00
|
|
|
Dir.chdir HOMEBREW_REPOSITORY
|
2009-09-24 19:19:57 +01:00
|
|
|
exec "git", "log", ARGV.formulae.first.path, *ARGV.options
|
|
|
|
|
|
|
|
|
|
else
|
2009-10-26 18:22:22 +00:00
|
|
|
onoe "Unknown command: #{arg}"
|
2009-06-02 13:39:39 +01:00
|
|
|
end
|
2009-05-23 16:37:24 +01:00
|
|
|
|
2009-10-26 18:16:42 +00:00
|
|
|
rescue FormulaUnspecifiedError
|
2009-11-11 18:38:50 +00:00
|
|
|
abort "This command requires a formula argument"
|
2009-10-26 18:16:42 +00:00
|
|
|
rescue KegUnspecifiedError
|
2009-11-11 18:38:50 +00:00
|
|
|
abort "This command requires a keg argument"
|
2009-08-11 00:27:18 +01:00
|
|
|
rescue UsageError
|
|
|
|
|
onoe "Invalid usage"
|
2009-11-11 18:38:50 +00:00
|
|
|
abort ARGV.usage
|
2009-08-10 16:48:30 +01:00
|
|
|
rescue SystemExit
|
2009-10-26 18:23:28 +00:00
|
|
|
puts "Kernel.exit" if ARGV.verbose?
|
2009-08-10 16:48:30 +01:00
|
|
|
rescue Interrupt => e
|
2009-10-26 18:23:28 +00:00
|
|
|
puts # seemingly a newline is typical
|
2009-08-10 16:48:30 +01:00
|
|
|
exit 130
|
|
|
|
|
rescue Exception => e
|
2009-11-11 18:38:50 +00:00
|
|
|
fatal = !(RuntimeError === e or SystemCallError === e)
|
|
|
|
|
|
|
|
|
|
onoe e
|
|
|
|
|
if BuildError === e or fatal
|
|
|
|
|
puts "#{Tty.white}Please report this bug to #{Tty.em}#{HOMEBREW_WWW}#{Tty.reset}"
|
|
|
|
|
dump_config
|
|
|
|
|
puts "Exit status: #{e.status}" if BuildError === e
|
|
|
|
|
end
|
|
|
|
|
puts e.backtrace if fatal or ARGV.debug?
|
|
|
|
|
|
2009-09-23 09:32:04 +01:00
|
|
|
exit 1
|
2009-07-31 02:51:17 +01:00
|
|
|
end
|