Permalink
Browse files

Move command logging to cli module.

  • Loading branch information...
1 parent 439b204 commit d523ff18da3bfa083cf85c1fb1a50267e1c550f5 @cliffano committed Feb 14, 2013
Showing with 9 additions and 10 deletions.
  1. +0 −10 lib/ae86.js
  2. +4 −0 lib/cli.js
  3. +5 −0 test/cli.js
View
@@ -19,8 +19,6 @@ function AE86() {
* @param {Function} cb: standard cb(err, result) callback
*/
AE86.prototype.init = function (cb) {
-
- console.log('Creating example AE86 project');
ncp.ncp(p.join(__dirname, '../examples'), '.', cb);
};
@@ -31,10 +29,7 @@ AE86.prototype.init = function (cb) {
*/
AE86.prototype.generate = function (cb) {
- console.log('Generating website');
-
function _static(cb) {
-
// copy static files as-is
ncp.ncp('static', 'out', cb);
}
@@ -75,9 +70,6 @@ AE86.prototype.generate = function (cb) {
* A change means the project website will automatically be regenerated.
*/
AE86.prototype.watch = function () {
-
- console.log('Watching for changes and automatically regenerating website');
-
var self = this;
function _listener() {
@@ -116,8 +108,6 @@ AE86.prototype.watch = function () {
* @param {Function} cb: standard cb(err, result) callback
*/
AE86.prototype.clean = function (cb) {
-
- console.log('Removing website');
wrench.rmdirRecursive('out', cb);
};
View
@@ -2,18 +2,22 @@ var ae86 = require('./ae86'),
bag = require('bagofholding');
function _init() {
+ console.log('Creating example AE86 project');
new ae86().init(bag.cli.exit);
}
function _gen() {
+ console.log('Generating website');
new ae86().generate(bag.cli.exit);
}
function _watch() {
+ console.log('Watching for changes and automatically regenerating website');
new ae86().watch(bag.cli.exit);
}
function _clean() {
+ console.log('Removing website');
new ae86().clean(bag.cli.exit);
}
View
@@ -21,6 +21,7 @@ buster.testCase('cli - exec', {
buster.testCase('cli - init', {
'should contain init command and delegate to ae86 init when exec is called': function (done) {
+ this.mock(console).expects('log').withExactArgs('Creating example AE86 project');
this.stub(bag, 'cli', {
command: function (base, actions) {
actions.commands.init.action();
@@ -37,6 +38,7 @@ buster.testCase('cli - init', {
buster.testCase('cli - gen', {
'should contain gen command and delegate to ae86 generate when exec is called': function (done) {
+ this.mock(console).expects('log').withExactArgs('Generating website');
this.stub(bag, 'cli', {
command: function (base, actions) {
actions.commands.gen.action();
@@ -53,6 +55,7 @@ buster.testCase('cli - gen', {
buster.testCase('cli - watch', {
'should contain watch command and delegate to ae86 watch when exec is called': function (done) {
+ this.mock(console).expects('log').withExactArgs('Watching for changes and automatically regenerating website');
this.stub(bag, 'cli', {
command: function (base, actions) {
actions.commands.watch.action();
@@ -69,6 +72,7 @@ buster.testCase('cli - watch', {
buster.testCase('cli - drift', {
'should contain drift command and delegate to ae86 watch when exec is called': function (done) {
+ this.mock(console).expects('log').withExactArgs('Watching for changes and automatically regenerating website');
this.stub(bag, 'cli', {
command: function (base, actions) {
actions.commands.watch.action();
@@ -85,6 +89,7 @@ buster.testCase('cli - drift', {
buster.testCase('cli - clean', {
'should contain clean command and delegate to ae86 clean when exec is called': function (done) {
+ this.mock(console).expects('log').withExactArgs('Removing website');
this.stub(bag, 'cli', {
command: function (base, actions) {
actions.commands.clean.action();

0 comments on commit d523ff1

Please sign in to comment.