Added rake task and tests

Added rake task support.

(Obviously failing against current b191595cd8d36c3ac5535d6176a627b612d50758)