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

@ -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

@ -16,10 +16,13 @@
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-exec": "^0.4.6",
"grunt-newer": "^1.1.0"
"grunt-newer": "^1.1.0",
"grunt-text-replace": "^0.4.0"
},
"licenses": [{
"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">