RailsCasts Pro episodes are now free!

Learn more or hide this

Jacob Atzen's Profile

GitHub User: jacobat

Comments by Jacob Atzen

Avatar

Switching branches often makes the rake completion somewhat less usable. So I changed it up a bit to use the md5 sums of all the rake files instead of looking at timestamps:

zsh
#compdef rake

if [[ -f Rakefile ]]; then
  sum=`md5 -q Rakefile **/*.rake | md5`
  if [[ ! -f .rake_tasks.$sum~ ]]; then
    rake -s --tasks | cut -d ' ' -f 2 > .rake_tasks.$sum~
  fi
  compadd $(cat .rake_tasks.$sum~)
fi

This will leave a bunch of .rake_tasks.[...]~ files around so the fast completion will continue to work even when switching between branches that have different rake files.