Skip to content

Commit

Permalink
cleanup index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
clineamb committed Aug 3, 2015
1 parent 9fce915 commit c712cef
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions index.js
Expand Up @@ -22,27 +22,32 @@ gulpPrefixer = function (AWS) {

return function (options) {

var stream, _s3 = new AWS.S3(),
the_bucket = options.Bucket || options.bucket
var stream, _s3 = new AWS.S3()
, the_bucket = options.Bucket || options.bucket
;

if(!the_bucket) {
throw new PluginError(PLUGIN_NAME, "Missing S3 bucket name!");
}

// *NEW* in v1.1.0 - Async File Uploading

stream = es.map(function (file, callback) {

var _stream = this,
keyTransform, keyname, keyparts, filename,
mimetype, mime_lookup_name, metadata
;

file_counts.total++;

if(file.isNull()) {
// Do nothing if no contents
return callback(null);
}

if(file.isStream()) {
// Not supporting streams (for now?).
return callback(new gutil.PluginError(PLUGIN_NAME, 'No stream support.'));
}

Expand Down Expand Up @@ -137,7 +142,7 @@ gulpPrefixer = function (AWS) {

if(getData && getData.ETag === '"' + hash + '"') {
// AWS ETag doesn't match local ETag

file_counts.unchanged++;
gutil.log(gutil.colors.gray("No Change ..... "), keyname);
callback(null);

Expand All @@ -163,12 +168,15 @@ gulpPrefixer = function (AWS) {
if (getData) {
if (getData.ETag !== data.ETag) {
gutil.log(gutil.colors.yellow("Updated ....... "), keyname);
file_counts.updated++;
} else {
gutil.log(gutil.colors.gray("No Change ..... "), keyname);
file_counts.unchanged++;
}
} else {
// doesn't exist in bucket, the object is new to the bucket
gutil.log(gutil.colors.green("Uploaded! ..... "), keyname);
file_counts.new++;
}

callback(null);
Expand Down

0 comments on commit c712cef

Please sign in to comment.