Commit 31c010c5 by spenceralger

Merge pull request #514 from spenceralger/gruntfile-cleanup

Cleaned up the Grunt config a bit, removed an unneeded dep
parents c767ae66 412cefed
......@@ -170,6 +170,9 @@ module.exports = function (grunt) {
},
s3: {
dist: {
bucket: 'download.elasticsearch.org',
access: 'private',
// debug: true, // uncommment to prevent actual upload
upload: [
{
src: '<%= tempDir %>/dist.zip',
......@@ -180,71 +183,56 @@ module.exports = function (grunt) {
}
};
var fs = require('fs');
var requireModules = [
// setup the modules require will build
var requireModules = config.requirejs.compile_temp.options.modules = [
{
// main/common module
name: 'app',
include: [
'css',
'kbn',
'text',
'jquery',
'underscore',
'angular',
'settings',
'bootstrap',
'modernizr',
'jquery',
'angular-sanitize',
'elasticjs',
'timepicker',
'datepicker',
'elasticjs',
'angular-strap',
'directives/all',
'underscore',
'filters/all',
'services/all',
'jquery.flot',
'services/all',
'angular-strap',
'directives/all',
'jquery.flot.pie',
'text',
'settings'
'angular-sanitize'
]
}
];
// create a module for each directory in src/app/panels/
fs.readdirSync(config.srcDir+'/app/panels').forEach(function (panelName) {
requireModules.push({
name: 'panels/'+panelName+'/module',
exclude: ['app']
require('fs')
.readdirSync(config.srcDir+'/app/panels')
.forEach(function (panelName) {
requireModules.push({
name: 'panels/'+panelName+'/module',
exclude: ['app']
});
});
});
// exclude the literal config definition from all modules
requireModules.forEach(function (module) {
module.excludeShallow = module.excludeShallow || [];
module.excludeShallow.push('config');
});
config.requirejs.compile_temp.options.modules = requireModules;
// load plugins
grunt.loadNpmTasks('grunt-s3');
grunt.loadNpmTasks('grunt-zip');
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');
requireModules
.forEach(function (module) {
module.excludeShallow = module.excludeShallow || [];
module.excludeShallow.push('config');
});
// Project configuration.
grunt.initConfig(config);
// Run jshint
grunt.registerTask('default', ['jshint:source', 'less:src']);
// Default task.
grunt.registerTask('default', ['jshint:source','less:src']);
// Concat and Minify the src directory into dist
grunt.registerTask('build', [
'jshint:source',
'clean:on_start',
......@@ -255,29 +243,12 @@ module.exports = function (grunt) {
'ngmin',
'requirejs:compile_temp',
'clean:temp',
'write_revision_to_dest', // runs git-describe and replace:config
'build:write_revision',
'uglify:dest'
]);
grunt.registerTask('distribute', [
'load_s3_config',
'build',
'zip:dist',
's3:dist',
'clean:temp'
]);
grunt.registerTask('load_s3_config', function () {
var config = grunt.file.readJSON('.aws-config.json');
grunt.config('s3.options', {
key: config.key,
secret: config.secret,
bucket: 'download.elasticsearch.org',
access: 'private'
});
});
grunt.registerTask('write_revision_to_dest', function() {
// run a string replacement on the require config, using the latest revision number as the cache buster
grunt.registerTask('build:write_revision', function() {
grunt.event.once('git-describe', function (desc) {
grunt.config('string-replace.config', {
src: '<%= destDir %>/app/components/require.config.js',
......@@ -297,4 +268,40 @@ module.exports = function (grunt) {
grunt.task.run('git-describe');
});
// build, then zip and upload to s3
grunt.registerTask('distribute', [
'distribute:load_s3_config',
'build',
'zip:dist',
's3:dist',
'clean:temp'
]);
// collect the key and secret from the .aws-config.json file, finish configuring the s3 task
grunt.registerTask('distribute:load_s3_config', function () {
var config = grunt.file.readJSON('.aws-config.json');
grunt.config('s3.options', {
key: config.key,
secret: config.secret
});
});
// load plugins
grunt.loadNpmTasks('grunt-s3');
grunt.loadNpmTasks('grunt-zip');
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');
// pass the config to grunt
grunt.initConfig(config);
};
\ No newline at end of file
......@@ -6,24 +6,24 @@
"name": "kibana",
"version": "3.0.0m3pre",
"devDependencies": {
"rjs-build-analysis": "0.0.3",
"grunt": "~0.4.0",
"grunt-s3": "~0.2.0-alpha.2",
"grunt-zip": "~0.9.2",
"grunt-ngmin": "0.0.3",
"grunt-contrib": "~0.7.0",
"grunt-contrib-jshint": "~0.6.0",
"grunt-contrib-less": "~0.7.0",
"grunt-contrib-requirejs": "~0.4.1",
"grunt-ngmin": "0.0.3",
"cssmin": "~0.4.1",
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-cssmin": "~0.6.1",
"grunt-git-describe": "~2.3.2",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-cssmin": "~0.6.1",
"grunt-contrib-uglify": "~0.2.4",
"rjs-build-analysis": "0.0.3",
"grunt-angular-templates": "~0.3.12",
"grunt-contrib-jshint": "~0.6.0",
"grunt-string-replace": "~0.2.4",
"grunt-git-describe": "~2.3.2",
"grunt-zip": "~0.9.2",
"grunt-s3": "~0.2.0-alpha.2"
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-contrib-requirejs": "~0.4.1",
"grunt-angular-templates": "~0.3.12"
},
"license": "Apache License"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment