From 8ab7cf827d0668a7a14697e5509cd22f4ddfa8e6 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 27 Jan 2013 22:34:26 +0000 Subject: Add bash and zsh completion directory functions. --- Library/Formula/ack.rb | 4 ++-- Library/Formula/git.rb | 10 +++++----- Library/Formula/hub.rb | 6 +++--- Library/Homebrew/formula.rb | 3 +++ 4 files changed, 13 insertions(+), 10 deletions(-) (limited to 'Library') diff --git a/Library/Formula/ack.rb b/Library/Formula/ack.rb index 05562c536..6d25dd7e0 100644 --- a/Library/Formula/ack.rb +++ b/Library/Formula/ack.rb @@ -9,7 +9,7 @@ class Ack < Formula system "pod2man ack ack.1" man1.install 'ack.1' bin.install 'ack' - (prefix+'etc/bash_completion.d').install 'etc/ack.bash_completion.sh' - (share+'zsh/site-functions').install 'etc/ack.zsh_completion' => '_ack' + bash_completion.install 'etc/ack.bash_completion.sh' + zsh_completion.install 'etc/ack.zsh_completion' => '_ack' end end diff --git a/Library/Formula/git.rb b/Library/Formula/git.rb index abc0cc892..94fca646e 100644 --- a/Library/Formula/git.rb +++ b/Library/Formula/git.rb @@ -65,12 +65,12 @@ class Git < Formula bin.install 'git-subtree' end - # install the completion scripts from 'contrib' first - (etc+'bash_completion.d').install 'contrib/completion/git-completion.bash' - (etc+'bash_completion.d').install 'contrib/completion/git-prompt.sh' + # install the completion script first because it is inside 'contrib' + bash_completion.install 'contrib/completion/git-completion.bash' + bash_completion.install 'contrib/completion/git-prompt.sh' - (share+'zsh/site-functions').install 'contrib/completion/git-completion.zsh' => '_git' - ln_s "#{etc}/bash_completion.d/git-completion.bash", "#{share}/zsh/site-functions" + zsh_completion.install 'contrib/completion/git-completion.zsh' => '_git' + ln_sf "#{etc}/bash_completion.d/git-completion.bash", zsh_completion (share+'git-core').install 'contrib' diff --git a/Library/Formula/hub.rb b/Library/Formula/hub.rb index fb235f039..452a55c7f 100644 --- a/Library/Formula/hub.rb +++ b/Library/Formula/hub.rb @@ -8,9 +8,9 @@ class Hub < Formula head 'https://github.com/defunkt/hub.git' def install - system rake_bin, "install", "prefix=#{prefix}" - (prefix+'etc/bash_completion.d').install 'etc/hub.bash_completion.sh' - (share+'zsh/site-functions').install 'etc/hub.zsh_completion' => '_hub' + system "rake", "install", "prefix=#{prefix}" + bash_completion.install 'etc/hub.bash_completion.sh' + zsh_completion.install 'etc/hub.zsh_completion' => '_hub' end def rake_bin diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 37f394ce9..47a2a4d11 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -137,6 +137,9 @@ class Formula # generally we don't want var stuff inside the keg def var; HOMEBREW_PREFIX+'var' end + def bash_completion; prefix+'etc/bash_completion.d' end + def zsh_completion; share+'zsh/site-functions' end + # override this to provide a plist def plist; nil; end alias :startup_plist :plist -- cgit v1.2.3