diff --git a/Gruntfile.js b/Gruntfile.js index 195510ab41b..3cca22ae30d 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -102,21 +102,21 @@ module.exports = function (grunt) { options: { appDir: '<%= tempDir %>', dir: '<%= destDir %>', - modules: [], // populated below + mainConfigFile: '<%= tempDir %>/app/components/require.config.js', - keepBuildDir: true, + modules: [], // populated below + optimize: 'none', optimizeCss: 'none', + + removeCombined: true, preserveLicenseComments: false, findNestedDependencies: true, normalizeDirDefines: "none", inlineText: true, skipPragmas: true, optimizeAllPluginResources: false, - removeCombined: true, - fileExclusionRegExp: /^\./, - logLevel: 0, - skipSemiColonInsertion: true, + done: function (done, output) { var duplicates = require('rjs-build-analysis').duplicates(output); @@ -127,11 +127,6 @@ module.exports = function (grunt) { } done(); - }, - config: { - 'tmpl': { - registerTemplate: function () {} - } } } } @@ -146,9 +141,14 @@ module.exports = function (grunt) { quite: true, compress: true, preserveComments: false, - banner: '<%= meta.banner %>', + banner: '<%= meta.banner %>' } } + }, + 'git-describe': { + me: { + // Target-specific file lists and/or options go here. + }, } }; @@ -201,10 +201,12 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-ngmin'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-less'); + grunt.loadNpmTasks('grunt-git-describe'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-string-replace'); grunt.loadNpmTasks('grunt-contrib-htmlmin'); grunt.loadNpmTasks('grunt-contrib-requirejs'); @@ -223,7 +225,28 @@ module.exports = function (grunt) { 'ngmin', 'requirejs:compile_temp', 'clean:after_require', + 'write_revision_to_dest', // runs git-describe and replace:config 'uglify:dest' ]); + grunt.registerTask('write_revision_to_dest', function() { + grunt.event.once('git-describe', function (desc) { + grunt.config('string-replace.config', { + src: '<%= destDir %>/app/components/require.config.js', + dest: '<%= destDir %>/app/components/require.config.js', + options: { + replacements: [ + { + pattern: /(?:^|\/\/)(.*)@REV@/, + replacement: '$1'+desc.object + } + ] + } + }); + + grunt.task.run('string-replace:config'); + }); + grunt.task.run('git-describe'); + }); + }; \ No newline at end of file diff --git a/dist/app/components/require.config.js b/dist/app/components/require.config.js index 95f1ac65e0a..9cb722e7230 100644 --- a/dist/app/components/require.config.js +++ b/dist/app/components/require.config.js @@ -1,4 +1,4 @@ /*! kibana - v3.0.0m3pre - 2013-09-13 * Copyright (c) 2013 Rashid Khan; Licensed Apache License */ -require.config({baseUrl:"app",paths:{config:"../config",settings:"components/settings",kbn:"components/kbn",css:"../vendor/require/css",text:"../vendor/require/text",moment:"../vendor/moment",filesaver:"../vendor/filesaver",angular:"../vendor/angular/angular","angular-strap":"../vendor/angular/angular-strap","angular-sanitize":"../vendor/angular/angular-sanitize",timepicker:"../vendor/angular/timepicker",datepicker:"../vendor/angular/datepicker",underscore:"components/underscore.extended","underscore-src":"../vendor/underscore",bootstrap:"../vendor/bootstrap/bootstrap",jquery:"components/jquery.extended","jquery-src":"../vendor/jquery/jquery-1.8.0","jquery.flot":"../vendor/jquery/jquery.flot","jquery.flot.pie":"../vendor/jquery/jquery.flot.pie","jquery.flot.selection":"../vendor/jquery/jquery.flot.selection","jquery.flot.stack":"../vendor/jquery/jquery.flot.stack","jquery.flot.time":"../vendor/jquery/jquery.flot.time",modernizr:"../vendor/modernizr-2.6.1",elasticjs:"../vendor/elasticjs/elastic-angular-client"},shim:{underscore:{exports:"_"},angular:{deps:["jquery"],exports:"angular"},bootstrap:{deps:["jquery"]},modernizr:{exports:"Modernizr"},"jquery-src":{exports:"jQuery"},"jquery.flot":["jquery"],"jquery.flot.pie":["jquery","jquery.flot"],"jquery.flot.selection":["jquery","jquery.flot"],"jquery.flot.stack":["jquery","jquery.flot"],"jquery.flot.time":["jquery","jquery.flot"],"angular-sanitize":["angular"],"angular-cookies":["angular"],"angular-loader":["angular"],"angular-mocks":["angular"],"angular-resource":["angular"],"angular-route":["angular"],"angular-touch":["angular"],"angular-strap":["angular","bootstrap","timepicker","datepicker"],timepicker:["jquery","bootstrap"],datepicker:["jquery","bootstrap"],elasticjs:["angular","../vendor/elasticjs/elastic"]}}); \ No newline at end of file +require.config({baseUrl:"app",urlArgs:"r=6c07338",paths:{config:"../config",settings:"components/settings",kbn:"components/kbn",css:"../vendor/require/css",text:"../vendor/require/text",moment:"../vendor/moment",filesaver:"../vendor/filesaver",angular:"../vendor/angular/angular","angular-strap":"../vendor/angular/angular-strap","angular-sanitize":"../vendor/angular/angular-sanitize",timepicker:"../vendor/angular/timepicker",datepicker:"../vendor/angular/datepicker",underscore:"components/underscore.extended","underscore-src":"../vendor/underscore",bootstrap:"../vendor/bootstrap/bootstrap",jquery:"components/jquery.extended","jquery-src":"../vendor/jquery/jquery-1.8.0","jquery.flot":"../vendor/jquery/jquery.flot","jquery.flot.pie":"../vendor/jquery/jquery.flot.pie","jquery.flot.selection":"../vendor/jquery/jquery.flot.selection","jquery.flot.stack":"../vendor/jquery/jquery.flot.stack","jquery.flot.time":"../vendor/jquery/jquery.flot.time",modernizr:"../vendor/modernizr-2.6.1",elasticjs:"../vendor/elasticjs/elastic-angular-client"},shim:{underscore:{exports:"_"},angular:{deps:["jquery"],exports:"angular"},bootstrap:{deps:["jquery"]},modernizr:{exports:"Modernizr"},"jquery-src":{exports:"jQuery"},"jquery.flot":["jquery"],"jquery.flot.pie":["jquery","jquery.flot"],"jquery.flot.selection":["jquery","jquery.flot"],"jquery.flot.stack":["jquery","jquery.flot"],"jquery.flot.time":["jquery","jquery.flot"],"angular-sanitize":["angular"],"angular-cookies":["angular"],"angular-loader":["angular"],"angular-mocks":["angular"],"angular-resource":["angular"],"angular-route":["angular"],"angular-touch":["angular"],"angular-strap":["angular","bootstrap","timepicker","datepicker"],timepicker:["jquery","bootstrap"],datepicker:["jquery","bootstrap"],elasticjs:["angular","../vendor/elasticjs/elastic"]}}); \ No newline at end of file diff --git a/package.json b/package.json index 5bccb6f976e..bcffd232e26 100755 --- a/package.json +++ b/package.json @@ -19,7 +19,9 @@ "grunt-contrib-clean": "~0.5.0", "grunt-contrib-uglify": "~0.2.4", "rjs-build-analysis": "0.0.3", - "grunt-angular-templates": "~0.3.12" + "grunt-angular-templates": "~0.3.12", + "grunt-string-replace": "~0.2.4", + "grunt-git-describe": "~2.3.2" }, "license": "Apache License" } diff --git a/src/app/components/require.config.js b/src/app/components/require.config.js index 7f6bfca05b3..54f8c59102f 100755 --- a/src/app/components/require.config.js +++ b/src/app/components/require.config.js @@ -3,6 +3,7 @@ */ require.config({ baseUrl: 'app', + // urlArgs: 'r=@REV@', paths: { config: '../config', settings: 'components/settings', @@ -36,12 +37,10 @@ require.config({ }, shim: { underscore: { - // requiring should work, but isn't required exports: '_' }, angular: { - // requiring should work, but isn't required deps: ['jquery'], exports: 'angular' }, @@ -55,11 +54,10 @@ require.config({ }, 'jquery-src': { - // requiring should work, but isn't required exports: 'jQuery' }, - // simple dependency declatation + // simple dependency declaration 'jquery.flot': ['jquery'], 'jquery.flot.pie': ['jquery', 'jquery.flot'], 'jquery.flot.selection':['jquery', 'jquery.flot'],