imathis/octopress — pull request #672 by andrewreid (2012-07-17 13:14:33+00:00)
Title: Deploy to Amazon S3 using Fog

I've not done this whole pull request thing before, so apologies if I'm doing it wrong...

In changing over to Octopress, I wanted to deploy to an Amazon S3 + CloudFront stack as easily as `rake deploy` and found that this didn't exist "out of the box".

After a small bit of research, I noted that existing efforts such as those in #107, #455 and #460 based their implementation on the external `s3cmd` application. While they are all valid implementations, it isn't pure Ruby and doesn't allow for the frictionless installation of dependencies through `bundle install`.

This implementation uses the Fog library and as such, leaves open the possibility of easily accommodating other cloud storage providers. It's pure Ruby and as such should be platform agnostic.

It is very simple code and could be refactored such that it involves less `if` statements, I'm sure! In essence, it traverses the `public` directory of the octopress installation, creates folders, uploads files only if they've changed (compares the file's ETag) and then deletes files from the remote server that no longer exist locally.

I imagine there is refactoring and other changes and improvements to be made before it would be considered feature-complete, however it seems functional and allows `deploy_default = 's3'` and subsequently `rake deploy` to work.