2009-08-28 20:14:17 +02:00
|
|
|
_rake_does_task_list_need_generating () {
|
2009-09-07 18:18:40 +02:00
|
|
|
if [ ! -f .rake_tasks~ ]; then return 0;
|
2009-08-28 20:14:17 +02:00
|
|
|
else
|
2009-10-23 20:59:24 +02:00
|
|
|
accurate=$(stat -c "%n" .rake_tasks~)
|
|
|
|
changed=$(stat -c "%n" Rakefile)
|
2009-08-28 20:14:17 +02:00
|
|
|
return $(expr $accurate '>=' $changed)
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_rake () {
|
|
|
|
if [ -f Rakefile ]; then
|
|
|
|
if _rake_does_task_list_need_generating; then
|
2009-09-07 18:18:40 +02:00
|
|
|
echo "\nGenerating .rake_tasks~..." > /dev/stderr
|
|
|
|
rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~
|
2009-08-28 20:14:17 +02:00
|
|
|
fi
|
2009-09-07 18:18:40 +02:00
|
|
|
compadd `cat .rake_tasks~`
|
2009-08-28 20:14:17 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2009-09-23 05:36:28 +02:00
|
|
|
compctl -K _rake rake
|
2009-08-28 20:14:17 +02:00
|
|
|
|
|
|
|
function _cap_does_task_list_need_generating () {
|
2009-09-07 18:18:40 +02:00
|
|
|
if [ ! -f .cap_tasks~ ]; then return 0;
|
2009-08-28 20:14:17 +02:00
|
|
|
else
|
2009-09-07 18:18:40 +02:00
|
|
|
accurate=$(stat -f%m .cap_tasks~)
|
2009-08-28 20:14:17 +02:00
|
|
|
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
|
2009-09-07 18:18:40 +02:00
|
|
|
echo "\nGenerating .cap_tasks~..." > /dev/stderr
|
2009-08-28 20:14:17 +02:00
|
|
|
cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D'
|
2009-09-07 18:18:40 +02:00
|
|
|
> .cap_tasks~
|
2009-08-28 20:14:17 +02:00
|
|
|
fi
|
2009-09-07 18:18:40 +02:00
|
|
|
compadd `cat .cap_tasks~`
|
2009-08-28 20:14:17 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2009-09-23 05:36:28 +02:00
|
|
|
compctl -K _cap cap
|