Browse code

Jake-node plugin : update - remove the need to write a `jake_tasks` in the directory - use most recent usage of completion with zsh - tested for MacOSX and Ubuntu

LacheĢ€ze Alexandre authored on 02/12/2011 at 11:54:04
Showing 1 changed files
... ...
@@ -1,28 +1,14 @@
1 1
 #---oh-my-zsh plugin : task Autocomplete for Jake tool---
2 2
 # Jake : https://github.com/mde/jake
3
-# Warning : Jakefile should have the right case : Jakefile
4
-# Warnign : Add a .jake_tasks file to your working directory
3
+# Warning : Jakefile should have the right case : Jakefile or jakefile
4
+# Tested on : MacOSX 10.7 (Lion), Ubuntu 11.10
5 5
 # Author : Alexandre Lacheze (@al3xstrat)
6 6
 # Inspiration : http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh 
7 7
 
8
-function _jake_does_task_list_need_generating () {
9
-  if [ ! -f .jake_tasks ]; then
10
-    return 0;
11
-  else
12
-    accurate=$(stat -f%m .jake_tasks)
13
-    changed=$(stat -f%m Jakefile)
14
-    return $(expr $accurate '>=' $changed)
15
-  fi
16
-}
17
-
18 8
 function _jake () {
19
-  if [ -f Jakefile ]; then
20
-    if _jake_does_task_list_need_generating; then
21
-      echo "\nGenerating .jake_tasks..." > /dev/stderr
22
-      jake -T | cut -d " " -f 2 | sed -E "s/.\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" > .jake_tasks
23
-    fi
24
-    reply=( `cat .jake_tasks` )
9
+  if [ -f Jakefile ]||[ -f jakefile ]; then
10
+    compadd `jake -T | cut -d " " -f 2 | sed -E "s/.\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"`
25 11
   fi
26 12
 }
27 13
 
28
-compctl -K _jake jake
29 14
\ No newline at end of file
15
+compdef _jake jake
30 16
\ No newline at end of file