Skip to content
Permalink
Browse files
feat: drop esdoc ./path/to/dir implementation.
  • Loading branch information
h13i32maru committed Jun 6, 2015
1 parent b86c668 commit b4d21219221b8307a155fdee85e2ed5fed9c4429
Showing with 1 addition and 48 deletions.
  1. +1 −34 src/ESDocCLI.js
  2. +0 −14 test/src/UnitTest/ESDocCLITest.js
@@ -43,8 +43,6 @@ export default class ESDocCLI {
let config;
if (this._argv.c) {
config = this._createConfigFromJSONFile(this._argv.c);
} else if (this._argv._.length) {
config = this._createConfigFromPath(this._argv._[0]);
} else {
this._showHelp();
process.exit(1);
@@ -79,7 +77,7 @@ export default class ESDocCLI {
* @private
*/
_showHelp() {
console.log('usage: esdoc [-c esdoc.json | path/to/dir]');
console.log('usage: esdoc [-c esdoc.json]');
}

/**
@@ -103,37 +101,6 @@ export default class ESDocCLI {

return config;
}

/**
* create config object from target root directory.
* @param {string} targetPath - target root directory path.
* @return {{source: string, destination: string}} minimum config object.
* @private
*/
_createConfigFromPath(targetPath) {
targetPath = path.resolve(targetPath);
let stat = fs.statSync(targetPath);
let config;

if (!stat.isDirectory()) {
this._showHelp();
process.exit(1);
}

let readmeStat = null;
try {
readmeStat = fs.statSync('./README.md');
} catch(e) {
// ignore
}

config = {
source: targetPath,
destination: '_esdoc_'
};

return config;
}
}

// if this file is directory executed, work as CLI.
@@ -18,18 +18,4 @@ describe('ESDocCLI:', ()=>{
cli.exec();
assert(true);
});

/**
* @test {ESDocCLI#exec}
* @test {ESDocCLI#_createConfigFromPath}
*/
it('can execute with directory path', ()=>{
let cliPath = path.resolve('./src/cli.js');
let dirPath = path.resolve('./test/fixture/src');
let argv = ['node', cliPath, dirPath];
let cli = new ESDocCLI(argv);
cli.exec();
fs.removeSync('./_esdoc_');
assert(true);
});
});

0 comments on commit b4d2121

Please sign in to comment.