aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/blacklist.rb49
-rw-r--r--Library/Homebrew/cmd/create.rb31
-rw-r--r--Library/Homebrew/cmd/install.rb43
-rw-r--r--Library/Homebrew/cmd/search.rb21
4 files changed, 69 insertions, 75 deletions
diff --git a/Library/Homebrew/blacklist.rb b/Library/Homebrew/blacklist.rb
new file mode 100644
index 000000000..6789ba1e7
--- /dev/null
+++ b/Library/Homebrew/blacklist.rb
@@ -0,0 +1,49 @@
+def blacklisted? name
+ case name.downcase
+ when 'vim', 'screen', /^rubygems?$/ then <<-EOS.undent
+ Apple distributes #{name} with OS X, you can find it in /usr/bin.
+ EOS
+ when 'libxml', 'libarchive', 'libpcap' then <<-EOS.undent
+ Apple distributes #{name} with OS X, you can find it in /usr/lib.
+ EOS
+ when 'libxlst', 'freetype', 'libpng' then <<-EOS.undent
+ Apple distributes #{name} with OS X, you can find it in /usr/X11/lib.
+ However not all build scripts look here, so you may need to call ENV.x11 or
+ ENV.libxml2 in your formula's install function.
+ EOS
+ when 'wxwidgets' then <<-EOS.undent
+ An old version of wxWidgets can be found in /usr/X11/lib. However, Homebrew
+ does provide a newer version, 2.8.10:
+
+ brew install wxmac
+ EOS
+ when 'tex', 'tex-live', 'texlive' then <<-EOS.undent
+ Installing TeX from source is weird and gross, requires a lot of patches,
+ and only builds 32-bit (and thus can't use Homebrew deps on Snow Leopard.)
+
+ We recommend using a MacTeX distribution: http://www.tug.org/mactex/
+ EOS
+ when 'mercurial', 'hg' then <<-EOS.undent
+ Install Mercurial with pip:
+
+ brew install pip && pip install mercurial
+
+ Or easy_install:
+
+ easy_install mercurial
+ EOS
+ when 'setuptools' then <<-EOS.undent
+ When working with a Homebrew-built Python, distribute is preferred over
+ setuptools, and can be used as the prerequisite for pip:
+
+ brew install distribute
+ EOS
+ when 'npm' then <<-EOS.undent
+ npm can be installed thusly by following the instructions at
+ http://npmjs.org/
+
+ To do it in one line, use this command:
+ curl http://npmjs.org/install.sh | sudo sh
+ EOS
+ end
+end
diff --git a/Library/Homebrew/cmd/create.rb b/Library/Homebrew/cmd/create.rb
index e21c9a524..8f39ce87b 100644
--- a/Library/Homebrew/cmd/create.rb
+++ b/Library/Homebrew/cmd/create.rb
@@ -1,4 +1,5 @@
require 'formula'
+require 'blacklist'
module Homebrew extend self
def create
@@ -26,7 +27,7 @@ module Homebrew extend self
unless ARGV.force?
if msg = blacklisted?(fc.name)
- raise "#{msg}\n\nIf you really want to make this formula use --force."
+ raise "#{fc.name} is blacklisted for creation.\n#{msg}\nIf you really want to create this formula use --force."
end
if Formula.aliases.include? fc.name
@@ -49,34 +50,6 @@ module Homebrew extend self
gots = $stdin.gets.chomp
if gots.empty? then nil else gots end
end
-
- def blacklisted? name
- case name.downcase
- when 'vim', 'screen' then <<-EOS.undent
- #{name} is blacklisted for creation
- Apple distributes this program with OS X.
- EOS
- when 'libarchive', 'libpcap' then <<-EOS.undent
- #{name} is blacklisted for creation
- Apple distributes this library with OS X, you can find it in /usr/lib.
- EOS
- when 'libxml', 'libxlst', 'freetype', 'libpng' then <<-EOS.undent
- #{name} is blacklisted for creation
- Apple distributes this library with OS X, you can find it in /usr/X11/lib.
- However not all build scripts look here, so you may need to call ENV.x11 or
- ENV.libxml2 in your formula's install function.
- EOS
- when /^rubygems?$/
- "Sorry RubyGems comes with OS X so we don't package it."
- when 'wxwidgets' then <<-EOS.undent
- #{name} is blacklisted for creation
- An older version of wxWidgets is provided by Apple with OS X, but
- a formula for wxWidgets 2.8.10 is provided:
-
- brew install wxmac
- EOS
- end
- end
end
class FormulaCreator
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index 2c48085da..2102d2182 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -1,10 +1,12 @@
require 'formula_installer'
require 'hardware'
+require 'blacklist'
module Homebrew extend self
def install
- blacklisted? ARGV.named do |msg, name|
- abort msg
+ ARGV.named.each do |name|
+ msg = blacklisted? name
+ raise "No available formula for #{name}\n#{msg}" if msg
end unless ARGV.force?
install_formulae ARGV.formulae
@@ -62,41 +64,4 @@ module Homebrew extend self
end
end
end
-
- def blacklisted? names
- names.each do |name|
- msg = blacklisted_reason name
- yield msg.undent, name if msg
- end
- end
-
- def blacklisted_reason name
- case name
- when 'tex', 'tex-live', 'texlive' then <<-EOS
- Installing TeX from source is weird and gross, requires a lot of patches,
- and only builds 32-bit (and thus can't use Homebrew deps on Snow Leopard.)
-
- We recommend using a MacTeX distribution:
- http://www.tug.org/mactex/
- EOS
- when 'mercurial', 'hg' then <<-EOS
- Mercurial can be install thusly:
- brew install pip && pip install mercurial
- EOS
- when 'npm' then abort <<-EOS.undent
- npm can be installed thusly by following the instructions at
- http://npmjs.org/
-
- To do it in one line, use this command:
- curl http://npmjs.org/install.sh | sudo sh
- EOS
- when 'setuptools' then abort <<-EOS.undent
- When working with a Homebrew-built Python, distribute is preferred
- over setuptools, and can be used as the prerequisite for pip.
-
- Install distribute using:
- brew install distribute
- EOS
- end
- end
end
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index b6a0e971d..ccbf784d4 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -1,4 +1,5 @@
require "formula"
+require "blacklist"
module Homebrew extend self
def search
@@ -6,14 +7,20 @@ module Homebrew extend self
exec "open", "http://www.macports.org/ports.php?by=name&substr=#{ARGV.next}"
elsif ARGV.include? '--fink'
exec "open", "http://pdb.finkproject.org/pdb/browse.php?summary=#{ARGV.next}"
- end
-
- require 'cmd/install' # for blacklisted? function
- blacklisted? ARGV.named do |msg, _|
- abort msg
- end unless ARGV.force?
+ else
+ query = ARGV.first
+ search_results = search_brews query
+ puts_columns search_results
- puts_columns search_brews(ARGV.first)
+ if $stdout.tty? and msg = blacklisted?(query)
+ unless search_results.empty?
+ puts
+ puts "If you meant `#{query}' precisely:"
+ puts
+ end
+ puts msg
+ end
+ end
end
def search_brews text