31badac2ea2ecdc77cf4c339fcef9472940cb261

Author
Lachèze Alexandre <alexandre.lacheze@gmail.com>
Committer
Lachèze Alexandre <alexandre.lacheze@gmail.com>
Date

Message

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

Diff

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