docpad-plugin-cachr
Advanced tools
Comparing version 2.1.5 to 2.1.6
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.4.0 | ||
// Generated by CoffeeScript 1.6.2 | ||
var __hasProp = {}.hasOwnProperty, | ||
@@ -6,4 +6,8 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
module.exports = function(BasePlugin) { | ||
var CachrPlugin, balUtil, fsUtil, pathUtil, request; | ||
var CachrPlugin, TaskGroup, balUtil, eachr, fsUtil, pathUtil, request, safefs, _ref; | ||
balUtil = require('bal-util'); | ||
safefs = require('safefs'); | ||
eachr = require('eachr'); | ||
TaskGroup = require('taskgroup').TaskGroup; | ||
request = require('request'); | ||
@@ -13,7 +17,7 @@ pathUtil = require('path'); | ||
return CachrPlugin = (function(_super) { | ||
__extends(CachrPlugin, _super); | ||
function CachrPlugin() { | ||
return CachrPlugin.__super__.constructor.apply(this, arguments); | ||
_ref = CachrPlugin.__super__.constructor.apply(this, arguments); | ||
return _ref; | ||
} | ||
@@ -35,2 +39,3 @@ | ||
var config, details, docpad, name; | ||
docpad = this.docpad; | ||
@@ -52,2 +57,3 @@ config = this.config; | ||
var attempt, docpad, viaRequest; | ||
docpad = this.docpad; | ||
@@ -65,5 +71,5 @@ attempt = 1; | ||
docpad.log('debug', "Cachr is gave up fetching [" + details.sourceUrl + "] to [" + details.cachePath + "]"); | ||
return balUtil.exists(details.cachePath, function(exists) { | ||
return safefs.exists(details.cachePath, function(exists) { | ||
if (exists) { | ||
return balUtil.unlink(details.cachePath, function(err2) { | ||
return safefs.unlink(details.cachePath, function(err2) { | ||
return next(err); | ||
@@ -80,3 +86,3 @@ }); | ||
docpad.log('debug', "Cachr fetched [" + details.sourceUrl + "] to [" + details.cachePath + "]"); | ||
return balUtil.writeFile(details.cachePath, body, function(err) { | ||
return safefs.writeFile(details.cachePath, body, function(err) { | ||
return next(err); | ||
@@ -106,2 +112,3 @@ }); | ||
var cachr, templateData; | ||
templateData = _arg.templateData; | ||
@@ -120,2 +127,3 @@ cachr = this; | ||
var cachr, cachrPath, config, docpad, failures, templateData, urlsToCache, urlsToCacheLength; | ||
templateData = _arg.templateData; | ||
@@ -133,14 +141,17 @@ cachr = this; | ||
docpad.log('debug', "Cachr is caching " + urlsToCacheLength + " files..."); | ||
balUtil.ensurePath(cachrPath, function(err) { | ||
safefs.ensurePath(cachrPath, function(err) { | ||
var tasks, | ||
_this = this; | ||
if (err) { | ||
return next(err); | ||
} | ||
tasks = new balUtil.Group(function(err) { | ||
tasks = new TaskGroup().setConfig({ | ||
concurrency: 0 | ||
}).once('complete', function(err) { | ||
docpad.log((failures ? 'warn' : 'debug'), 'Cachr finished caching', (failures ? "with " + failures + " failures" : '')); | ||
return next(); | ||
}); | ||
balUtil.each(urlsToCache, function(details, sourceUrl) { | ||
return tasks.push(function(complete) { | ||
eachr(urlsToCache, function(details, sourceUrl) { | ||
return tasks.addTask(function(complete) { | ||
return cachr.cacheRemoteUrl(details, function(err) { | ||
@@ -156,3 +167,3 @@ if (err) { | ||
}); | ||
tasks.async(); | ||
tasks.run(); | ||
return this; | ||
@@ -159,0 +170,0 @@ }); |
{ | ||
"name": "docpad-plugin-cachr", | ||
"version": "2.1.5", | ||
"version": "2.1.6", | ||
"description": "Caches remote resources locally", | ||
@@ -33,6 +33,9 @@ "homepage": "http://docpad.org/plugin/cachr", | ||
"request": "~2.16.6", | ||
"bal-util": "~1.18.0" | ||
"bal-util": "~2.0.2", | ||
"safefs": "~3.0.1", | ||
"eachr": "~2.0.2", | ||
"taskgroup": "~3.1.1" | ||
}, | ||
"devDependencies": { | ||
"coffee-script": "~1.4.0" | ||
"coffee-script": "~1.6.2" | ||
}, | ||
@@ -39,0 +42,0 @@ "main": "./out/cachr.plugin.js", |
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
7753
149
5
+ Addedeachr@~2.0.2
+ Addedsafefs@~3.0.1
+ Addedtaskgroup@~3.1.1
+ Addedambi@2.1.6(transitive)
+ Addedbal-util@2.0.5(transitive)
+ Addedeventemitter2@0.4.14(transitive)
+ Addedextendonclass@1.0.1(transitive)
+ Addedgraceful-fs@2.0.3(transitive)
+ Addedsafefs@3.0.6(transitive)
+ Addedtaskgroup@3.1.23.3.9(transitive)
- Removedbal-util@1.18.0(transitive)
- Removedgetsetdeep@2.0.0(transitive)
- Removedsafecallback@1.0.1(transitive)
- Removedsafefs@2.0.3(transitive)
- Removedtaskgroup@2.0.0(transitive)
Updatedbal-util@~2.0.2