Browse files

Updated API Docs

  • Loading branch information...
1 parent e20514e commit cbe62fce3eac6b6a2b399d5e6981fa6dfe213bf7 @davglass committed Feb 17, 2012
Showing with 82 additions and 27 deletions.
  1. +11 −6 lib/docparser.js
  2. +7 −7 lib/files.js
  3. +6 −6 lib/index.js
  4. +49 −0 lib/server.js
  5. +9 −8 lib/yuidoc.js
View
17 lib/docparser.js
@@ -1026,12 +1026,17 @@ Y.log('param name/type/descript missing: ' + stringlog(block), 'warn', 'docparse
},
/**
- * Transforms a JavaDoc style comment block (less the start
- * and end of it) into a list
- * of tag/text pairs. The leading space and '*' are removed,
- * but the remaining whitespace is preserved so that the
- * output should be friendly for both markdown and html
- * parsers.
+ Transforms a JavaDoc style comment block (less the start
+ and end of it) into a list
+ of tag/text pairs. The leading space and '*' are removed,
+ but the remaining whitespace is preserved so that the
+ output should be friendly for both markdown and html
+ parsers.
+
+ @method handlecomment
+ @param {String} comment The comment to parse
+ @param {String} file The file it was parsed from
+ @param {String} line The line number it was found on
*/
handlecomment: function(comment, file, line) {
var lines = comment.split(REGEX_LINES),
View
14 lib/files.js
@@ -148,13 +148,13 @@ directory instead of *into* it.
Known issues:
- Doesn't preserve ownership or permissions on copied files/directories.
-* @method copyPath
-* @param {String} source Source path.
-* @param {String} dest Destination path.
-* @param {Boolean} [overwrite=false] Whether or not to overwrite destination files
- if they already exist.
-* @param {Callback} callback The callback to execute when completed.
-* @param {Error} callback.err
+@method copyPath
+@param {String} source Source path.
+@param {String} dest Destination path.
+@param {Boolean} [overwrite=false] Whether or not to overwrite destination files
+if they already exist.
+@param {Callback} callback The callback to execute when completed.
+@param {Error} callback.err
**/
function copyPath(source, dest, overwrite, callback) {
var destStats = statSync(dest),
View
12 lib/index.js
@@ -4,9 +4,9 @@ Code licensed under the BSD License:
http://yuilibrary.com/license/
*/
/**
-* Module creates the YUI instance with the required modules, uses them and exports the **Y** to be used
-* by the _CLI class_ or by extenders: `require('yuidocjs');`
-* You can use it like this:
+Module creates the YUI instance with the required modules, uses them and exports the **Y** to be used
+by the _CLI class_ or by extenders: `require('yuidocjs');`
+You can use it like this:
var options = {
paths: [ './lib' ],
@@ -16,9 +16,9 @@ http://yuilibrary.com/license/
var Y = require('yuidoc');
var json = (new Y.YUIDoc(options)).run();
-* @class index
-* @exports {YUI} Y A YUI instance
-* @module yuidoc
+@class index
+@exports {YUI} Y A YUI instance
+@module yuidoc
*/
var YUI = require('yui').YUI,
View
49 lib/server.js
@@ -1,12 +1,28 @@
YUI.add('server', function(Y) {
+ /**
+ * Provides the `--server` server option for YUIDoc
+ * @class Server
+ * @module server
+ */
var Server = {
+ /**
+ * Middleware to parse the API docs per request
+ * @method parse
+ * @param {Request} req Express request object
+ * @param {Response} res Express response object
+ * @param {Function} next Express next callback
+ */
parse: function(req, res, next) {
var json = (new Y.YUIDoc(Server.options)).run();
Server.options = Y.Project.mix(json, Server.options);
Server.builder = new Y.DocBuilder(Server.options, json);
next();
},
+ /**
+ * Create the routes used to serve YUIDoc files dynamically
+ * @method routes
+ */
routes: function() {
var app = Server.app;
@@ -51,6 +67,12 @@ YUI.add('server', function(Y) {
});
},
+ /**
+ * `/files` endpoint
+ * @method files
+ * @param {Request} req Express request object
+ * @param {Response} res Express response object
+ */
files: function(req, res) {
var fileName = req.params.file;
var data;
@@ -65,26 +87,48 @@ YUI.add('server', function(Y) {
res.send(html);
}, data, (req.xhr ? 'xhr' : 'main'));
},
+ /**
+ * `/classes` endpoint
+ * @method clazz
+ * @param {Request} req Express request object
+ * @param {Response} res Express response object
+ */
clazz: function(req, res) {
var className = req.params['class'];
Y.log('Serving /classes/' + className + '.html', 'info', 'server');
Server.builder.renderClass(function(html) {
res.send(html);
}, Server.builder.data.classes[className], (req.xhr ? 'xhr' : 'main'));
},
+ /**
+ * `/modules` endpoint
+ * @method modules
+ * @param {Request} req Express request object
+ * @param {Response} res Express response object
+ */
module: function(req, res) {
var modName = req.params.module;
Y.log('Serving /modules/' + modName + '.html', 'info', 'server');
Server.builder.renderModule(function(html) {
res.send(html);
}, Server.builder.data.modules[modName], (req.xhr ? 'xhr' : 'main'));
},
+ /**
+ * `/` endpoint
+ * @method home
+ * @param {Request} req Express request object
+ * @param {Response} res Express response object
+ */
home: function(req, res) {
Y.log('Serving index.html', 'info', 'server');
Server.builder.renderIndex(function(html) {
res.send(html);
});
},
+ /**
+ * Creates the Express server and prep's YUI for serving
+ * @method init
+ */
init: function() {
var express = require('express'),
path = require('path');
@@ -101,6 +145,11 @@ YUI.add('server', function(Y) {
Y.config.logExclude.builder = true;
},
+ /**
+ * Start the server with the supplied options.
+ * @method start
+ * @param {Object} options Server options
+ */
start: function(options) {
options = Y.Project.init(options);
if (options.selleck) {
View
17 lib/yuidoc.js
@@ -8,7 +8,7 @@ var fs = require("fs"),
path = require("path");
/**
-This is the **module** description for the `YUIDoc` module.
+This is the __module__ description for the `YUIDoc` module.
var options = {
paths: [ './lib' ],
@@ -18,7 +18,8 @@ This is the **module** description for the `YUIDoc` module.
var Y = require('yuidoc');
var json = (new Y.YUIDoc(options)).run();
-* @main yuidoc
+@class YUIDoc
+@main yuidoc
*/
@@ -47,13 +48,13 @@ YUI.add('yuidoc', function(Y) {
/**
* YUIDoc main class
- var options = {
- paths: [ './lib' ],
- outdir: './out'
- };
+ var options = {
+ paths: [ './lib' ],
+ outdir: './out'
+ };
- var Y = require('yuidoc');
- var json = (new Y.YUIDoc(options)).run();
+ var Y = require('yuidoc');
+ var json = (new Y.YUIDoc(options)).run();
* @class YUIDoc
* @module yuidoc

0 comments on commit cbe62fc

Please sign in to comment.