-
Notifications
You must be signed in to change notification settings - Fork 4
/
Gruntfile.coffee
82 lines (72 loc) · 1.96 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
80
81
82
module.exports = ->
# Project configuration
@initConfig
pkg: @file.readJSON 'package.json'
# Generate library from Peg grammar
peg:
parser:
src: 'src/grammar.peg'
dest: 'lib/parser.js'
# Build the browser Component
componentbuild:
'gss-preparser':
options:
name: 'gss-preparser'
src: '.'
dest: 'browser'
scripts: true
styles: false
# JavaScript minification for the browser
uglify:
options:
report: 'min'
'gss-preparser':
files:
'./browser/gss-preparser.min.js': ['./browser/gss-preparser.js']
# Automated recompilation and testing when developing
watch:
build:
files: ['spec/**/*.coffee', 'src/**/*.{coffee,peg}']
tasks: ['build']
test:
files: ['spec/**/*.coffee', 'src/**/*.{coffee,peg}']
tasks: ['test']
# BDD tests on Node.js
cafemocha:
nodejs:
src: ['spec/**/*.coffee']
options:
reporter: 'spec'
# CoffeeScript compilation
coffee:
src:
options:
bare: true
expand: true
cwd: 'src'
src: ['**/*.coffee']
dest: 'lib'
ext: '.js'
spec:
options:
bare: true
expand: true
cwd: 'spec'
src: ['**/*.coffee']
dest: 'spec'
ext: '.js'
# BDD tests on browser
mocha_phantomjs:
all: ['spec/runner.html']
# Grunt plugins used for building
@loadNpmTasks 'grunt-peg'
@loadNpmTasks 'grunt-component-build'
@loadNpmTasks 'grunt-contrib-uglify'
# Grunt plugins used for testing
@loadNpmTasks 'grunt-cafe-mocha'
@loadNpmTasks 'grunt-contrib-coffee'
@loadNpmTasks 'grunt-mocha-phantomjs'
@loadNpmTasks 'grunt-contrib-watch'
@registerTask 'build', ['coffee:src', 'peg', 'componentbuild', 'uglify']
@registerTask 'test', ['build', 'coffee:spec', 'cafemocha', 'mocha_phantomjs']
@registerTask 'default', ['build']