ef5a65b207934dce79c7318892a65b399ec3f9e3
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Renaming cap to capistrano
Diff
1diff --git a/plugins/cap/cap.plugin.zsh b/plugins/cap/cap.plugin.zsh
2deleted file mode 100644
3index d22d104017ecdddad5b670d1188140e6c39f2672..0000000000000000000000000000000000000000
4--- a/plugins/cap/cap.plugin.zsh
5+++ /dev/null
6@@ -1,41 +0,0 @@
7-stat -f%m . > /dev/null 2>&1
8-if [ "$?" = 0 ]; then
9- stat_cmd=(stat -f%m)
10-else
11- stat_cmd=(stat -L --format=%y)
12-fi
13-
14-# Cache filename
15-_cap_show_undescribed_tasks=0
16-
17-# Cache filename
18-_cap_task_cache_file='.cap_task_cache'
19-
20-_cap_get_task_list () {
21- if [ ${_cap_show_undescribed_tasks} -eq 0 ]; then
22- cap -T | grep '^cap' | cut -d " " -f 2
23- else
24- cap -vT | grep '^cap' | cut -d " " -f 2
25- fi
26-}
27-
28-_cap_does_task_list_need_generating () {
29-
30- if [ ! -f ${_cap_task_cache_file} ]; then return 0;
31- else
32- accurate=$($stat_cmd $_cap_task_cache_file)
33- changed=$($stat_cmd config/deploy.rb)
34- return $(expr $accurate '>=' $changed)
35- fi
36-}
37-
38-function _cap () {
39- if [ -f config/deploy.rb ]; then
40- if _cap_does_task_list_need_generating; then
41- _cap_get_task_list > ${_cap_task_cache_file}
42- fi
43- compadd `cat ${_cap_task_cache_file}`
44- fi
45-}
46-
47-compdef _cap cap
48diff --git a/plugins/capistrano/_capistrano b/plugins/capistrano/_capistrano
49new file mode 100644
50index 0000000000000000000000000000000000000000..cf6b50c7f9b62cd5d499352e5520cc43bcd9c2b5
51--- /dev/null
52+++ b/plugins/capistrano/_capistrano
53@@ -0,0 +1,10 @@
54+#compdef cap
55+#autoload
56+
57+if [ -f config/deploy.rb ]; then
58+ if [[ ! -f .cap_tasks~ || config/deploy.rb -nt .cap_tasks~ ]]; then
59+ echo "\nGenerating .cap_tasks~..." > /dev/stderr
60+ cap --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~
61+ fi
62+ compadd `cat .cap_tasks~`
63+fi