gulp-awspublish
Advanced tools
Comparing version 0.0.22 to 0.0.23
0.0.23 / 2014-09-02 | ||
================== | ||
* Merge pull request #27 from zjjw/create_only | ||
0.0.22 / 2014-08-08 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -276,5 +276,8 @@ var Stream = require('stream'), | ||
} | ||
// skip: no updates allowed | ||
var noUpdate = options.createOnly && res.headers.etag; | ||
// skip: file are identical | ||
var noChange = !options.force && res.headers.etag === etag; | ||
// skip: file are identical | ||
if (!options.force && res.headers.etag === etag) { | ||
if (noUpdate || noChange) { | ||
file.s3.state = 'skip'; | ||
@@ -281,0 +284,0 @@ file.s3.etag = etag; |
{ | ||
"name": "gulp-awspublish", | ||
"version": "0.0.22", | ||
"version": "0.0.23", | ||
"description": "gulp plugin to publish files to amazon s3", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -89,2 +89,3 @@ # gulp-awspublish | ||
- simulate: debugging option to simulate s3 upload | ||
- createOnly: skip file updates | ||
@@ -91,0 +92,0 @@ Files that go through the stream receive extra properties: |
@@ -169,3 +169,3 @@ /* global describe, before, it */ | ||
it('should update exsiting file on s3', function (done) { | ||
it('should update existing file on s3', function (done) { | ||
var stream = publisher.publish(); | ||
@@ -188,2 +188,22 @@ stream.pipe(es.writeArray(function(err, files) { | ||
it('can skip updating an existing file on s3 (createOnly)', function (done) { | ||
var stream = publisher.publish({}, { | ||
createOnly: true | ||
}); | ||
stream.pipe(es.writeArray(function(err, files) { | ||
expect(err).not.to.exist; | ||
expect(files).to.have.length(1); | ||
expect(files[0].s3.state).to.eq('skip'); | ||
done(err); | ||
})); | ||
stream.write(new gutil.File({ | ||
path: '/test/hello.txt', | ||
base: '/', | ||
contents: new Buffer('hello world 2') | ||
})); | ||
stream.end(); | ||
}); | ||
it('should skip file update', function (done) { | ||
@@ -190,0 +210,0 @@ var stream = publisher.publish(); |
32025
674
203