NIFI-592:

- Adding Google Analytics to generated documentation being deployed to the website.
This commit is contained in:
Matt Gilman 2015-05-06 10:04:18 -04:00
parent 251f0e53b0
commit 81e40d4348
3 changed files with 48 additions and 26 deletions

View File

@ -77,7 +77,7 @@ module.exports = function (grunt) {
dest: 'dist/docs/',
rename: function (dest, src) {
var path = require('path');
if (src.indexOf('images') > 0) {
return path.join(dest, 'rest-api/images', path.basename(src));
} else {
@ -129,6 +129,24 @@ module.exports = function (grunt) {
stderr: true
}
},
replace: {
addGoogleAnalytics: {
src: ['dist/docs/*.html', 'dist/docs/rest-api/index.html'],
overwrite: true,
replacements: [{
from: /<\/head>/g,
to: "<script>\n" +
"(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n" +
"(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n" +
"m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n" +
"})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n" +
"ga('create', 'UA-57264262-1', 'auto');\n" +
"ga('send', 'pageview');\n" +
"</script>\n" +
"</head>"
}]
}
},
watch: {
grunt: {
files: ['Gruntfile.js'],
@ -161,11 +179,12 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-text-replace');
grunt.registerTask('img', ['newer:copy']);
grunt.registerTask('css', ['clean:css', 'compass']);
grunt.registerTask('js', ['clean:js', 'concat']);
grunt.registerTask('generate-docs', ['clean:generated', 'exec:generateDocs', 'exec:generateRestApiDocs', 'copy:generated']);
grunt.registerTask('generate-docs', ['clean:generated', 'exec:generateDocs', 'exec:generateRestApiDocs', 'copy:generated', 'replace:addGoogleAnalytics']);
grunt.registerTask('default', ['clean', 'assemble', 'css', 'js', 'img', 'generate-docs', 'copy:dist']);
grunt.registerTask('dev', ['default', 'watch']);
};

View File

@ -1,25 +1,28 @@
{
"name": "apache-nifi-site",
"version": "0.0.2-incubating",
"description": "The artifacts for the Apache NiFi site.",
"private": "true",
"repository": {
"type": "git",
"url": "http://git-wip-us.apache.org/repos/asf/incubator-nifi.git"
},
"devDependencies": {
"assemble": "^0.4.42",
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compass": "^1.0.1",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-exec": "^0.4.6",
"grunt-newer": "^1.1.0"
},
"licenses": [{
"type": "Apache",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}]
"name": "apache-nifi-site",
"version": "0.0.2-incubating",
"description": "The artifacts for the Apache NiFi site.",
"private": "true",
"repository": {
"type": "git",
"url": "http://git-wip-us.apache.org/repos/asf/incubator-nifi.git"
},
"devDependencies": {
"assemble": "^0.4.42",
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compass": "^1.0.1",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-exec": "^0.4.6",
"grunt-newer": "^1.1.0",
"grunt-text-replace": "^0.4.0"
},
"licenses": [
{
"type": "Apache",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}
]
}

View File

@ -1,5 +1,5 @@
---
title: Apache NiFi Developer Guide
title: Apache NiFi Rest Api
---
<div class="external-guide">