Skip to content
This repository was archived by the owner on Apr 26, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions npm/lib/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ const Config = require("./config");
const Handlebars = require('./helpers').handlebars;


function Context(id, config, promptmgr) {
function Context(id, config) {
this.id = id;
this.logger = logger;
this.processor = processor;
this.promptmgr = promptmgr;
this.conf = extend(new Config(), config); //start with a copy of the parent generator's config
this.conf.configFiles = []; //remove any previously set config files (don't want to inherit those)
this.patterns = [];
Expand Down
2 changes: 1 addition & 1 deletion npm/lib/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

//module for storing default configuration values for yeoman prompts
//module for storing default configuration values for yeoman options
// e.g. {appName : {desc : 'Name of the application', type : String, default : 'LibertyProject'}}
'use strict';
class Defaults {
Expand Down
25 changes: 9 additions & 16 deletions npm/lib/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,26 @@

//module for logging capabilities, shared across the generator
'use strict';
let log = [];
let log = console.log;
const util = require('util');

const setLogger = function(logger) {
log = logger
}

const writeToLog = function (header, data) {
if (!data) {
log.push(header + " : undefined");
log(header + " : undefined");
return;
}
if ((typeof data === 'string') || (typeof data === 'number') || (typeof data === 'boolean')) {
log.push(header + " : " + data);
log(header + " : " + data);
} else {
log.push(header + " : " + util.inspect(data));
log(header + " : " + util.inspect(data));
}
}

const getLogs = function () {
return log;
}

//clear any log entries
const clear = function () {
log = [];
}

module.exports = {
//module doesn't export anything, all helpers are installed by requiring this module
writeToLog: writeToLog,
getLogs: getLogs,
clear: clear
setLogger: setLogger
}
Loading