grunt-awspublish

Publish and sync your files to amazon s3

grunt-awspublish

Publish and sync your files to amazon s3

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-awspublish --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-awspublish');

In your project's Gruntfile, add a section named awspublish to the data object passed into grunt.initConfig().

grunt.initConfig({
  awspublish: {
    options: {
      key: '...', /* amazon api key */
      secret: '...', /* amazon api secret */
      bucket: '...', /* amazon d3 bucket */
      sync: true, /* optional keep s3 dests in sync with local disk */
      syncIgnore: [], /* files matching this pattern will be ignored */
      headers: {  /* headers to apply */
        'x-amz-acl': 'public-read',
        'Expires': 'Tue, 07 Oct 2014 12:00:00 GMT',
        'ContentEncoding': 'gzip'
      }
    },
    files: [ /* files key pairs */
      {
        src: [],
        dest: '/foo', /* s3 destination */
        headers: {}   /* override headers */
      }
    ]
  },
})

Type: Boolean Default value: false

Keep s3 dest in sync with local disk (old files will be deleted)

Type: Array|String Default value: ``

files matching this won't be deleted from s3 during sync

Type: Object Default value: {'x-amz-acl': 'public-read'}

grunt.initConfig({
  awspublish: {
    'test1': {
      options: {
        key: '<%= aws.key %>',
        secret: '<%= aws.secret %>',
        bucket: '<%= aws.bucket %>',
        sync: true,
        syncIgnore: ['test/ignore-me/**']
        headers: {
          Expires: 'Tue, 07 Oct 2014 12:00:00 GMT'
        }
      },
      files: [
        {
          expand: true,
          cwd: 'test/fixtures',
          src: 'bar.txt',
          dest: 'test',
          headers: {
            ContentEncoding: 'gzip'
          }
        },
        {
          expand: true,
          cwd: 'test/fixtures',
          src: 'foo.html',
          dest: 'test'
        }
      ]
    }
  },
})

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

(Nothing yet)