2
0
Fork 0

switch to debug lib

This commit is contained in:
Willem 2015-06-28 16:41:57 +02:00
parent 059c4a72a0
commit 7217f8617a
7 changed files with 106 additions and 135 deletions

151
README.md
View file

@ -10,11 +10,11 @@ A Node.js library providing automatic site assets aggregation.
## Example Application ## Example Application
There is a fully working express example application in the example folder. There is a fully working express example application in the example folder.
This contains bootstrap and angularjs and ejs templates and results in single js and css file. This contains bootstrap and angularjs and ejs templates and results in single html/js/css file.
## Usage ## Usage
note: www_static/[js/css]/lib are version ignored. note: www_static/[js/css]/lib are scm version ignored.
### example-assets.json ### example-assets.json
@ -293,7 +293,7 @@ A Node.js library providing automatic site assets aggregation.
// Registrate events (note: may change a bit) // Registrate events (note: may change a bit)
assetAssemblerA.on('begin', function() { }); assetAssemblerA.on('begin', function() { });
assetAssemblerA.on('end', function() { }); assetAssemblerA.on('end', function() { });
assetAssemblerA.on('log', function(logLevel, logMessage) { }); assetAssemblerA.on('log', function(logMessage) { });
assetAssemblerA.on('result', function(resultValue) { }); assetAssemblerA.on('result', function(resultValue) { });
assetAssemblerA.on('file-download-pre', function(remoteUrl) { }); assetAssemblerA.on('file-download-pre', function(remoteUrl) { });
assetAssemblerA.on('file-download-post', function(localFile) { }); assetAssemblerA.on('file-download-post', function(localFile) { });
@ -313,94 +313,58 @@ A Node.js library providing automatic site assets aggregation.
## Example log output ## Example log output
// Result First run First run with downloads and with DEBUG="*"
info: node-ff-assets-css build begin for: /static/css/lib/assets.css
debug: node-ff-assets-css readFile: node_modules/bootstrap/dist/css/bootstrap.css size: 285496 ff:assets:assets-builder runAll started. +0ms
debug: node-ff-assets-css readFile: www_static/css/boot.css size: 1606 ff:assets:assets-builder runAsset started for: css +1ms
debug: node-ff-assets-css readFile: www_static/css/flot.css size: 82 ff:assets:assets-builder runAsset started for: js +0ms
debug: node-ff-assets-css readFile: www_static/css/panel.css size: 545 ff:assets:assets-builder assemblerCreate from default +2ms
debug: node-ff-assets-css readFile: www_static/css/style.css size: 10419 ff:assets:assets-builder assemblerFill from default +0ms
debug: node-ff-assets-css target size: 298318 ff:assets:assets-builder runAssembler type: css +0ms
info: node-ff-assets-css build result size: 1 from: 5 node-ff-assets:css build begin for: /static/css/lib/assets.css
info: node-ff-assets-css build done in: 33 ms. ff:assets:asset-assembler downloadList size: 0 +4ms
info: node-ff-assets-js build begin for: /static/js/lib/assets.js ff:assets:asset-assembler readFileList size: 5 +1ms
debug: node-ff-assets-js downloadFile: http://code.jquery.com/jquery-2.1.3.js ff:assets:asset-assembler readFile: node_modules/bootstrap/dist/css/bootstrap.css size: 129940 +4ms
debug: node-ff-assets-js downloadFile: https://code.angularjs.org/1.4.0-beta.4/angular.js ff:assets:asset-assembler readFile: www_static/css/boot.css size: 1824 +1ms
debug: node-ff-assets-js downloadFile: https://code.angularjs.org/1.4.0-beta.4/angular-route.js ff:assets:asset-assembler readFile: www_static/css/flot.css size: 94 +0ms
debug: node-ff-assets-js downloadFile: https://code.angularjs.org/1.4.0-beta.4/angular-resource.js ff:assets:asset-assembler readFile: www_static/css/panel.css size: 605 +1ms
debug: node-ff-assets-js downloadFile: https://code.angularjs.org/1.4.0-beta.4/angular-touch.js ff:assets:asset-assembler readFile: www_static/css/style.css size: 448 +0ms
debug: node-ff-assets-js downloadFile: http://localhost:8008/ui/include/js/controller/test1 ff:assets:asset-assembler target file: www_static/css/lib/assets.css +0ms
GET /ui/include/js/controller/test1 200 7.931 ms - - ff:assets:asset-assembler target size: 133244 +0ms
debug: node-ff-assets-js downloadFile: http://localhost:8008/ui/include/js/controller/test2 node-ff-assets:css build result size: 1 from: 5
GET /ui/include/js/controller/test2 200 5.215 ms - - node-ff-assets:css build done in: 10 ms.
debug: node-ff-assets-js downloadFile: http://localhost:8008/ui/include/js/controller/test3 ff:assets:assets-builder assemblerCreate from default +1ms
GET /ui/include/js/controller/test3 200 1.583 ms - - ff:assets:assets-builder assemblerFill from default +0ms
debug: node-ff-assets-js readFile: www_static/js/lib/jquery-2.1.3/jquery.js size: 247387 ff:assets:assets-builder runAssembler type: js +0ms
debug: node-ff-assets-js readFile: node_modules/bootstrap/dist/js/bootstrap.js size: 66732 node-ff-assets:js build begin for: /static/js/lib/assets.js
debug: node-ff-assets-js readFile: node_modules/flot/jquery.flot.js size: 110008 ff:assets:asset-assembler downloadList size: 5 +1ms
debug: node-ff-assets-js readFile: node_modules/flot/jquery.flot.resize.js size: 2504 ff:assets:asset-assembler readFileList size: 13 +0ms
debug: node-ff-assets-js readFile: node_modules/flot/jquery.flot.pie.js size: 23405 ff:assets:asset-assembler downloadFile: http://code.jquery.com/jquery-2.1.3.js +0ms
debug: node-ff-assets-js readFile: www_static/js/lib/angularjs-1.4.0-b4/angular.js size: 988198 ff:assets:asset-assembler downloadFile: https://code.angularjs.org/1.4.0-beta.4/angular.js +90ms
debug: node-ff-assets-js readFile: www_static/js/lib/angularjs-1.4.0-b4/angular-route.js size: 35796 ff:assets:asset-assembler downloadFile: https://code.angularjs.org/1.4.0-beta.4/angular-route.js +2s
debug: node-ff-assets-js readFile: www_static/js/lib/angularjs-1.4.0-b4/angular-resource.js size: 26780 ff:assets:asset-assembler downloadFile: https://code.angularjs.org/1.4.0-beta.4/angular-resource.js +579ms
debug: node-ff-assets-js readFile: www_static/js/lib/angularjs-1.4.0-b4/angular-touch.js size: 22887 ff:assets:asset-assembler downloadFile: https://code.angularjs.org/1.4.0-beta.4/angular-touch.js +567ms
debug: node-ff-assets-js readFile: www_static/js/app-directives.js size: 185 ff:assets:asset-assembler readFile: www_static/js/lib/jquery-2.1.3/jquery.js size: 151917 +593ms
debug: node-ff-assets-js readFile: www_static/js/app-filters.js size: 202 ff:assets:asset-assembler readFile: node_modules/bootstrap/dist/js/bootstrap.js size: 49199 +4ms
debug: node-ff-assets-js readFile: www_static/js/app-services.js size: 80 ff:assets:asset-assembler readFile: node_modules/flot/jquery.flot.js size: 54509 +7ms
debug: node-ff-assets-js readFile: www_static/js/app.js size: 766 ff:assets:asset-assembler readFile: node_modules/flot/jquery.flot.resize.js size: 1439 +1ms
debug: node-ff-assets-js readFile: www_static/js/controller/page-about.js size: 364 ff:assets:asset-assembler readFile: node_modules/flot/jquery.flot.pie.js size: 13451 +2ms
debug: node-ff-assets-js readFile: www_static/js/controller/page-foobar.js size: 361 ff:assets:asset-assembler readFile: www_static/js/lib/angularjs-1.4.0-b4/angular.js size: 297085 +61ms
debug: node-ff-assets-js readFile: www_static/js/controller/page-index.js size: 351 ff:assets:asset-assembler readFile: www_static/js/lib/angularjs-1.4.0-b4/angular-route.js size: 8360 +5ms
debug: node-ff-assets-js readFile: www_static/js/controller/page-help.js size: 376 ff:assets:asset-assembler readFile: www_static/js/lib/angularjs-1.4.0-b4/angular-resource.js size: 6847 +1ms
debug: node-ff-assets-js readFile: www_static/js/lib/xcrud/test1.js size: 2010 ff:assets:asset-assembler readFile: www_static/js/lib/angularjs-1.4.0-b4/angular-touch.js size: 7568 +2ms
debug: node-ff-assets-js readFile: www_static/js/lib/xcrud/test2.js size: 2138 ff:assets:asset-assembler readFile: www_static/js/example-app.js size: 401 +0ms
debug: node-ff-assets-js readFile: www_static/js/lib/xcrud/test3.js size: 2218 ff:assets:asset-assembler readFile: www_static/js/controller/page-bar.js size: 205 +0ms
debug: node-ff-assets-js target size: 1540945 ff:assets:asset-assembler readFile: www_static/js/controller/page-foo.js size: 205 +0ms
info: node-ff-assets-js build result size: 1 from: 24 ff:assets:asset-assembler readFile: www_static/js/controller/page-index.js size: 207 +1ms
info: node-ff-assets-js build done in: 3497 ms. ff:assets:asset-assembler target file: www_static/js/lib/assets.js +0ms
info: Server init done. ff:assets:asset-assembler target size: 592332 +0ms
node-ff-assets:js build result size: 1 from: 13
// Result Next runs node-ff-assets:js build done in: 3502 ms.
info: node-ff-assets-css build begin for: /static/css/lib/assets.css Server assets done.
debug: node-ff-assets-css readFile: node_modules/bootstrap/dist/css/bootstrap.css size: 285496 Server config done.
debug: node-ff-assets-css readFile: www_static/css/boot.css size: 1606 Server started on port 8080
debug: node-ff-assets-css readFile: www_static/css/flot.css size: 82
debug: node-ff-assets-css readFile: www_static/css/panel.css size: 545
debug: node-ff-assets-css readFile: www_static/css/style.css size: 10419
debug: node-ff-assets-css target size: 298318
info: node-ff-assets-css build result size: 1 from: 5
info: node-ff-assets-css build done in: 36 ms.
info: node-ff-assets-js build begin for: /static/js/lib/assets.js
debug: node-ff-assets-js downloadFile: http://localhost:8008/ui/include/js/controller/test1
GET /ui/include/js/controller/test1 200 7.931 ms - -
debug: node-ff-assets-js downloadFile: http://localhost:8008/ui/include/js/controller/test2
GET /ui/include/js/controller/test2 200 5.215 ms - -
debug: node-ff-assets-js downloadFile: http://localhost:8008/ui/include/js/controller/test3
GET /ui/include/js/controller/test3 200 1.583 ms - -
debug: node-ff-assets-js readFile: www_static/js/lib/jquery-2.1.3/jquery.js size: 247387
debug: node-ff-assets-js readFile: node_modules/bootstrap/dist/js/bootstrap.js size: 66732
debug: node-ff-assets-js readFile: node_modules/flot/jquery.flot.js size: 110008
debug: node-ff-assets-js readFile: node_modules/flot/jquery.flot.resize.js size: 2504
debug: node-ff-assets-js readFile: node_modules/flot/jquery.flot.pie.js size: 23405
debug: node-ff-assets-js readFile: www_static/js/lib/angularjs-1.4.0-b4/angular.js size: 988198
debug: node-ff-assets-js readFile: www_static/js/lib/angularjs-1.4.0-b4/angular-route.js size: 35796
debug: node-ff-assets-js readFile: www_static/js/lib/angularjs-1.4.0-b4/angular-resource.js size: 26780
debug: node-ff-assets-js readFile: www_static/js/lib/angularjs-1.4.0-b4/angular-touch.js size: 22887
debug: node-ff-assets-js readFile: www_static/js/app-directives.js size: 185
debug: node-ff-assets-js readFile: www_static/js/app-filters.js size: 202
debug: node-ff-assets-js readFile: www_static/js/app-services.js size: 80
debug: node-ff-assets-js readFile: www_static/js/app.js size: 766
debug: node-ff-assets-js readFile: www_static/js/controller/page-about.js size: 364
debug: node-ff-assets-js readFile: www_static/js/controller/page-foobar.js size: 361
debug: node-ff-assets-js readFile: www_static/js/controller/page-index.js size: 351
debug: node-ff-assets-js readFile: www_static/js/controller/page-help.js size: 376
debug: node-ff-assets-js readFile: www_static/js/lib/xcrud/test1.js size: 2010
debug: node-ff-assets-js readFile: www_static/js/lib/xcrud/test2.js size: 2138
debug: node-ff-assets-js readFile: www_static/js/lib/xcrud/test3.js size: 2218
debug: node-ff-assets-js target size: 1540945
info: node-ff-assets-js build result size: 1 from: 24
info: node-ff-assets-js build done in: 105 ms.
info: Server init done.
## Tests ## Tests
@ -413,6 +377,11 @@ Add unit tests for any new or changed functionality. Lint and test your code.
## Release History ## Release History
### 0.2.5
* Switched debug logging to debug library.
* Removed events from AssetsBuilder.
* Removed logLevel from log event in AssetAssembler.
### 0.2.4 ### 0.2.4
* Added json config reader. * Added json config reader.
* Added readFileRegex data filter. * Added readFileRegex data filter.

