Browse files

bash-completion2: cleanup

 - Don't symlink Homebrew's completion script if the target already
   exists.
 - Define and use compdir in the caveats.
 - Remove HEAD build; the install method doesn't support it ATM.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
  • Loading branch information...
1 parent adda1b1 commit f8c0f82a72e11619a7609470f60ce40443ce8797 @jacknagel jacknagel committed Aug 20, 2012
Showing with 10 additions and 7 deletions.
  1. +10 −7 bash-completion2.rb
View
17 bash-completion2.rb
@@ -5,7 +5,11 @@ class BashCompletion2 < Formula
url 'http://bash-completion.alioth.debian.org/files/bash-completion-2.0.tar.bz2'
sha256 'e5a490a4301dfb228361bdca2ffca597958e47dd6056005ef9393a5852af5804'
- head 'git://git.debian.org/git/bash-completion/bash-completion.git'
+ conflicts_with 'bash-completion'
+
+ def compdir
+ HOMEBREW_PREFIX/'share/bash-completion/completions'
+ end
def install
inreplace 'bash_completion', 'readlink -f', 'readlink'
@@ -14,10 +18,9 @@ def install
ENV.deparallelize
system "make install"
- brew_bash_completion = HOMEBREW_REPOSITORY/'Library/Contributions/brew_bash_completion.sh'
- compdir = HOMEBREW_PREFIX/'share/bash-completion/completions'
- (compdir/'brew').unlink
- compdir.install_symlink brew_bash_completion => 'brew'
+ unless (compdir/'brew').exist?
+ compdir.install_symlink HOMEBREW_CONTRIB/'brew_bash_completion.sh' => 'brew'
+ end
end
def caveats; <<-EOS.undent
@@ -27,10 +30,10 @@ def caveats; <<-EOS.undent
fi
Homebrew's own bash completion script has been linked into
- #{HOMEBREW_PREFIX}/share/bash-completion/completions
+ #{compdir}
bash-completion will automatically source it when you invoke `brew`.
- Any completion scripts in #{HOMEBREW_PREFIX}/etc/bash_completion.d
+ Any completion scripts in #{Formula.factory("bash-completion").compdir}
will continue to be sourced as well.
EOS
end

0 comments on commit f8c0f82

Please sign in to comment.