castor-load
Advanced tools
Comparing version 4.4.1 to 4.4.2
@@ -77,3 +77,5 @@ 'use strict'; | ||
if (typeof modifier === 'function') { modifier(self.doc); } | ||
if (typeof modifier === 'function') { | ||
modifier(self.doc); | ||
} | ||
} | ||
@@ -111,6 +113,13 @@ | ||
} | ||
else { | ||
else if (response && response.headers && response.headers.etag) { | ||
self.doc.sha1 = shasum.update(response.headers.etag).digest('hex'); | ||
fn(null, self.doc) | ||
} | ||
else if (response && response.headers && response.headers['content-length']) { | ||
self.doc.sha1 = shasum.update(String(response.headers['content-length']).concat(self.doc.location)).digest('hex'); | ||
fn(null, self.doc) | ||
} | ||
else { | ||
fn(new Error('No sha1')); | ||
} | ||
}); | ||
@@ -117,0 +126,0 @@ return; |
@@ -248,6 +248,6 @@ /*jshint node:true,laxcomma:true*/ | ||
Filerake.prototype.push = function (file, stats) | ||
Filerake.prototype.push = function (file, stats, basedoc, modifier) | ||
{ | ||
var self = this; | ||
var f = new File(file, stats, self.basedoc, self.options.modifier); | ||
var f = new File(file, stats, basedoc || self.basedoc, modifier || self.options.modifier); | ||
if (self.ignore(file)) { | ||
@@ -254,0 +254,0 @@ self.emit('preCancel', f.get()); |
@@ -60,4 +60,2 @@ /*jshint node:true, laxcomma:true*/ | ||
// debug(fnid, fn.toString()); | ||
var mark = function(o) { | ||
@@ -72,3 +70,2 @@ if (o.mountBy === undefined) { | ||
self.handlers.push(function(iDoc, next) { | ||
debug('through', fnid); | ||
if (!iDoc) { | ||
@@ -78,7 +75,5 @@ return next(); | ||
if (Array.isArray(iDoc)) { | ||
debug(fnid + ' received array'); | ||
return next(null, iDoc); | ||
} | ||
if (iDoc.mountBy && iDoc.mountBy.indexOf(fnid) >= 0) { | ||
debug(fnid + ' ignored', iDoc.filename); | ||
return next(null, iDoc); | ||
@@ -98,3 +93,3 @@ } | ||
; | ||
debug('executed', fnid); | ||
debug('apply ' + pattern, fnid, iDoc.filename.concat('#').concat(iDoc.number || '0')); | ||
fn(oDoc, | ||
@@ -109,7 +104,6 @@ function submit(arg1, arg2) { | ||
else { | ||
debug("arg1", arg1); | ||
debug('fail ' + pattern, fnid, iDoc.filename.concat('#').concat(iDoc.number || '0'), arg1); | ||
} | ||
} | ||
else if (!arg1 && arg2) { | ||
debug(fnid + ' mounted', iDoc.filename); | ||
if (numb === 1) { | ||
@@ -129,3 +123,3 @@ next(null, arg2); | ||
se.wait = function(cbd) { | ||
debug('executed', fnid); | ||
debug('apply ' + pattern, fnid, iDoc.filename.concat('#').concat(iDoc.number || '0')); | ||
resolve = cbd; | ||
@@ -135,7 +129,7 @@ qe.drain = function() { | ||
cbd(); | ||
debug('finalize', fnid, numb, nump, qe.length()); | ||
// debug('finalize', fnid, numb, nump, qe.length()); | ||
} | ||
else { | ||
debug('partial', fnid, numb, nump, qe.length()); | ||
} | ||
// else { | ||
// debug('partial', fnid, numb, nump, qe.length()); | ||
// } | ||
}; | ||
@@ -154,6 +148,6 @@ }; | ||
// sub Document | ||
debug('explode', arg1.fid, arg1.filename); | ||
// debug('explode', arg1.fid, arg1.filename); | ||
qe.push(arg1, function(e) { | ||
nump++; | ||
debug('terminated', fnid, arg1.filename); | ||
// debug('terminated', fnid, arg1.filename); | ||
if (typeof arg2 === 'function') { | ||
@@ -174,3 +168,2 @@ arg2(e); | ||
else { | ||
debug(fnid + ' not applicable', iDoc.filename); | ||
next(null, iDoc); | ||
@@ -201,7 +194,5 @@ } | ||
Mount.prototype.appendDoc = function (doc, worker, done) { | ||
debug('mount', doc.filename); | ||
var self = this; | ||
doc.memorizeWorkerForSubdoc = worker; | ||
self.queue.push(doc, function(err, dta) { | ||
debug('mounted', doc.filename); | ||
if (err) { | ||
@@ -208,0 +199,0 @@ return done(err); |
{ | ||
"name": "castor-load", | ||
"version": "4.4.1", | ||
"version": "4.4.2", | ||
"author": "Nicolas Thouvenin <nthouvenin@gmail.com>", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
62639
1509