awestruct/awestruct — pull request #345 by Mogztter (2013-08-22 18:06:08+00:00)
Title: Ability to add headers on files for S3 deployment

Usage:
```yaml
profiles:
production:
deploy:
type: s3
bucket: s3://awestruct.org
gzip: true
metadata:
jpg:
Cache-Control: max-age=2592000
jpeg:
Cache-Control: max-age=2592000
png:
Cache-Control: max-age=2592000
css:
Cache-Control: max-age=31536000
js:
Cache-Control: max-age=31536000
```

The above configuration will produce the following commands:
```sh
s3cmd sync '_site/' 's3://awestruct.org' --exclude '*' --include '*.jpg' --add-header 'Cache-Control:max-age=2592000'
s3cmd sync '_site/' 's3://awestruct.org' --exclude '*' --include '*.jpeg' --add-header 'Cache-Control:max-age=2592000'
s3cmd sync '_site/' 's3://awestruct.org' --exclude '*' --include '*.png' --add-header 'Cache-Control:max-age=2592000'
s3cmd sync '_site/' 's3://awestruct.org' --exclude '*' --include '*.css' --add-header 'Cache-Control:max-age=31536000' --add-header 'Content-Encoding:gzip'
s3cmd sync '_site/' 's3://awestruct.org' --exclude '*' --include '*.js' --add-header 'Cache-Control:max-age=31536000' --add-header 'Content-Encoding:gzip'
s3cmd sync '_site/' 's3://awestruct.org' --exclude '*' --include '*.html' --add-header 'Content-Encoding:gzip'
s3cmd sync '_site/' 's3://awestruct.org'
```

If we use `gzip` option, Awestruct will automatically add a `Content-Encoding:gzip` option on js, css and html files.

As a side note I removed the dependency on ruby-s3cmd or else, I should have done too much workaround to add multiple headers. The command line is quite simple to construct so I think there is no need to add a dependency.