aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src/gen-docs.js
diff options
context:
space:
mode:
authorKen Sheedlo2013-07-12 17:42:27 -0700
committerKen Sheedlo2013-07-24 10:42:20 -0700
commit4a7b6a4555a76b19dd217171fc0ddce6707bca95 (patch)
tree4646989291c1be2116c1e59c006f1208cb76c16a /docs/src/gen-docs.js
parentdca23173e25a32cb740245ca7f7b01a84805f43f (diff)
downloadangular.js-4a7b6a4555a76b19dd217171fc0ddce6707bca95.tar.bz2
docs(minErr): Build minErr doc site
Diffstat (limited to 'docs/src/gen-docs.js')
-rwxr-xr-xdocs/src/gen-docs.js30
1 files changed, 28 insertions, 2 deletions
diff --git a/docs/src/gen-docs.js b/docs/src/gen-docs.js
index f8ca5548..2e711ab3 100755
--- a/docs/src/gen-docs.js
+++ b/docs/src/gen-docs.js
@@ -3,7 +3,8 @@ var reader = require('./reader.js'),
writer = require('./writer.js'),
SiteMap = require('./SiteMap.js').SiteMap,
appCache = require('./appCache.js').appCache,
- Q = require('qq');
+ Q = require('qq'),
+ errorsJson = require('../../build/errors.json').errors;
var start = now();
var docs;
@@ -22,10 +23,35 @@ writer.makeDir('build/docs/', true).then(function() {
}).then(function generateHtmlDocPartials(docs_) {
docs = docs_;
ngdoc.merge(docs);
- var fileFutures = [];
+ var fileFutures = [], namespace;
+
+ var isErrorDocPresent = function (search) {
+ return docs.some(function (doc) {
+ return doc.ngdoc === 'error' && doc.name === search;
+ });
+ };
+
+ // Check that each generated error code has a doc file.
+ Object.keys(errorsJson).forEach(function (prop) {
+ if (typeof errorsJson[prop] === 'object') {
+ namespace = errorsJson[prop];
+ Object.keys(namespace).forEach(function (code) {
+ var search = prop + ':' + code;
+ if (!isErrorDocPresent(search)) {
+ throw new Error('Missing ngdoc file for error code: ' + search);
+ }
+ });
+ } else {
+ if (!isErrorDocPresent(prop)) {
+ throw new Error('Missing ngdoc file for error code: ' + prop);
+ }
+ }
+ });
+
docs.forEach(function(doc){
// this hack is here because on OSX angular.module and angular.Module map to the same file.
var id = doc.id.replace('angular.Module', 'angular.IModule');
+
fileFutures.push(writer.output('partials/' + doc.section + '/' + id + '.html', doc.html()));
});