2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-09-03 06:10:36 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class BashCompletion < Formula
|
2011-02-10 17:55:22 +00:00
|
|
|
url 'http://bash-completion.alioth.debian.org/files/bash-completion-1.3.tar.bz2'
|
2010-07-05 05:25:54 +00:00
|
|
|
homepage 'http://bash-completion.alioth.debian.org/'
|
2011-02-10 17:55:22 +00:00
|
|
|
md5 'a1262659b4bbf44dc9e59d034de505ec'
|
2010-07-05 05:25:54 +00:00
|
|
|
head 'git://git.debian.org/git/bash-completion/bash-completion.git'
|
2009-09-03 06:10:36 +00:00
|
|
|
|
|
|
|
def install
|
2010-09-13 15:50:14 +00:00
|
|
|
inreplace "bash_completion" do |s|
|
|
|
|
s.gsub! '/etc/bash_completion', "#{etc}/bash_completion"
|
2010-09-13 16:09:36 +00:00
|
|
|
s.gsub! 'readlink -f', "readlink"
|
2010-09-13 15:50:14 +00:00
|
|
|
end
|
|
|
|
|
2011-04-05 08:35:42 +00:00
|
|
|
if ARGV.build_head?
|
|
|
|
system "aclocal"
|
|
|
|
system "autoconf"
|
|
|
|
system "automake --add-missing"
|
2011-09-02 20:14:12 +00:00
|
|
|
system "./configure", "--prefix=#{prefix}"
|
|
|
|
|
|
|
|
inreplace 'Makefile' do |s|
|
|
|
|
s.change_make_var! "pkgconfigdir", "#{lib}/pkgconfig"
|
|
|
|
end
|
|
|
|
else
|
|
|
|
system "./configure", "--prefix=#{prefix}"
|
2011-04-05 08:35:42 +00:00
|
|
|
end
|
|
|
|
|
2009-09-03 06:10:36 +00:00
|
|
|
system "make install"
|
2011-02-10 17:55:22 +00:00
|
|
|
|
2011-03-13 19:04:22 +00:00
|
|
|
# Cause the build to fails if you haven't already installed git or something else that
|
|
|
|
# creates a bash_completion.d
|
|
|
|
# ln_s "#{HOMEBREW_PREFIX}/Library/Contributions/brew_bash_completion.sh", "#{etc}/bash_completion.d" unless
|
|
|
|
# File.exists? "#{etc}/bash_completion.d/brew_bash_completion.sh" or File.symlink? "#{etc}/bash_completion.d/brew_bash_completion.sh"
|
2009-09-03 06:10:36 +00:00
|
|
|
end
|
|
|
|
|
2011-09-02 20:14:12 +00:00
|
|
|
def caveats
|
|
|
|
if ARGV.build_head?
|
|
|
|
<<-EOS.undent
|
|
|
|
Add the following lines to your ~/.bash_profile file:
|
|
|
|
if [ -f `brew --prefix`/share/bash-completion/bash_completion ]; then
|
|
|
|
. `brew --prefix`/share/bash-completion/bash_completion
|
|
|
|
fi
|
|
|
|
|
|
|
|
Some formula install their own completion scripts. To use them with the
|
|
|
|
HEAD version of bash-completion, link them into
|
2011-03-13 19:04:22 +00:00
|
|
|
|
2011-09-02 20:14:12 +00:00
|
|
|
#{HOMEBREW_PREFIX}/share/bash-completion/completions
|
|
|
|
|
|
|
|
To install Homebrew's own completion script:
|
|
|
|
ln -s "#{HOMEBREW_PREFIX}/Library/Contributions/brew_bash_completion.sh" "#{HOMEBREW_PREFIX}/share/bash-completion/completions"
|
|
|
|
EOS
|
|
|
|
else
|
|
|
|
<<-EOS.undent
|
|
|
|
Add the following lines to your ~/.bash_profile file:
|
|
|
|
if [ -f `brew --prefix`/etc/bash_completion ]; then
|
|
|
|
. `brew --prefix`/etc/bash_completion
|
|
|
|
fi
|
|
|
|
|
|
|
|
To install Homebrew's own completion script:
|
|
|
|
ln -s "#{HOMEBREW_PREFIX}/Library/Contributions/brew_bash_completion.sh" "#{etc}/bash_completion.d"
|
|
|
|
EOS
|
|
|
|
end
|
2009-09-03 06:10:36 +00:00
|
|
|
end
|
|
|
|
end
|