rake-fast.plugin.zsh 606 B

1234567891011121314151617181920212223242526272829
  1. _rake_refresh () {
  2. if [ -f .rake_tasks ]; then
  3. rm .rake_tasks
  4. fi
  5. echo "Generating .rake_tasks..." > /dev/stderr
  6. _rake_generate
  7. cat .rake_tasks
  8. }
  9. _rake_does_task_list_need_generating () {
  10. [[ ! -f .rake_tasks ]] || [[ Rakefile -nt .rake_tasks ]]
  11. }
  12. _rake_generate () {
  13. rake --silent --tasks | cut -d " " -f 2 > .rake_tasks
  14. }
  15. _rake () {
  16. if [ -f Rakefile ]; then
  17. if _rake_does_task_list_need_generating; then
  18. echo "\nGenerating .rake_tasks..." > /dev/stderr
  19. _rake_generate
  20. fi
  21. compadd `cat .rake_tasks`
  22. fi
  23. }
  24. compdef _rake rake
  25. alias rake_refresh='_rake_refresh'