lib/rake_completion.zsh
5da20b9d
 _rake_does_task_list_need_generating () {
86925121
   if [ ! -f .rake_tasks~ ]; then return 0;
5da20b9d
   else
286559d1
     accurate=$(stat -f%m .rake_tasks~)
     changed=$(stat -f%m Rakefile)
5da20b9d
     return $(expr $accurate '>=' $changed)
   fi
 }
 
 _rake () {
   if [ -f Rakefile ]; then
     if _rake_does_task_list_need_generating; then
86925121
       echo "\nGenerating .rake_tasks~..." > /dev/stderr
       rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~
5da20b9d
     fi
86925121
     compadd `cat .rake_tasks~`
5da20b9d
   fi
 }
 
2759586a
 compctl -K _rake rake
5da20b9d
 
 function _cap_does_task_list_need_generating () {
86925121
   if [ ! -f .cap_tasks~ ]; then return 0;
5da20b9d
   else
86925121
     accurate=$(stat -f%m .cap_tasks~)
5da20b9d
     changed=$(stat -f%m config/deploy.rb)
     return $(expr $accurate '>=' $changed)
   fi
 }
 
 function _cap () {
   if [ -f config/deploy.rb ]; then
     if _cap_does_task_list_need_generating; then
86925121
       echo "\nGenerating .cap_tasks~..." > /dev/stderr
5da20b9d
       cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D'
86925121
 > .cap_tasks~
5da20b9d
     fi
86925121
     compadd `cat .cap_tasks~`
5da20b9d
   fi
 }
 
2759586a
 compctl -K _cap cap