From 7441143adbdaf352bd6f31da94cd485d566fee17 Mon Sep 17 00:00:00 2001 From: Peter Rottmann Date: Fri, 19 Dec 2014 14:55:33 +0100 Subject: [PATCH] Update apidoc-core interface. --- lib/index.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/index.js b/lib/index.js index bfb4ebdd..e8f0afd8 100644 --- a/lib/index.js +++ b/lib/index.js @@ -50,6 +50,10 @@ process.on('uncaughtException', function(err) { * @returns {Mixed} true = ok, but nothing todo | false = error | Object with parsed data and project-informations. */ function createDoc(options) { + var api; + var apidocPath = path.join(__dirname, '../'); + var packageInfo; + _.defaults(options, defaults); // paths @@ -79,20 +83,22 @@ function createDoc(options) { } try { - var packageInfo = new PackageInfo(app); - var packageInfos = packageInfo.get(); + packageInfo = new PackageInfo(app); // generator information - var apidocPath = path.join(__dirname, '../'); var json = JSON.parse( fs.readFileSync(apidocPath + 'package.json', 'utf8') ); - var generator = { - version: json.version, - time : new Date(), + apidoc.setGeneratorInfos({ name : json.name, - url : json.homepage - }; + time : new Date(), + url : json.homepage, + version: json.version + }); + apidoc.setLogger(app.log); + apidoc.setMarkdownParser(app.markdown); + apidoc.setPackageInfos(packageInfo.get()); + + api = apidoc.parse(app.options); - var api = apidoc.parse(app.options, app.log, generator, packageInfos, app.markdown); if (api === true) { app.log.info('Nothing to do.'); return true;