forked from conversejs/converse.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
91 lines (86 loc) · 3.26 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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 <[email protected]> \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',
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;
var callback = 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();
};
exec('./node_modules/requirejs/bin/r.js -o src/build.js && ' +
'./node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js && ' +
'./node_modules/requirejs/bin/r.js -o src/build-no-otr.js', callback);
});
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');
});
};