Browse code

Merge branch 'plugins'

Andrew Hodges authored on 28/05/2011 at 17:14:42
Showing 13 changed files
... ...
@@ -25,10 +25,12 @@ _1st_arguments=(
25 25
   'link:link a formula'
26 26
   'list:list files in a formula or not-installed formulae'
27 27
   'log:git commit log for a formula'
28
+  'missing:check all installed formuale for missing dependencies.'
28 29
   'outdated:list formulas for which a newer version is available'
29 30
   'prune:remove dead links'
30 31
   'remove:remove a formula'
31 32
   'search:search for a formula (/regex/ or string)'
33
+  'server:start a local web app that lets you browse formulae (requires Sinatra)'
32 34
   'unlink:unlink a formula'
33 35
   'update:freshen up links'
34 36
   'upgrade:upgrade outdated formulae'
... ...
@@ -36,10 +38,14 @@ _1st_arguments=(
36 36
 )
37 37
 
38 38
 local expl
39
-local -a formula installed_formulae
39
+local -a formulae installed_formulae
40 40
 
41 41
 _arguments \
42
-  '(-v --verbose)'{-v,--verbose}'[verbose]' \
42
+  '(-v)-v[verbose]' \
43
+  '(--cellar)--cellar[brew cellar]' \
44
+  '(--config)--config[brew configuration]' \
45
+  '(--env)--env[brew environment]' \
46
+  '(--repository)--repository[brew repository]' \
43 47
   '(--version)--version[version information]' \
44 48
   '(--prefix)--prefix[where brew lives on this system]' \
45 49
   '(--cache)--cache[brew cache]' \
... ...
@@ -51,20 +57,24 @@ if (( CURRENT == 1 )); then
51 51
 fi
52 52
 
53 53
 case "$words[1]" in
54
-  list)
54
+  search|-S)
55
+    _arguments \
56
+      '(--macports)--macports[search the macports repository]' \
57
+      '(--fink)--fink[search the fink repository]' ;;
58
+  list|ls)
55 59
     _arguments \
56 60
       '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
61
+      '(--versions)--versions[list all installed versions of a formula]' \
57 62
       '1: :->forms' &&  return 0
58 63
 
59 64
       if [[ "$state" == forms ]]; then
60 65
         _brew_installed_formulae
61
-        _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae
66
+        _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
62 67
       fi ;;
63
-  install|home|log|info|uses|cat|deps)
68
+  install|home|homepage|log|info|abv|uses|cat|deps|edit|options)
64 69
     _brew_all_formulae
65 70
     _wanted formulae expl 'all formulae' compadd -a formulae ;;
66
-  remove|edit|xo)
71
+  remove|rm|uninstall|unlink|cleanup|link|ln)
67 72
     _brew_installed_formulae
68 73
     _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
69 74
 esac
70
-
71 75
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+# Move /usr/local/bin (path where brews are linked) to the front of the path
1
+# This will allow us to override system binaries like ruby with our brews
2
+# TODO: Do this in a more compatible way.
3
+#       What if someone doesn't have /usr/bin in their path?
4
+export PATH=`echo $PATH | sed -e 's|/usr/local/bin||' -e 's|::|:|g'` # Remove /usr/local/bin
5
+export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/bin:&|'`     # Add it in front of /usr/bin
6
+export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/sbin:&|'`    # Add /usr/local/sbin
7
+
8
+alias brews='brew list -1'
9
+
10
+function brew-link-completion {
11
+	ln -s "$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh" "$ZSH/plugins/brew/_brew.official"
12
+}
... ...
@@ -18,4 +18,4 @@ function _cap () {
18 18
   fi
19 19
 }
20 20
 
21
-compctl -K _cap cap
22 21
\ No newline at end of file
22
+compctl -K _cap cap
... ...
@@ -5,7 +5,6 @@
5 5
 #       VERSION:  1.0.0
6 6
 # ------------------------------------------------------------------------------
7 7
 
8
-
9 8
 if (( ${+commands[compleat]} )); then
10 9
   local prefix="${commands[compleat]:h:h}"
11 10
   local setup="${prefix}/share/compleat-1.0/compleat_setup" 
... ...
@@ -19,4 +18,3 @@ if (( ${+commands[compleat]} )); then
19 19
     source "$setup" 
20 20
   fi
