Use explicit time format in db:dump_dir Rake task

The format of Time#to_s varies by Ruby version.
Refactor Rake tasks into a module
Add specs for Rake tasks