From 4a874b83634ac3b0fede040191f018192bcc8517 Mon Sep 17 00:00:00 2001 From: liabru Date: Tue, 11 Mar 2014 01:17:41 +0000 Subject: [PATCH] added version switch for docs --- Gruntfile.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 2e6c3ef..3276f6a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -2,6 +2,7 @@ module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), buildName: 'matter', + docVersion: 'v<%= pkg.version %>', concat: { build: { options: { @@ -66,9 +67,9 @@ module.exports = function(grunt) { }, yuidoc: { compile: { - name: '<%= pkg.name %>.js Physics Engine API Documentation', + name: '<%= pkg.name %>.js Physics Engine API Documentation for <%= docVersion %>', description: '<%= pkg.description %>', - version: '<%= pkg.version %>', + version: '<%= docVersion %>', url: '<%= pkg.homepage %>', options: { paths: 'src', @@ -92,7 +93,13 @@ module.exports = function(grunt) { grunt.registerTask('build', ['concat', 'uglify', 'copy']); grunt.registerTask('test', ['jshint']); grunt.registerTask('dev', ['set_config:buildName:matter-dev', 'build', 'connect:watch', 'watch']); - grunt.registerTask('doc', ['yuidoc']); + + grunt.registerTask('doc', function(n) { + var dev = grunt.option('dev'); + if (dev) + grunt.config.set('docVersion', 'edge version (master)'); + grunt.task.run('yuidoc'); + }); grunt.registerTask('set_config', 'Set a config property.', function(name, val) { grunt.config.set(name, val);