xmpp.chapril.org-conversejs/Gruntfile.js
JC Brand 3670ba57e8 Don't use the requirejs task, it doesn't support almond.
Instead we build manually. Fixed paths in build.js
2013-10-05 08:47:49 +02:00

90 lines
3.1 KiB
JavaScript

module.exports = function(grunt) {
var cfg = require('./package.json');
grunt.initConfig({
jshint: {
options: {
trailing: true
},
target: {
src : [
'converse.js',
'mock.js',
'main.js',
'tests_main.js',
'spec/*.js'
]
}
},
cssmin: {
options: {
banner: "/*"+
"* Converse.js (Web-based XMPP instant messaging client) \n"+
"* http://conversejs.org \n"+
"* Copyright (c) 2012, Jan-Carel Brand <jc@opkode.com> \n"+
"* Dual licensed under the MIT and GPL Licenses \n"+
"*/"
},
minify: {
dest: 'converse.min.css',
src: ['converse.css']
}
}
});
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.registerTask('test', 'Run Tests', function () {
var done = this.async();
var child_process = require('child_process');
var exec = child_process.exec;
exec('./node_modules/.bin/phantomjs '+
'node_modules/jasmine-reporters/test/phantomjs-testrunner.js '+
__dirname+'/tests.html',
function (err, stdout, stderr) {
if (err) {
grunt.log.write('Tests failed with error code '+err.code);
grunt.log.write(stderr);
}
grunt.log.write(stdout);
done();
});
});
grunt.registerTask('fetch', 'Set up the development environment', function () {
var done = this.async();
var child_process = require('child_process');
var exec = child_process.exec;
exec('./node_modules/.bin/bower update && cd ./components/strophe && make normal && cd ../otr && npm install && make build',
function (err, stdout, stderr) {
if (err) {
grunt.log.write('build failed with error code '+err.code);
grunt.log.write(stderr);
}
grunt.log.write(stdout);
done();
});
});
grunt.registerTask('jsmin', 'Create a new release', function () {
var done = this.async();
var child_process = require('child_process');
var exec = child_process.exec;
exec('./node_modules/requirejs/bin/r.js -o build.js',
function (err, stdout, stderr) {
if (err) {
grunt.log.write('build failed with error code '+err.code);
grunt.log.write(stderr);
}
grunt.log.write(stdout);
done();
});
});
grunt.registerTask('minify', 'Create a new release', ['cssmin', 'jsmin']);
grunt.registerTask('check', 'Perform all checks (e.g. before releasing)', function () {
grunt.task.run('jshint', 'test');
});
};