mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
keep track of which VM is running JSDoc
This commit is contained in:
parent
9956be9bc8
commit
56fa78573e
25
jsdoc.js
25
jsdoc.js
@ -21,6 +21,12 @@ env = {
|
||||
finish: null
|
||||
},
|
||||
|
||||
/**
|
||||
The type of VM that is executing jsdoc.
|
||||
@type string
|
||||
*/
|
||||
vm: '',
|
||||
|
||||
/**
|
||||
The command line arguments passed into jsdoc.
|
||||
@type Array
|
||||
@ -120,6 +126,23 @@ function exit(n) {
|
||||
java.lang.System.exit(n);
|
||||
}
|
||||
|
||||
/**
|
||||
Detect the type of VM running jsdoc.
|
||||
**Note**: Rhino is the only VM that is currently supported.
|
||||
@return {string} rhino|node
|
||||
*/
|
||||
function detectVm() {
|
||||
if (typeof Packages === "object" &&
|
||||
Object.prototype.toString.call(Packages) === "[object JavaPackage]") {
|
||||
return "rhino";
|
||||
} else if ( require && require.main && module && (require.main === module) ) {
|
||||
return "node";
|
||||
} else {
|
||||
// unknown VM
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function installPlugins(plugins, p) {
|
||||
var dictionary = require('jsdoc/tag/dictionary'),
|
||||
parser = p || app.jsdoc.parser;
|
||||
@ -196,6 +219,8 @@ function main() {
|
||||
|
||||
env.opts = jsdoc.opts.parser.parse(env.args);
|
||||
|
||||
env.vm = detectVm();
|
||||
|
||||
try {
|
||||
env.conf = new Config( fs.readFileSync( env.opts.configure || env.dirname + '/conf.json' ) ).get();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user