Skip to content

Commit

Permalink
feat: drop esdoc ./path/to/dir implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
h13i32maru committed Jun 6, 2015
1 parent b86c668 commit b4d2121
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 48 deletions.
35 changes: 1 addition & 34 deletions src/ESDocCLI.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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]');
}

/**
Expand All @@ -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.
Expand Down
14 changes: 0 additions & 14 deletions test/src/UnitTest/ESDocCLITest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.