grunt-fastly
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -45,3 +45,5 @@ /* | ||
urls: [ | ||
'folder/picture.jpg' | ||
'folder/picture1.jpg', | ||
'folder/picture2.jpg', | ||
'folder/picture3.jpg' | ||
] | ||
@@ -48,0 +50,0 @@ } |
{ | ||
"name": "grunt-fastly", | ||
"description": "A Grunt plugin to purge cache from Fastly", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/coen-hyde/grunt-fastly", | ||
@@ -32,6 +32,4 @@ "author": { | ||
"grunt-contrib-jshint": "~0.6.0", | ||
"grunt-contrib-clean": "~0.4.0", | ||
"grunt-contrib-nodeunit": "~0.2.0", | ||
"grunt": "~0.4.1", | ||
"grunt-nock": "~0.1.3" | ||
"grunt": "~0.4.1" | ||
}, | ||
@@ -38,0 +36,0 @@ "peerDependencies": { |
@@ -27,2 +27,6 @@ /* | ||
if (typeof options.key === 'undefined') { | ||
grunt.fail.fatal('Fastly api key is required.'); | ||
} | ||
fastly.authenticate(options.key); | ||
@@ -33,7 +37,12 @@ | ||
if (typeof options.serviceId === 'undefined') { | ||
grunt.log.error('A serviceId must be provided when purging all cache.'); | ||
return false | ||
grunt.fail.fatal('A serviceId must be provided when purging all cache.'); | ||
} | ||
fastly.purgeAll(options.serviceId, done); | ||
grunt.log.write('PurgeAll from "'+options.serviceId+'"...'); | ||
fastly.purgeAll(options.serviceId, function(err) { | ||
if (err) grunt.log.error(); | ||
else grunt.log.ok(); | ||
done(); | ||
}); | ||
return | ||
@@ -44,4 +53,3 @@ } | ||
if (typeof options.host === 'undefined') { | ||
grunt.log.error('If purging specific urls, a host must be provided.'); | ||
return false | ||
grunt.fail.fatal('If purging specific urls, a host must be provided.'); | ||
} | ||
@@ -54,5 +62,11 @@ | ||
async.eachLimit(this.data.urls, options.concurrentPurges, function(url, next) { | ||
fastly.purge(options.host, url, next); | ||
grunt.log.write('Purging "'+options.host+'/'+url+'"...'); | ||
fastly.purge(options.host, url, function(err) { | ||
if (err) grunt.log.error(); | ||
else grunt.log.ok(); | ||
next(); | ||
}); | ||
}, done); | ||
}); | ||
}; |
@@ -7,22 +7,2 @@ 'use strict'; | ||
/* | ||
======== A Handy Little Nodeunit Reference ======== | ||
https://github.com/caolan/nodeunit | ||
Test methods: | ||
test.expect(numAssertions) | ||
test.done() | ||
Test assertions: | ||
test.ok(value, [message]) | ||
test.equal(actual, expected, [message]) | ||
test.notEqual(actual, expected, [message]) | ||
test.deepEqual(actual, expected, [message]) | ||
test.notDeepEqual(actual, expected, [message]) | ||
test.strictEqual(actual, expected, [message]) | ||
test.notStrictEqual(actual, expected, [message]) | ||
test.throws(block, [error], [message]) | ||
test.doesNotThrow(block, [error], [message]) | ||
test.ifError(value) | ||
*/ | ||
exports.fastly = { | ||
@@ -48,7 +28,7 @@ purgeAll: function(test) { | ||
test.equal(calls.length, 1, 'Number of calls to purgeAll'); | ||
test.equal(calls.length, 3, 'Number of calls to purgeAll'); | ||
test.equal(calls[0].arguments['0'], 'example.com', 'The host purge'); | ||
test.equal(calls[0].arguments['1'], 'folder/picture.jpg', 'The url purge'); | ||
test.equal(calls[0].arguments['1'], 'folder/picture1.jpg', 'The url purge'); | ||
test.done(); | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
9431
154