-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathGruntfile.coffee
79 lines (70 loc) · 3.04 KB
/
Gruntfile.coffee
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
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
files:
src: [
'src/vamonos.coffee'
'src/data-structure/*'
'src/*.coffee'
'src/**/*.coffee'
]
dest: 'lib/<%= pkg.name %>.js'
options:
join: true
less:
vamonos:
files:
'lib/<%= pkg.name %>-demos.css' : 'src/less/vamonos-demos.less'
'lib/<%= pkg.name %>.css' : 'src/less/vamonos.less'
watch:
files: ['src/**/*']
tasks: ['coffee', 'less', 'shell:concat', 'shell:docs']
shell:
header:
command: "cat header.js lib/vamonos.js > temp; mv temp lib/vamonos.js"
docs:
command: 'coffee tools/docgen.coffee'
options: { stderr: true, stdout: true }
concat:
command: "cat header-all.js deps/jquery.min.js deps/jquery-ui.min.js " +
"deps/jquery-qtip.min.js " +
"deps/jquery.ui.touch-punch.js lib/vamonos.js " +
"deps/d3.min.js " +
"> lib/vamonos-all.js"
options: { stderr: true, stdout: true }
zip:
command: """
mkdir -p lib/vamonos
cat generic-readme.txt dist-readme.txt > lib/vamonos/readme.txt
cd lib
cp vamonos.js vamonos-all.js vamonos.css vamonos
cp -r ../deps vamonos
zip -r vamonos.zip vamonos
rm -r vamonos
[ ! -e '../dist' ] && mkdir ../dist
mv vamonos.zip ../dist
echo created file dist/vamonos.zip
"""
options: { stderr: true, stdout: true }
demos:
command: """
mkdir -p lib/vamonos-demos
cat generic-readme.txt demos-readme.txt > lib/vamonos-demos/readme.txt
for DEMO in demos/*
do tools/inline.pl $DEMO > lib/vamonos-demos/$(basename $DEMO)
done
cd lib
zip -r vamonos-demos.zip vamonos-demos
rm -r vamonos-demos
[ ! -e '../dist' ] && mkdir ../dist
mv vamonos-demos.zip ../dist
echo created file dist/vamonos.zip
"""
options: { stderr: true, stdout: true }
grunt.loadNpmTasks('grunt-contrib-coffee')
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-contrib-less')
grunt.loadNpmTasks('grunt-shell')
grunt.registerTask('default', ['coffee', 'less', 'shell:header', 'shell:docs', 'shell:concat'])
grunt.registerTask('release', ['coffee','less', 'shell:header', 'shell:concat','shell:zip', 'shell:demos'])