diff --git a/package.json b/package.json index 01b9ae03cb1..34754a312ed 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "grunt-contrib-htmlmin": "~0.1.3", "grunt-contrib-jshint": "~0.10.0", "grunt-contrib-less": "~0.7.0", - "grunt-contrib-requirejs": "~0.4.1", + "grunt-contrib-requirejs": "~0.4.4", "grunt-contrib-uglify": "~0.8.0", "grunt-contrib-watch": "^0.6.1", "grunt-filerev": "^0.2.1", diff --git a/public/app/controllers/errorCtrl.js b/public/app/controllers/errorCtrl.js index b2dcbd1de50..9e70efb3ee4 100644 --- a/public/app/controllers/errorCtrl.js +++ b/public/app/controllers/errorCtrl.js @@ -8,7 +8,6 @@ function (angular) { var module = angular.module('grafana.controllers'); - module.controller('ErrorCtrl', function($scope, contextSrv) { var showSideMenu = contextSrv.sidemenu; diff --git a/public/test/karma.conf.js b/public/test/karma.conf.js index 020c65a9e3c..7c4881ee64a 100644 --- a/public/test/karma.conf.js +++ b/public/test/karma.conf.js @@ -9,10 +9,10 @@ module.exports = function(config) { // list of files / patterns to load in the browser files: [ 'public/test/test-main.js', - {pattern: 'public/.app_gen/**/*.js', included: false}, - {pattern: 'public/vendor/**/*.js', included: false}, - {pattern: 'public/test/**/*.js', included: false}, - {pattern: 'public/**/*.js', included: false} + {pattern: 'public_gen/.app_gen/**/*.js', included: false}, + {pattern: 'public_gen/vendor/**/*.js', included: false}, + {pattern: 'public_gen/test/**/*.js', included: false}, + {pattern: 'public_gen/**/*.js', included: false} ], // list of files to exclude diff --git a/public/test/test-main.js b/public/test/test-main.js index b9c0ba986aa..8a254c241ae 100644 --- a/public/test/test-main.js +++ b/public/test/test-main.js @@ -1,5 +1,5 @@ require.config({ - baseUrl: 'http://localhost:9876/base/public/app_gen', + baseUrl: 'http://localhost:9876/base/public_gen/app', paths: { specs: '../test/specs', diff --git a/tasks/build_task.js b/tasks/build_task.js index 4d7209017b8..546b2fed6cf 100644 --- a/tasks/build_task.js +++ b/tasks/build_task.js @@ -6,18 +6,18 @@ module.exports = function(grunt) { 'jshint:source', 'jshint:tests', 'jscs', - 'clean:on_start', - 'copy:app_gen_build', + 'clean:release', + 'copy:public_to_gen', 'typescript:build', 'karma:test', 'css', - 'copy:everything_but_less_to_temp', 'htmlmin:build', 'ngtemplates', 'cssmin:build', 'ngAnnotate:build', 'requirejs:build', 'concat:js', + 'clean:temp', 'filerev', 'remapFilerev', 'usemin', @@ -26,14 +26,13 @@ module.exports = function(grunt) { ]); // task to add [[.AppSubUrl]] to reved path - grunt.registerTask('remapFilerev', function(){ - var root = grunt.config().destDir; + grunt.registerTask('remapFilerev', function() { + var root = grunt.config().genDir; var summary = grunt.filerev.summary; var fixed = {}; for(var key in summary){ if(summary.hasOwnProperty(key)){ - var orig = key.replace(root, root+'/[[.AppSubUrl]]'); var revved = summary[key].replace(root, root+'/[[.AppSubUrl]]'); fixed[orig] = revved; @@ -44,29 +43,27 @@ module.exports = function(grunt) { }); grunt.registerTask('build-post-process', function() { - grunt.config('copy.dist_to_tmp', { + grunt.config('copy.public_gen_to_dest', { expand: true, - cwd: '<%= destDir %>', + cwd: '<%= genDir %>', src: '**/*', - dest: '<%= tempDir %>/public/', + dest: '<%= destDir %>/public/', }); - grunt.config('clean.dest_dir', ['<%= destDir %>']); grunt.config('copy.backend_bin', { cwd: 'bin', expand: true, src: ['*'], options: { mode: true}, - dest: '<%= tempDir %>/bin/' + dest: '<%= destDir %>/bin/' }); grunt.config('copy.backend_files', { expand: true, src: ['conf/defaults.ini', 'conf/sample.ini', 'vendor/**/*', 'scripts/*'], options: { mode: true}, - dest: '<%= tempDir %>' + dest: '<%= destDir %>' }); - grunt.task.run('copy:dist_to_tmp'); - grunt.task.run('clean:dest_dir'); + grunt.task.run('copy:public_gen_to_dest'); grunt.task.run('copy:backend_bin'); grunt.task.run('copy:backend_files'); }); diff --git a/tasks/default_task.js b/tasks/default_task.js index edf2a38b35a..87a2f711faa 100644 --- a/tasks/default_task.js +++ b/tasks/default_task.js @@ -7,7 +7,7 @@ module.exports = function(grunt) { 'jscs', 'jshint', 'clean:gen', - 'copy:everything_but_ts_and_less', + 'copy:public_to_gen', 'css', 'typescript:build' ]); diff --git a/tasks/options/compress.js b/tasks/options/compress.js index 4dc77ec82f8..99524dfd0cd 100644 --- a/tasks/options/compress.js +++ b/tasks/options/compress.js @@ -9,7 +9,7 @@ module.exports = function(config) { files : [ { expand: true, - cwd: '<%= tempDir %>', + cwd: '<%= destDir %>', src: ['**/*'], dest: '<%= pkg.name %>-<%= pkg.version %>/', }, diff --git a/tasks/options/concat.js b/tasks/options/concat.js index 648d94fdbcc..96ad9ae1341 100644 --- a/tasks/options/concat.js +++ b/tasks/options/concat.js @@ -27,11 +27,11 @@ module.exports = function(config) { js: { src: [ - '<%= destDir %>/vendor/requirejs/require.js', - '<%= destDir %>/app/components/require.config.js', - '<%= destDir %>/app/app.js', + '<%= tempDir %>/vendor/requirejs/require.js', + '<%= tempDir %>/app/components/require.config.js', + '<%= tempDir %>/app/app.js', ], - dest: '<%= destDir %>/app/app.js' + dest: '<%= genDir %>/app/app.js' }, }; }; diff --git a/tasks/options/copy.js b/tasks/options/copy.js index 781042f9921..afd705de92f 100644 --- a/tasks/options/copy.js +++ b/tasks/options/copy.js @@ -8,7 +8,7 @@ module.exports = function(config) { dest: '<%= tempDir %>' }, - everything_but_less: { + public_to_gen: { cwd: '<%= srcDir %>', expand: true, src: ['**/*', '!**/*.less'], diff --git a/tasks/options/cssmin.js b/tasks/options/cssmin.js index b049a383fca..97953af8bc7 100644 --- a/tasks/options/cssmin.js +++ b/tasks/options/cssmin.js @@ -2,9 +2,9 @@ module.exports = function(config) { return { build: { expand: true, - cwd: '<%= tempDir %>', + cwd: '<%= genDir %>', src: '**/*.css', - dest: '<%= tempDir %>' + dest: '<%= genDir %>' } }; -}; \ No newline at end of file +}; diff --git a/tasks/options/filerev.js b/tasks/options/filerev.js index 2571822f807..aa954146518 100644 --- a/tasks/options/filerev.js +++ b/tasks/options/filerev.js @@ -6,16 +6,16 @@ module.exports = function(config) { length: 8, }, cssDark: { - src: '<%= destDir %>/css/grafana.dark.min.css', - dest: '<%= destDir %>/css' + src: '<%= genDir %>/css/grafana.dark.min.css', + dest: '<%= genDir %>/css' }, cssLight: { - src: '<%= destDir %>/css/grafana.light.min.css', - dest: '<%= destDir %>/css' + src: '<%= genDir %>/css/grafana.light.min.css', + dest: '<%= genDir %>/css' }, js: { - src: '<%= destDir %>/app/app.js', - dest: '<%= destDir %>/app' + src: '<%= genDir %>/app/app.js', + dest: '<%= genDir %>/app' } }; }; diff --git a/tasks/options/htmlmin.js b/tasks/options/htmlmin.js index b5d36b89e77..2fa6a769a09 100644 --- a/tasks/options/htmlmin.js +++ b/tasks/options/htmlmin.js @@ -6,13 +6,13 @@ module.exports = function(config) { collapseWhitespace: true }, expand: true, - cwd: '<%= tempDir %>', + cwd: '<%= genDir %>', src: [ //'index.html', 'app/panels/**/*.html', 'app/partials/**/*.html' ], - dest: '<%= tempDir %>' + dest: '<%= genDir %>' } }; -}; \ No newline at end of file +}; diff --git a/tasks/options/ngAnnotate.js b/tasks/options/ngAnnotate.js index 816532096c2..293023c1b5f 100644 --- a/tasks/options/ngAnnotate.js +++ b/tasks/options/ngAnnotate.js @@ -2,7 +2,7 @@ module.exports = function(config) { return { build: { expand: true, - cwd:'<%= tempDir %>', + cwd:'<%= genDir %>', src: [ 'app/controllers/**/*.js', 'app/plugins/**/*.js', @@ -15,7 +15,7 @@ module.exports = function(config) { 'app/app.js', 'vendor/angular/**/*.js', ], - dest: '<%= tempDir %>' + dest: '<%= genDir %>' } }; }; diff --git a/tasks/options/ngtemplates.js b/tasks/options/ngtemplates.js index a20624a5ff9..2ccdf4ce5ef 100644 --- a/tasks/options/ngtemplates.js +++ b/tasks/options/ngtemplates.js @@ -1,9 +1,9 @@ module.exports = function(config) { return { grafana: { - cwd: '<%= tempDir %>', + cwd: '<%= genDir %>', src: ['app/**/*.html'], - dest: '<%= tempDir %>/app/components/partials.js', + dest: '<%= genDir %>/app/components/partials.js', options: { bootstrap: function(module, script) { return "define('components/partials', ['angular'], function(angular) { \n" + diff --git a/tasks/options/requirejs.js b/tasks/options/requirejs.js index 21b22d51c26..a7a9d5b8dda 100644 --- a/tasks/options/requirejs.js +++ b/tasks/options/requirejs.js @@ -4,10 +4,10 @@ module.exports = function(config,grunt) { function buildRequireJsOptions() { var options = { - appDir: '<%= tempDir %>', - dir: '<%= destDir %>', - mainConfigFile: '<%= tempDir %>/app/components/require.config.js', - baseUrl: 'app_gen', + appDir: '<%= genDir %>', + dir: '<%= tempDir %>', + mainConfigFile: '<%= genDir %>/app/components/require.config.js', + baseUrl: 'app', waitSeconds: 0, modules: [], // populated below, @@ -74,7 +74,7 @@ module.exports = function(config,grunt) { ]; var fs = require('fs'); - var panelPath = config.srcDir+'/app/panels'; + var panelPath = config.genDir+'/app/panels'; // create a module for each directory in public/app/panels/ fs.readdirSync(panelPath).forEach(function (panelName) { diff --git a/tasks/options/uglify.js b/tasks/options/uglify.js index 2428331b021..04e892a308a 100644 --- a/tasks/options/uglify.js +++ b/tasks/options/uglify.js @@ -2,9 +2,9 @@ module.exports = function(config) { return { dest: { expand: true, - src: ['**/*.js', '!dashboards/*.js', '!vendor/jquery/**/*.js'], - dest: '<%= destDir %>', - cwd: '<%= destDir %>', + src: ['**/*.js', '!dashboards/*.js', '!vendor/**/*.js'], + dest: '<%= genDir %>', + cwd: '<%= genDir %>', options: { quite: true, compress: {}, diff --git a/tasks/options/usemin.js b/tasks/options/usemin.js index f87a70ea672..a6eefd623b5 100644 --- a/tasks/options/usemin.js +++ b/tasks/options/usemin.js @@ -3,10 +3,11 @@ module.exports = function() { return { html: [ - '<%= destDir %>/views/index.html', + '<%= genDir %>/views/index.html', + '<%= genDir %>/views/500.html', ], options: { - assetsDirs: ['<%= destDir %>'], + assetsDirs: ['<%= genDir %>'], patterns: { css: [ [/(\.css)/, 'Replacing reference to image.png'] diff --git a/tasks/options/useminPrepare.js b/tasks/options/useminPrepare.js deleted file mode 100644 index f4b948a846d..00000000000 --- a/tasks/options/useminPrepare.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = function(config) { - return { - html: [ - 'tmp/index.html', - ] - }; -}; diff --git a/tasks/options/watch.js b/tasks/options/watch.js index 21d3c6ad340..f91c0dc92fd 100644 --- a/tasks/options/watch.js +++ b/tasks/options/watch.js @@ -10,7 +10,7 @@ module.exports = function(config) { copy_to_gen: { files: ['<%= srcDir %>/**/*', '!<%= srcDir %>/**/*.less'], - tasks: ['copy:everything_but_less'], + tasks: ['copy:public_to_gen'], options: { spawn: false }