aboutsummaryrefslogtreecommitdiffstats
path: root/docs/config/processors/index-page.js
diff options
context:
space:
mode:
authorPeter Bacon Darwin2014-02-12 22:47:42 +0000
committerPeter Bacon Darwin2014-02-16 19:03:41 +0000
commit389d4879da4aa620ee95d789b19ff9be44eb730a (patch)
tree93352ddc8738a975904a1774d51b93d585ca1075 /docs/config/processors/index-page.js
parenta564160511bf1bbed5a4fe5d2981fae1bb664eca (diff)
downloadangular.js-389d4879da4aa620ee95d789b19ff9be44eb730a.tar.bz2
chore(doc-gen): new docs
chore(doc-gen): implement dgeni
Diffstat (limited to 'docs/config/processors/index-page.js')
-rw-r--r--docs/config/processors/index-page.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/docs/config/processors/index-page.js b/docs/config/processors/index-page.js
new file mode 100644
index 00000000..3ba1ac73
--- /dev/null
+++ b/docs/config/processors/index-page.js
@@ -0,0 +1,42 @@
+var _ = require('lodash');
+var log = require('winston');
+var path = require('canonical-path');
+var deployment;
+
+module.exports = {
+ name: 'index-page',
+ runAfter: ['adding-extra-docs'],
+ runBefore: ['extra-docs-added'],
+ description: 'This processor creates docs that will be rendered as the index page for the app',
+ init: function(config) {
+ deployment = config.deployment;
+ if ( !deployment || !deployment.environments ) {
+ throw new Errro('No deployment environments found in the config.');
+ }
+ },
+ process: function(docs) {
+
+ // Collect up all the areas in the docs
+ var areas = {};
+ _.forEach(docs, function(doc) {
+ if ( doc.area ) {
+ areas[doc.area] = doc.area;
+ }
+ });
+ areas = _.keys(areas);
+
+ _.forEach(deployment.environments, function(environment) {
+
+ var indexDoc = _.defaults({
+ docType: 'indexPage',
+ areas: areas
+ }, environment);
+
+ indexDoc.id = 'index' + (environment.name === 'default' ? '' : '-' + environment.name);
+ // Use .. to put it at the root of the build
+ indexDoc.outputPath = indexDoc.id + '.html';
+
+ docs.push(indexDoc);
+ });
+ }
+}; \ No newline at end of file