From 3d8923fae92d8fea12022b30ec06ea46859c7884 Mon Sep 17 00:00:00 2001 From: Paul Lambert Date: Mon, 6 Jan 2014 09:50:35 +1300 Subject: [PATCH] refactor: move ngbp log prefix into a constant, additional minor formatting Factor out "[ngbp] " into a prefix, allow this to be more easily changed later. Minor formatting/indent changes --- bin/ngbp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/bin/ngbp b/bin/ngbp index e8f6e85..ba7f508 100755 --- a/bin/ngbp +++ b/bin/ngbp @@ -9,14 +9,15 @@ var SPAWN = require( 'child_process' ).spawn; // 3rd Party Modules var Q = require( 'q' ); var COLORS = require( 'colors' ); -var FINDUP = require('findup-sync'); -var RESOLVE = require('resolve').sync; +var FINDUP = require( 'findup-sync' ); +var RESOLVE = require( 'resolve' ).sync; +var PREFIX = "[ngbp] "; // Local libs var PKG = require( './../package.json' ); function log ( msg ) { - console.log( "[ngbp] " + msg ); + console.log( PREFIX + msg ); } function writeln ( msg ) { @@ -24,7 +25,7 @@ function writeln ( msg ) { } function error ( msg, fatal ) { - msg = "[ngbp] " + msg; + msg = PREFIX + msg; console.log( msg.red ); if ( fatal ) { @@ -33,7 +34,7 @@ function error ( msg, fatal ) { } function header ( msg ) { - msg = "[ngbp] " + msg; + msg = PREFIX + msg; console.log( msg.underline.magenta ); } @@ -59,7 +60,7 @@ function installNgbpIfNeeded () { // Ensure the user is okay with installing it here. var rl = READLINE.createInterface({ input: process.stdin, - output: process.stdout + output: process.stdout }); rl.question( "Install ngbp in the current directory? [Yn] ", function ( answer ) {