added grunt support for yui doc generator

This commit is contained in:
Spencer Alger 2014-08-25 11:23:02 -07:00
parent c20dac0b42
commit ed92eab2d8
5 changed files with 41 additions and 9 deletions

1
.gitignore vendored
View file

@ -1,6 +1,7 @@
.DS_Store
node_modules
src/bower_components
docs/
**/*.css
trash
build

View file

@ -19,6 +19,7 @@
"grunt-contrib-less": "~0.10.0",
"grunt-contrib-requirejs": "~0.4.4",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-yuidoc": "~0.5.2",
"grunt-mocha": "~0.4.10",
"http-proxy": "~1.1.4",
"husky": "~0.6.0",

View file

@ -20,6 +20,12 @@ module.exports = function (grunt) {
],
tasks: ['jade:test']
},
docs: {
files: [
'<%= app %>/**/*.js'
],
tasks: ['yuidoc']
},
clientside_jade: {
files: [
'<%= testUtilsDir %>/istanbul_reporter/report.clientside.jade'
@ -28,10 +34,8 @@ module.exports = function (grunt) {
}
};
if (grunt.option('no-test-watcher')) {
// unset the test watcher
delete config.test;
}
if (grunt.option('no-test-watcher')) delete config.test;
if (!grunt.option('doc-watcher')) delete config.docs;
return config;
};

24
tasks/config/yuidoc.js vendored Normal file
View file

@ -0,0 +1,24 @@
module.exports = function (grunt) {
return {
compile: {
name: '<%= pkg.name %>',
description: '<%= pkg.description %>',
version: '<%= pkg.version %>',
url: '<%= pkg.homepage %>',
options: {
linkNatives: true,
paths: [
'src/kibana/components'
],
excludePaths: [
'src/kibana/components/courier'
],
outdir: 'docs',
tabtospace: 2,
markdown: {
gfm: true
}
}
}
};
};

View file

@ -6,11 +6,12 @@ var Promise = require('bluebird');
var instrumentationMiddleware = require('./_instrumentation');
var amdRapperMiddleware = require('./_amd_rapper');
var rel = require('path').join.bind(null, __dirname);
var proxy = require('http-proxy').createProxyServer({});
var ROOT = rel('../../../');
var SRC = rel('../../../src');
var join = require('path').join;
var ROOT = join(__dirname, '../../../');
var DOCS = join(ROOT, 'docs');
var SRC = join(ROOT, 'src');
module.exports = function DevServer(opts) {
opts = opts || {};
@ -39,8 +40,9 @@ module.exports = function DevServer(opts) {
});
app.use(connect.static(ROOT));
app.use('/docs', connect.static(DOCS));
// respond to the "maybe_start_server" pings
// respond to "maybe_start_server" pings
app.use(function (req, res, next) {
if (req.method !== 'HEAD' || req.url !== '/') return next();
res.statusCode === 200;