Comparing version 1.2.0 to 1.2.1
@@ -24,2 +24,4 @@ #!/usr/bin/env node | ||
sleep: argv.sleep || 3 | ||
}); | ||
}, function(err) { | ||
if (err) throw err; | ||
}); |
25
index.js
@@ -29,13 +29,22 @@ var shisha = require('shisha'); | ||
*/ | ||
function smoke(resources, currentTry, config) { | ||
function smoke(resources, currentTry, config, callback) { | ||
shisha.smoke(resources, function(report){ | ||
var failedResources = _.filter(report, function(resource){ | ||
var failedResources = _(report).filter(function(resource){ | ||
return !(resource.result); | ||
}) | ||
}).map(function(item) { | ||
item.url = item.url(); | ||
item.status = 200; | ||
return item; | ||
}).value(); | ||
if (Object.keys(failedResources).length) { | ||
setTimeout(function(){ | ||
retry(failedResources, currentTry, config); | ||
try { | ||
retry(failedResources, currentTry, config, callback); | ||
} catch (err) { | ||
callback(err); | ||
} | ||
}, config.sleep * 1000) | ||
} else { | ||
callback(); | ||
console.log("All resources are on the CDN"); | ||
@@ -59,3 +68,3 @@ } | ||
*/ | ||
function retry(failedResources, currentTry, config){ | ||
function retry(failedResources, currentTry, config, callback){ | ||
console.log("Attempting to verify everything is on the CDN (" + currentTry + ")"); | ||
@@ -67,3 +76,3 @@ | ||
currentTry += 1; | ||
smoke(failedResources, currentTry, config); | ||
smoke(failedResources, currentTry, config, callback); | ||
} | ||
@@ -95,7 +104,7 @@ } | ||
*/ | ||
function run(dir, config) { | ||
function run(dir, config, callback) { | ||
var currentTry = 1; | ||
getResources(dir, config).then(function(resources){ | ||
smoke(resources, currentTry, config); | ||
smoke(resources, currentTry, config, callback); | ||
}).done() | ||
@@ -102,0 +111,0 @@ } |
{ | ||
"name": "cdnwhaaat", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Check that your files are on the CDN.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "mocha -t 4000" | ||
}, | ||
@@ -38,4 +38,6 @@ "bin": { | ||
"devDependencies": { | ||
"mocha": "^2.0.1" | ||
"chai": "^3.5.0", | ||
"mocha": "^2.5.3", | ||
"nock": "^8.1.0" | ||
} | ||
} |
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
68125
8
141
3