diff options
| author | Peter Bacon Darwin | 2014-02-13 21:50:13 +0000 |
|---|---|---|
| committer | Peter Bacon Darwin | 2014-02-16 19:03:42 +0000 |
| commit | 0b35521d8ffe9ff851c49801900381ec043962f0 (patch) | |
| tree | 3143e1bfbc1c436b626f1dde408e1e6d9e985703 | |
| parent | 4a938213dfc0ef1828ab795ba726c490b267db69 (diff) | |
| download | angular.js-0b35521d8ffe9ff851c49801900381ec043962f0.tar.bz2 | |
chore(doc-gen): move git info into its own processor
| -rw-r--r-- | docs/config/index.js | 1 | ||||
| -rw-r--r-- | docs/config/processors/git-data.js | 17 | ||||
| -rw-r--r-- | docs/config/processors/versions-data.js | 12 | ||||
| -rw-r--r-- | docs/docs.config.js | 11 |
4 files changed, 22 insertions, 19 deletions
diff --git a/docs/config/index.js b/docs/config/index.js index eb23737e..f2d76977 100644 --- a/docs/config/index.js +++ b/docs/config/index.js @@ -9,6 +9,7 @@ module.exports = function(config) { config = angularjsPackage(config); config.append('processing.processors', [ + require('./processors/git-data'), require('./processors/keywords'), require('./processors/versions-data'), require('./processors/pages-data'), diff --git a/docs/config/processors/git-data.js b/docs/config/processors/git-data.js new file mode 100644 index 00000000..229864bb --- /dev/null +++ b/docs/config/processors/git-data.js @@ -0,0 +1,17 @@ +var gruntUtils = require('../../../lib/grunt/utils'); + +module.exports = { + name: 'git-data', + runBefore: ['loading-files'], + description: 'This processor adds information from the local git repository to the extraData injectable', + init: function(config, injectables) { + injectables.value('gitData', { + version: gruntUtils.getVersion(), + versions: gruntUtils.getPreviousVersions(), + info: gruntUtils.getGitRepoInfo() + }); + }, + process: function(extraData, gitData) { + extraData.git = gitData; + } +};
\ No newline at end of file diff --git a/docs/config/processors/versions-data.js b/docs/config/processors/versions-data.js index eb158e79..14357fd7 100644 --- a/docs/config/processors/versions-data.js +++ b/docs/config/processors/versions-data.js @@ -1,17 +1,15 @@ var _ = require('lodash'); -var version; -var versions; - module.exports = { name: 'versions-data', description: 'This plugin will create a new doc that will be rendered as an angularjs module ' + 'which will contain meta information about the versions of angular', runAfter: ['adding-extra-docs', 'pages-data'], runBefore: ['extra-docs-added'], - init: function(config) { - version = config.source.currentVersion; - versions = config.source.previousVersions; + process: function(docs, gitData) { + + var version = gitData.version; + var versions = gitData.versions; if ( !version ) { throw new Error('Invalid configuration. Please provide a valid `source.currentVersion` property'); @@ -19,8 +17,6 @@ module.exports = { if ( !versions ) { throw new Error('Invalid configuration. Please provide a valid `source.previousVersions` property'); } - }, - process: function(docs) { var versionDoc = { docType: 'versions-data', diff --git a/docs/docs.config.js b/docs/docs.config.js index a64dda75..4c6d07d2 100644 --- a/docs/docs.config.js +++ b/docs/docs.config.js @@ -1,5 +1,4 @@ var path = require('canonical-path'); -var gruntUtils = require('../lib/grunt/utils'); var basePath = __dirname; var basePackage = require('./config'); @@ -13,21 +12,11 @@ module.exports = function(config) { { pattern: '**/*.ngdoc', basePath: path.resolve(basePath, 'content') } ]); - var version = gruntUtils.getVersion(); - var versions = gruntUtils.getPreviousVersions(); - config.set('source.currentVersion', version); - config.set('source.previousVersions', versions); - config.set('processing.examples.commonFiles', { scripts: [ '../../../angular.js' ], stylesheets: [] }); - config.merge('rendering.extra', { - git: gruntUtils.getGitRepoInfo(), - version: version - }); - config.set('rendering.outputFolder', '../build/docs'); config.set('logging.level', 'debug'); |
