Browse code

Updating the name of the rake and capistrano task cache file to append a ~ to the end of the filename so it's easier to ignore in rails git projects. [#1]

Robby Russell authored on 07/09/2009 at 16:18:40
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 _rake_does_task_list_need_generating () {
2
-  if [ ! -f .rake_tasks ]; then return 0;
2
+  if [ ! -f .rake_tasks~ ]; then return 0;
3 3
   else
4
-    accurate=$(stat -f%m .rake_tasks)
4
+    accurate=$(stat -f%m .rake_tasks~)
5 5
     changed=$(stat -f%m Rakefile)
6 6
     return $(expr $accurate '>=' $changed)
7 7
   fi
... ...
@@ -10,19 +10,19 @@ _rake_does_task_list_need_generating () {
10 10
 _rake () {
11 11
   if [ -f Rakefile ]; then
12 12
     if _rake_does_task_list_need_generating; then
13
-      echo "\nGenerating .rake_tasks..." > /dev/stderr
14
-      rake --silent --tasks | cut -d " " -f 2 > .rake_tasks
13
+      echo "\nGenerating .rake_tasks~..." > /dev/stderr
14
+      rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~
15 15
     fi
16
-    compadd `cat .rake_tasks`
16
+    compadd `cat .rake_tasks~`
17 17
   fi
18 18
 }
19 19
 
20 20
 compdef _rake rake
21 21
 
22 22
 function _cap_does_task_list_need_generating () {
23
-  if [ ! -f .cap_tasks ]; then return 0;
23
+  if [ ! -f .cap_tasks~ ]; then return 0;
24 24
   else
25
-    accurate=$(stat -f%m .cap_tasks)
25
+    accurate=$(stat -f%m .cap_tasks~)
26 26
     changed=$(stat -f%m config/deploy.rb)
27 27
     return $(expr $accurate '>=' $changed)
28 28
   fi
... ...
@@ -31,11 +31,11 @@ function _cap_does_task_list_need_generating () {
31 31
 function _cap () {
32 32
   if [ -f config/deploy.rb ]; then
33 33
     if _cap_does_task_list_need_generating; then
34
-      echo "\nGenerating .cap_tasks..." > /dev/stderr
34
+      echo "\nGenerating .cap_tasks~..." > /dev/stderr
35 35
       cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D'
36
-> .cap_tasks
36
+> .cap_tasks~
37 37
     fi
38
-    compadd `cat .cap_tasks`
38
+    compadd `cat .cap_tasks~`
39 39
   fi
40 40
 }
41 41