-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
105 lines (99 loc) · 2.71 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
var os = require('os');
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
bower: {
install: {
options: {
copy: false
}
}
},
uglify: {
build: {
src: 'lib/supernode.bundle.js',
dest: 'lib/supernode.bundle.min.js'
}
},
browserify: {
dist: {
files: {
'lib/supernode.bundle.js': ['src/main.coffee'],
},
options: {
transform: ['coffeeify'],
browserifyOptions: {
extensions: ['.coffee']
},
bundleOptions: {
standalone: 'ufo'
}
}
}
},
mochaTest: {
test: {
options: {
require: 'coffee-script/register',
reporter: 'spec'
},
src: ['test/*.coffee']
}
},
watch: {
test: {
files: ['test/*.coffee', 'src/*.coffee'],
tasks: 'mochaTest'
}
},
shell: {
copyStack: {
command: function() {
return 'cp lib/supernode.bundle.min.js chrome/ufo-app/';
}
},
copyAppHTML: {
command: function() {
return 'cp pages/app.html chrome/ufo-app/app.html';
}
},
runchrome: {
command: function() {
var chrome = null;
var currentOS = os.type();
if(currentOS=='Darwin')
chrome = '/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome';
return chrome + ' --load-and-launch-app=chrome/ufo-app'
+ ' --user-data-dir=/tmp/testufo';
}
}
},
karma: {
unit: {
configFile: 'integration-test/karma.conf.js'
}
},
clean: [
'lib/',
'node_modules/',
'chrome/ufo-app/supernode.bundle.min.js',
'chrome/ufo-app/app.html'
]
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-bower-task');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-karma');
grunt.registerTask('installDeps', ['bower:install']);
grunt.registerTask('develop', ['installDeps', 'watch:test']);
grunt.registerTask('unit-test', ['mochaTest']);
grunt.registerTask('compile', ['installDeps', 'browserify', 'uglify']);
grunt.registerTask('bundle', ['compile', 'shell:copyStack', 'shell:copyAppHTML']);
grunt.registerTask('integration-test', ['bundle', 'karma']);
grunt.registerTask('run-chrome', ['unit-test', 'integration-test', 'shell:runchrome']);
grunt.registerTask('default', ['bundle']);
};