Skip to content

Commit

Permalink
Use conf.json.EXAMPLE and .gitignore conf.json to changes don't affec…
Browse files Browse the repository at this point in the history
…t repo status

To make it no impact, if JSDoc can't find a conf.json, it looks for conf.json.EXAMPLE and copies that over.
  • Loading branch information
jannon committed Mar 16, 2012
1 parent 60197c6 commit 3d1d9d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
6 changes: 1 addition & 5 deletions conf.json → conf.json.EXAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
"tags": {
"allowUnknownTags": true
},

"source": {
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(^|\\/)_"
},

"plugins": [
],

"plugins": [],
"jsVersion": 180
}
15 changes: 12 additions & 3 deletions jsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,26 @@ function main() {
}
},
resolver,
dictionary = require('jsdoc/tag/dictionary');
dictionary = require('jsdoc/tag/dictionary'),
fs = require('fs');

env.opts = jsdoc.opts.parser.parse(env.args);

try {
env.conf = JSON.parse(
require('fs').readFileSync( env.opts.configure || __dirname + '/conf.json' )
fs.readFileSync( env.opts.configure || __dirname + '/conf.json' )
);
}
catch (e) {
throw('Configuration file cannot be evaluated. '+e);
try {
//Try to copy over the example conf
var example = fs.readFileSync(__dirname + '/conf.json.EXAMPLE', 'utf8');
fs.writeFileSync(__dirname + '/conf.json', example, 'utf8');
env.conf = JSON.parse(example);
}
catch(e) {
throw('Configuration file cannot be evaluated. ' + e);
}
}

// allow to pass arguments from configuration file
Expand Down

0 comments on commit 3d1d9d7

Please sign in to comment.