diff --git a/shell.js b/shell.js index ab43a2a..9587f36 100644 --- a/shell.js +++ b/shell.js @@ -148,7 +148,7 @@ function _cd(options, dir) { exports.cd = wrap('cd', _cd); //@ -//@ #### pwd() +//@ #### shell.pwd() //@ Returns the current directory. function _pwd(options) { return path.resolve(process.cwd()); diff --git a/test/cd.js b/test/cd.js index f4f572c..f1e240c 100644 --- a/test/cd.js +++ b/test/cd.js @@ -1,4 +1,4 @@ -require('../maker'); +var shell = require('..'); var assert = require('assert'), path = require('path'), @@ -7,55 +7,55 @@ var assert = require('assert'), // Node shims for < v0.7 fs.existsSync = fs.existsSync || path.existsSync; -silent(); +shell.silent(); function numLines(str) { return typeof str === 'string' ? str.match(/\n/g).length : 0; } // save current dir -var cur = pwd(); +var cur = shell.pwd(); // // Invalids // -cd(); -assert.ok(error()); +shell.cd(); +assert.ok(shell.error()); assert.equal(fs.existsSync('/asdfasdf'), false); // sanity check -cd('/adsfasdf'); // dir does not exist -assert.ok(error()); +shell.cd('/adsfasdf'); // dir does not exist +assert.ok(shell.error()); assert.equal(fs.existsSync('resources/file1'), true); // sanity check -cd('resources/file1'); // file, not dir -assert.ok(error()); +shell.cd('resources/file1'); // file, not dir +assert.ok(shell.error()); // // Valids // -cd(cur); -cd('tmp'); -assert.equal(error(), null); +shell.cd(cur); +shell.cd('tmp'); +assert.equal(shell.error(), null); assert.equal(path.basename(process.cwd()), 'tmp'); -cd(cur); -cd('/'); -assert.equal(error(), null); +shell.cd(cur); +shell.cd('/'); +assert.equal(shell.error(), null); assert.equal(process.cwd(), path.resolve('/')); // cd + other commands -cd(cur); -rm('-f tmp/*'); +shell.cd(cur); +shell.rm('-f', 'tmp/*'); assert.equal(fs.existsSync('tmp/file1'), false); -cd('resources'); -assert.equal(error(), null); -cp('file1 ../tmp'); -assert.equal(error(), null); -cd('../tmp'); -assert.equal(error(), null); +shell.cd('resources'); +assert.equal(shell.error(), null); +shell.cp('file1', '../tmp'); +assert.equal(shell.error(), null); +shell.cd('../tmp'); +assert.equal(shell.error(), null); assert.equal(fs.existsSync('file1'), true); -exit(123); +shell.exit(123); diff --git a/test/pwd.js b/test/pwd.js index 9feb287..34b2f6e 100644 --- a/test/pwd.js +++ b/test/pwd.js @@ -1,9 +1,9 @@ -require('../maker'); +var shell = require('..'); var assert = require('assert'), path = require('path'); -silent(); +shell.silent(); function numLines(str) { return typeof str === 'string' ? str.match(/\n/g).length : 0; @@ -13,13 +13,13 @@ function numLines(str) { // Valids // -var _pwd = pwd(); -assert.equal(error(), null); +var _pwd = shell.pwd(); +assert.equal(shell.error(), null); assert.equal(_pwd, path.resolve('.')); -cd('tmp'); -var _pwd = pwd(); -assert.equal(error(), null); +shell.cd('tmp'); +var _pwd = shell.pwd(); +assert.equal(shell.error(), null); assert.equal(path.basename(_pwd), 'tmp'); -exit(123); +shell.exit(123);