Skip to content

Commit

Permalink
Merge pull request #8 from ember-cli-deploy/customize-defaul-color
Browse files Browse the repository at this point in the history
add logInfo color option
  • Loading branch information
lukemelia committed Mar 30, 2016
2 parents 9dd4aef + 5748c33 commit 325ee28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var CoreObject = require('core-object');
var chalk = require('chalk');
var blue = chalk.blue;
var _ = require('lodash-node');

var DeployPluginBase = CoreObject.extend({
context: null,
Expand Down Expand Up @@ -55,23 +55,24 @@ var DeployPluginBase = CoreObject.extend({
},

log: function(message, opts) {
opts = opts || { color: 'blue' };
opts.color = opts.color || 'blue';
opts = opts || {};
var ui = this.ui;
var color = opts.color || ui.logInfoColor || 'blue';
var chalkColor = chalk[color];

// the following accomodates a spelling error in ember-cli
var actualStream = ui.actualOutputStream || ui.actualOuputStream;

if (!opts.verbose || (opts.verbose && ui.verbose)) {
if (ui.verbose) {
ui.write(blue('| '));
ui.write(chalkColor('| '));
} else if (actualStream && actualStream.cursorTo) {
// on a real terminal we want to reset the cursor position
// to avoid overlap with other outputs
actualStream.clearLine();
actualStream.cursorTo(0);
}

var chalkColor = chalk[opts.color];
this.logRaw(chalkColor('- ' + message));
}
}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
},
"author": "Luke Melia and ember-cli-deploy team",
"license": "MIT",
"devDependencies": {
},
"devDependencies": {},
"dependencies": {
"chalk": "^1.0.0",
"core-object": "0.0.2"
"core-object": "0.0.2",
"lodash": "^4.6.1"
}
}

0 comments on commit 325ee28

Please sign in to comment.