-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathGruntfile.js
102 lines (98 loc) · 2.5 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
module.exports = function(grunt) {
grunt.initConfig({
gitclone: {
'speech-rule-engine': {
options: {
repository: 'https://github.com/zorkow/speech-rule-engine.git',
branch: 'v3.1.0',
cwd: '.'
}
}
},
'uglify': {
build: {
files: {
'dist/accessibility-menu.js': 'extensions/accessibility-menu.js',
'dist/explorer.js': 'extensions/explorer.js',
'dist/auto-collapse.js': 'extensions/auto-collapse.js',
'dist/collapsible.js': 'extensions/collapsible.js',
'dist/semantic-enrich.js': 'extensions/semantic-enrich.js'
},
options: {
beautify: {
ascii_only: true
}
}
}
},
shell: {
clean_dist: {
command: 'rm -rf dist'
},
make_dist: {
command: 'mkdir -p dist'
},
clean_sre: {
command: 'rm -rf speech-rule-engine'
},
clean_node: {
command: 'rm -rf node_modules'
},
patch_makefile: {
command: "sed -i '' \"s/@sed -i s/@sed -i '' s/\" Makefile",
options: {
execOptions: {
cwd: 'speech-rule-engine'
}
}
},
prepare: {
command: [
'<%= shell.clean_dist.command %>',
'<%= shell.make_dist.command %>',
].join('&&')
},
clean: {
command: [
'<%= shell.clean_node.command %>',
'<%= shell.clean_sre.command %>',
'<%= shell.clean_dist.command %>'
].join('&&')
},
compile: {
command: [
'npm install',
'make mathjax',
'make iemaps'
].join('&&'),
options: {
execOptions: {
cwd: 'speech-rule-engine'
}
}
},
copy: [
'cp speech-rule-engine/lib/mathjax-sre.js dist/mathjax-sre.js',
'cp speech-rule-engine/node_modules/wicked-good-xpath/dist/wgxpath.install.js dist/',
'cp -R speech-rule-engine/lib/mathmaps dist/',
'cp extensions/*.ogg dist/',
'cp extensions/*.mp3 dist/'
].join('&&')
}
});
// Cloning git repos.
grunt.loadNpmTasks('grunt-git');
// Run shell commands.
grunt.loadNpmTasks('grunt-shell');
// Minify regular files.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', [
'shell:prepare',
'gitclone',
'shell:patch_makefile',
'shell:compile',
'shell:copy',
'uglify',
'shell:clean_sre'
]);
};