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 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: { watch: {
grunt: { grunt: {
files: ['Gruntfile.js'], files: ['Gruntfile.js'],
@ -161,11 +179,12 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-compass'); grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-exec'); grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-text-replace');
grunt.registerTask('img', ['newer:copy']); grunt.registerTask('img', ['newer:copy']);
grunt.registerTask('css', ['clean:css', 'compass']); grunt.registerTask('css', ['clean:css', 'compass']);
grunt.registerTask('js', ['clean:js', 'concat']); 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('default', ['clean', 'assemble', 'css', 'js', 'img', 'generate-docs', 'copy:dist']);
grunt.registerTask('dev', ['default', 'watch']); grunt.registerTask('dev', ['default', 'watch']);
}; };

View File

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