21 21
 fi
22
-
... ...
@@ -4,4 +4,3 @@ if [ "$commands[(I)hub]" ]; then
4 4
     # eval `hub alias -s zsh`
5 5
     function git(){hub "$@"}
6 6
 fi
7
-
8 7
new file mode 100644
... ...
@@ -0,0 +1,8 @@
0
+# This works if you installed node via homebrew.
1
+export NODE_PATH="/usr/local/lib/node"
2
+
3
+# Open the node api for your current version to the optional section.
4
+# TODO: Make the section part easier to use.
5
+function node-api {
6
+	open "http://nodejs.org/docs/$(node --version)/api/all.html#$1"
7
+}
0 8
new file mode 100644
... ...
@@ -0,0 +1,2 @@
0
+# TODO: Don't do this in such a weird way.
1
+export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/share/npm/bin:&|'`
... ...
@@ -1,3 +1,9 @@
1
+alias showfiles='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder'
2
+alias hidefiles='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder'
3
+
4
+# Recursively delete .DS_Store files
5
+alias rm-dsstore="find . -name '*.DS_Store' -type f -delete"
6
+
1 7
 function savepath() {
2 8
   pwd > ~/.current_path~
3 9
 }
4 10
new file mode 100644
... ...
@@ -0,0 +1,10 @@
0
+# Thanks to Christopher Sexton
1
+# https://gist.github.com/965032
2
+function kapow {
3
+	touch ~/.pow/$1/tmp/restart.txt
4
+	if [ $? -eq 0 ]; then
5
+		echo "$fg[yellow]Pow restarting $1...$reset_color"
6
+	fi
7
+}
8
+
9
+compctl -W ~/.pow -/ kapow
... ...
@@ -1,4 +1,6 @@
1
+# TODO: Make this compatible with rvm.
2
+#       Run sudo gem on the system ruby, not the active ruby.
1 3
 alias sgem='sudo gem'
2 4
 
3 5
 # Find ruby file
4
-alias rfind='find . -name *.rb | xargs grep -n'
5 6
\ No newline at end of file
7
+alias rfind='find . -name *.rb | xargs grep -n'
... ...
@@ -1,3 +1,52 @@
1 1
 fpath=($ZSH/plugins/rvm $fpath)
2 2
 autoload -U compinit
3 3
 compinit -i
4
+
5
+alias rubies='rvm list rubies'
6
+alias gemsets='rvm gemset list'
7
+
8
+local ruby18='ruby-1.8.7-p334'
9
+local ruby19='ruby-1.9.2-p180'
10
+
11
+function rb18 {
12
+	if [ -z "$1" ]; then
13
+		rvm use "$ruby18"
14
+	else
15
+		rvm use "$ruby18@$1"
16
+	fi
17
+}
18
+
19
+_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`}
20
+compdef _rb18 rb18
21
+
22
+function rb19 {
23
+	if [ -z "$1" ]; then
24
+		rvm use "$ruby19"
25
+	else
26
+		rvm use "$ruby19@$1"
27
+	fi
28
+}
29
+
30
+_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
31
+compdef _rb19 rb19
32
+
33
+function rvm-update {
34
+	rvm get head
35
+	rvm reload # TODO: Reload rvm completion?
36
+}
37
+
38
+function rvm-link-completion {
39
+	ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official"
40
+}
41
+
42
+# TODO: Make this usable w/o rvm.
43
+function gems {
44
+	local current_ruby=`rvm-prompt i v p`
45
+	local current_gemset=`rvm-prompt g`
46
+
47
+	gem list $@ | sed \
48
+		-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
49
+		-Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
50
+		-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
51
+		-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
52
+}
... ...
@@ -1,11 +1,9 @@
1
-
2
-# TextMate
3 1
 alias et='mate .'
4 2
 alias ett='mate app config lib db public spec test Rakefile Capfile Todo'
5 3
 alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
6 4
 alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
7 5
 
8
-# Editor Ruby file in TextMate
6
+# Edit Ruby app in TextMate
9 7
 alias mr='mate CHANGELOG app config db lib public script spec test'
10 8
 
11 9
 function tm() {
12 10
new file mode 100644
... ...
@@ -0,0 +1,4 @@
0
+#compdef thor
1
+#autoload
2
+
3
+compadd `thor list | grep thor | cut -d " " -f 2`