Fix rake task

This supersedes #1494.

@postmodern - I squashed your PR into one commit and then added the load path changes we discussed in #1494.  Care to review?