View file

@ -1,5 +1,6 @@
'use strict'; 'use strict';
var debug = require('debug')('ff:assets:asset-assembler');
var u = require('underscore'); var u = require('underscore');
var events = require('events'); var events = require('events');
var fetch = require('fetch'); var fetch = require('fetch');
@ -26,10 +27,10 @@ function buildEnd(assembler, targetFile, resultUriList, callback) {
resultUriList = [assembler.config.linkTarget]; resultUriList = [assembler.config.linkTarget];
} }
assembler.emit('file-write-post',targetFile); assembler.emit('file-write-post',targetFile);
assembler.emit('log','debug','target file: '+targetFile); debug('target file: %s',targetFile);
assembler.emit('log','debug','target size: '+targetSize); debug('target size: %s',targetSize);
assembler.emit('log','info','build result size: '+resultUriList.length+' from: '+buildResultSize); assembler.emit('log','build result size: '+resultUriList.length+' from: '+buildResultSize);
assembler.emit('log','info','build done in: '+buildTime+' ms.'); assembler.emit('log','build done in: '+buildTime+' ms.');
assembler.emit('result',resultUriList); assembler.emit('result',resultUriList);
assembler.emit('end'); assembler.emit('end');
callback(); callback();
@ -40,7 +41,7 @@ function buildEnd(assembler, targetFile, resultUriList, callback) {
function downloadFile(assembler, remoteUrl, localFile, callback) { function downloadFile(assembler, remoteUrl, localFile, callback) {
assembler.emit('file-download-pre',remoteUrl); assembler.emit('file-download-pre',remoteUrl);
assembler.emit('log','debug','downloadFile: '+remoteUrl); debug('downloadFile: %s',remoteUrl);
fs.ensureFile(localFile, function(err) { fs.ensureFile(localFile, function(err) {
if (err) { if (err) {
callback(err); callback(err);
@ -101,7 +102,7 @@ function aggregateFileList(assembler, targetFile, aggregateList, readFile, callb
callback(err); callback(err);
} else { } else {
assembler.emit('file-read-post',aggregateFile); assembler.emit('file-read-post',aggregateFile);
assembler.emit('log','debug','readFile: '+aggregateFile+' size: '+data.length); debug('readFile: '+aggregateFile+' size: '+data.length);
if (assembler.config.assetSeperator !== null && assembler.config.assetSeperator.length > 0) { if (assembler.config.assetSeperator !== null && assembler.config.assetSeperator.length > 0) {
var seperatorTemplate = u.template(assembler.config.assetSeperator); var seperatorTemplate = u.template(assembler.config.assetSeperator);
data = seperatorTemplate({file: aggregateFile}) + data; data = seperatorTemplate({file: aggregateFile}) + data;
@ -175,8 +176,8 @@ function buildAsset(assembler, targetFile, readFile, callback) {
downloadList.reverse(); downloadList.reverse();
readFileList.reverse(); readFileList.reverse();
assembler.emit('log','debug','downloadList size: '+downloadList.length); debug('downloadList size: %s',downloadList.length);
assembler.emit('log','debug','readFileList size: '+readFileList.length); debug('readFileList size: %s',readFileList.length);
downloadFileList(assembler, downloadList, function(err) { downloadFileList(assembler, downloadList, function(err) {
if (err) { if (err) {
@ -201,9 +202,9 @@ function buildAsset(assembler, targetFile, readFile, callback) {
function buildStart(assembler, readFile, callback) { function buildStart(assembler, readFile, callback) {
assembler.startTime = new Date().getTime(); assembler.startTime = new Date().getTime();
assembler.emit('begin'); assembler.emit('begin');
assembler.emit('log','info','build begin for: '+assembler.config.linkTarget); assembler.emit('log','build begin for: '+assembler.config.linkTarget);
if (assembler.config.downloadForce) { if (assembler.config.downloadForce) {
assembler.emit('log','info','build using forced downloads.'); assembler.emit('log','build using forced downloads.');
} }
var targetFile = mapLocalFileSync(assembler, assembler.config.linkTarget); var targetFile = mapLocalFileSync(assembler, assembler.config.linkTarget);
fs.ensureFile(targetFile, function (err) { fs.ensureFile(targetFile, function (err) {

View file

@ -1,17 +1,20 @@
'use strict'; 'use strict';
var events = require('events'); var debug = require('debug')('ff:assets:assets-builder');
var async = require('async'); var async = require('async');
var config = require('./assets-builder-config'); var config = require('./assets-builder-config');
function buildStepAssemblerRun(builder, buildConfig, assembler, callback) { function buildStepAssemblerRun(builder, buildConfig, assembler, callback) {
builder.emit('log','debug','runAssembler '+assembler.config.assetType); debug('runAssembler type: %s',assembler.config.assetType);
assembler.run(callback); assembler.run(callback);
} }
function buildStepAssemblerFill(builder, buildConfig, assembler, callback) { function buildStepAssemblerFill(builder, buildConfig, assembler, callback) {
var assemblerFill = buildConfig.assemblerFill || builder.config.assemblerFill; var assemblerFill = buildConfig.assemblerFill;
builder.emit('log','debug','assemblerFill: '+Object.keys(assemblerFill)); if (assemblerFill === undefined) {
assemblerFill = builder.config.assemblerFill;
debug('assemblerFill from default');
}
assemblerFill(assembler, function(err) { assemblerFill(assembler, function(err) {
if (err) { if (err) {
callback(err); callback(err);
@ -22,8 +25,11 @@ function buildStepAssemblerFill(builder, buildConfig, assembler, callback) {
} }
function buildStepAssemblerCreate(builder, buildConfig, assemblerConfig, callback) { function buildStepAssemblerCreate(builder, buildConfig, assemblerConfig, callback) {
var assemblerCreate = buildConfig.assemblerCreate || builder.config.assemblerCreate; var assemblerCreate = buildConfig.assemblerCreate;
builder.emit('log','debug','assemblerCreate: '+Object.keys(assemblerCreate)); if (assemblerCreate === undefined) {
assemblerCreate = builder.config.assemblerCreate;
debug('assemblerCreate from default');
}
assemblerCreate(assemblerConfig, function(err, assembler) { assemblerCreate(assemblerConfig, function(err, assembler) {
if (err) { if (err) {
callback(err); callback(err);
@ -34,12 +40,14 @@ function buildStepAssemblerCreate(builder, buildConfig, assemblerConfig, callbac
} }
function buildStepConfigFill(builder, buildConfig, assemblerConfig, callback) { function buildStepConfigFill(builder, buildConfig, assemblerConfig, callback) {
var configFill = buildConfig.configFill || builder.config.configFill; var configFill = buildConfig.configFill;
if (configFill === undefined) {
configFill = builder.config.configFill;
debug('configFill from default');
}
if (assemblerConfig.assetType === undefined) { if (assemblerConfig.assetType === undefined) {
assemblerConfig.assetType = builder.currentAssetType; assemblerConfig.assetType = builder.currentAssetType;
} }
builder.emit('log','debug','configFill: '+Object.keys(configFill));
configFill(assemblerConfig, function(err) { configFill(assemblerConfig, function(err) {
if (err) { if (err) {
callback(err); callback(err);
@ -50,8 +58,11 @@ function buildStepConfigFill(builder, buildConfig, assemblerConfig, callback) {
} }
function buildStepConfigCreate(builder, buildConfig, callback) { function buildStepConfigCreate(builder, buildConfig, callback) {
var configCreate = buildConfig.configCreate || builder.config.configCreate; var configCreate = buildConfig.configCreate;
builder.emit('log','debug','configCreate: '+Object.keys(configCreate)); if (configCreate === undefined) {
configCreate = builder.config.configCreate;
debug('configCreate from default');
}
configCreate(function(err, assemblerConfig) { configCreate(function(err, assemblerConfig) {
if (err) { if (err) {
callback(err); callback(err);
@ -68,14 +79,11 @@ function AssetsBuilder(config) {
this.config = config; this.config = config;
this.startTime = 0; this.startTime = 0;
this.currentAssetType = ''; this.currentAssetType = '';
events.EventEmitter.call(this);
} }
AssetsBuilder.prototype.__proto__ = events.EventEmitter.prototype;
AssetsBuilder.prototype.runAll = function(callback) { AssetsBuilder.prototype.runAll = function(callback) {
var self = this; var self = this;
self.emit('log','debug','runAll started.'); debug('runAll started.');
config.checkConfig(self.config,function(err) { config.checkConfig(self.config,function(err) {
if (err) { if (err) {
callback(err); callback(err);
@ -101,7 +109,7 @@ AssetsBuilder.prototype.runAsset = function(name) {
if (name === undefined) { if (name === undefined) {
throw new Error('no name'); throw new Error('no name');
} }
self.emit('log','debug','runAsset started for: '+name); debug('runAsset started for: %s',name);
return function(callback) { return function(callback) {
if (callback === undefined) { if (callback === undefined) {
throw new Error('no callback'); throw new Error('no callback');

View file

@ -69,8 +69,8 @@ var assemblerEventLog = {
if (logType === undefined) { if (logType === undefined) {
throw new Error('no logType'); throw new Error('no logType');
} }
return function(logLevel, logMessage) { return function(logMessage) {
console.log(logLevel + ': node-ff-assets-' + logType + ' ' + logMessage); console.log('node-ff-assets:' + logType + ' ' + logMessage);
}; };
}, },
winston: function(logger, logType) { winston: function(logger, logType) {
@ -80,8 +80,8 @@ var assemblerEventLog = {
if (logType === undefined) { if (logType === undefined) {
throw new Error('no logType'); throw new Error('no logType');
} }
return function(logLevel, logMessage) { return function(logMessage) {
logger.log(logLevel, 'node-ff-assets-'+logType+' '+logMessage); logger.log('node-ff-assets:'+logType+' '+logMessage);
}; };
}, },
}; };

View file

@ -1,13 +1,12 @@
{ {
"name": "node-ff-assets", "name": "node-ff-assets",
"version": "0.2.4", "version": "0.2.5",
"description": "Site assets local/remote aggregation with minify.", "description": "Site assets local/remote aggregation with minify.",
"main": "lib/node-ff-assets.js", "main": "lib/node-ff-assets.js",
"scripts": { "scripts": {
"test": "npm run-script test-clean;npm run-script test-mocha", "test": "npm run-script test-clean;npm run-script test-mocha",
"test-clean": "rm test/data/* -rf", "test-clean": "rm test/data/* -rf",
"test-mocha": "export JUNIT_REPORT_PATH=test/data/report.xml;export JUNIT_REPORT_STACK=1;node_modules/mocha/bin/mocha --reporter mocha-jenkins-reporter" "test-mocha": "export JUNIT_REPORT_PATH=test/data/report.xml;export JUNIT_REPORT_STACK=1;node_modules/mocha/bin/mocha --reporter mocha-jenkins-reporter"
}, },
"author": "Willem <willem.git.2015@forwardfire.net> (http://forwardfire.net/)", "author": "Willem <willem.git.2015@forwardfire.net> (http://forwardfire.net/)",
"license": "BSD-2-Clause", "license": "BSD-2-Clause",
@ -16,6 +15,7 @@
"url": "https://bitbucket.org/im_ik/node-ff-assets.git" "url": "https://bitbucket.org/im_ik/node-ff-assets.git"
}, },
"dependencies": { "dependencies": {
"debug": "^2.2.0",
"fetch": "^0.3.6", "fetch": "^0.3.6",
"fs-extra": "^0.16.3", "fs-extra": "^0.16.3",
"minify": "^1.4.8", "minify": "^1.4.8",

View file

@ -14,9 +14,8 @@ function createTestAssembler(suite, readFile) {
'/static-test/input1.css', '/static-test/input1.css',
], ],
},readFile); },readFile);
assetAssembler.on ('log',function (logLevel, logMessage) { assetAssembler.on ('log',function (logMessage) {
var level = (logLevel+' ').substring(0,6); console.log(' ' + ' ' + suite.title + ' ' +logMessage);
console.log(' '+ level + ' ' + suite.title + ' ' +logMessage);
}); });
return assetAssembler; return assetAssembler;
} }

View file

@ -33,9 +33,8 @@ function createTestBuilder(suite) {
var testConfig = { var testConfig = {
assemblerFill: function (assembler, callback) { assemblerFill: function (assembler, callback) {
var serverResultKey = 'ff_assets_'+assembler.config.assetType; var serverResultKey = 'ff_assets_'+assembler.config.assetType;
assembler.on ('log',function (logLevel, logMessage) { assembler.on ('log',function (logMessage) {
var level = (logLevel+' ').substring(0,6); console.log(' ' + ' ' + suite.title + ' assembler ' +logMessage); // == -2 space from asm
console.log(' '+ level + ' ' + suite.title + ' assembler ' +logMessage); // == -2 space from asm
}); });
callback(); callback();
}, },
@ -48,12 +47,7 @@ function createTestBuilder(suite) {
} }
} }
}; };
var assetsBuilder = new assets.AssetsBuilder(testConfig); return new assets.AssetsBuilder(testConfig);
assetsBuilder.on ('log',function (logLevel, logMessage) {
var level = (logLevel+' ').substring(0,6);
console.log(' '+ level + ' ' + suite.title + ' builder ' +logMessage); // == -1 space from asm
});
return assetsBuilder;
} }
describe('lib/assets-builder.js', function() { describe('lib/assets-builder.js', function() {