| Total Complexity | 10 |
| Complexity/F | 1.67 |
| Lines of Code | 60 |
| Function Count | 6 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | import debug from 'debug' |
||
| 2 | import extend from 'extend' |
||
| 3 | import moment from 'moment' |
||
| 4 | |||
| 5 | var Manager = require('../../cli').Manager |
||
| 6 | var Handlebars = require('../../cli').Handlebars |
||
| 7 | var config = require('../../cli').config |
||
| 8 | var abeExtend = require('../../cli').abeExtend |
||
| 9 | |||
| 10 | export var log |
||
| 11 | export var trace |
||
| 12 | export var error |
||
| 13 | export var processConfig |
||
| 14 | export var dateStart |
||
| 15 | |||
| 16 | export function getTime() { |
||
| 17 | return (moment(moment() - dateStart).format('mm:ss')) + 'sec' |
||
| 18 | } |
||
| 19 | |||
| 20 | export function init(processName, conf) { |
||
| 21 | var p = new Promise((resolve, reject) => { |
||
|
|
|||
| 22 | |||
| 23 | log = debug(processName + ':log') |
||
| 24 | log.color = 2 |
||
| 25 | trace = debug(processName + ':trace') |
||
| 26 | error = debug(processName + ':error') |
||
| 27 | error.color = 1 |
||
| 28 | |||
| 29 | processConfig = {} |
||
| 30 | Array.prototype.forEach.call(process.argv, (item) => { |
||
| 31 | if (item.indexOf('=') > -1) { |
||
| 32 | var ar = item.split('=') |
||
| 33 | processConfig[ar[0]] = ar[1] |
||
| 34 | } |
||
| 35 | }) |
||
| 36 | if(processConfig.ABE_WEBSITE) { |
||
| 37 | config.set({root: processConfig.ABE_WEBSITE.replace(/\/$/, '') + '/'}) |
||
| 38 | } |
||
| 39 | |||
| 40 | processConfig = extend(true, conf, processConfig) |
||
| 41 | |||
| 42 | if(typeof processConfig.ABE_WEBSITE !== 'undefined' && processConfig.ABE_WEBSITE !== null) { |
||
| 43 | abeExtend.hooks.instance.trigger('afterHandlebarsHelpers', Handlebars) |
||
| 44 | |||
| 45 | Manager.instance.init() |
||
| 46 | .then(()=> { |
||
| 47 | dateStart = moment() |
||
| 48 | resolve() |
||
| 49 | }) |
||
| 50 | .catch((e) => { |
||
| 51 | error('publish-all' + e) |
||
| 52 | }) |
||
| 53 | }else { |
||
| 54 | error('ABE_WEBSITE is not defined use node process.js ABE_WEBSITE=/pat/to/website') |
||
| 55 | process.exit(0) |
||
| 56 | } |
||
| 57 | }) |
||
| 58 | |||
| 59 | return p |
||
| 60 | } |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.