New rake task for changing attachment options

I found myself facing the not-uncommon problem of wanting to move my paperclip attachments to Amazon S3, as well as the perhaps less common problem of needing to change the hash_secret. After some Googling without finding anything that felt quite right, I tried to make a solution flexible enough for any kind of option change. It's nevertheless wise not to accept new uploads while making this kind of migration!

The new rake task paperclip:change_options takes the same environment variables as the refresh functions: CLASS and an optional ATTACHMENT. It reads the options in config/new_paperclip_options.yml as an ERB YAML file, just like database.yml, and merges them onto the attachment's existing options. A temporary attachment instance is then created and saved with the modified options, but the original attachment and model are unaffected.

Once the task has been run, you can update the actual has_attached_file options to match new_paperclip_options.yml. After deploying, paperclip will find the new files instead. In case of typos in the options or meteor strike, reversion is also painless since the original files are not affected at all.

I did not see any tests for the other rake tasks, so I wasn't sure what to do to test this, but I'd be happy to add a commit with specs if you can point me in the right direction. I did migrate my own app's user content to S3 with a new hash_secret using this without any trouble.