-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.coffee
80 lines (60 loc) · 1.6 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
module.exports = (grunt) ->
require('load-grunt-tasks')(grunt)
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
coffee:
build:
expand: yes
cwd: 'src/'
src: '**/*.coffee'
dest: 'lib/'
ext: '.js'
copy:
build:
expand: yes
cwd: 'src/'
src: '**/*.js'
dest: 'lib/'
ext: '.js'
coffeelint:
build:
files: src: ['src/**/*.coffee', 'test/**/*.coffee']
options:
no_tabs: level: 'ignore' # this is tab land, boy
indentation: value: 1 # single tabs
mochaTest:
test:
options:
reporter: 'spec'
require: ['coffee-script/register']
src: ['test/**/*.test.{js,coffee}']
watch:
dev:
files: ['src/**/*.{js,coffee}', 'test/**/*.{js,coffee}']
tasks: ['lint', 'test']
test:
files: ['src/**/*.{js,coffee}', 'test/**/*.{js,coffee}']
tasks: ['test']
lint:
files: ['src/**/*.{js,coffee}', 'test/**/*.{js,coffee}']
tasks: ['lint']
grunt.registerTask 'nearley', 'Invoke nearley to compile grammars', (fin, fout) ->
path = require 'path'
done = @async()
cmd = if process.platform is 'win32' then 'nearleyc.cmd' else 'nearleyc'
grunt.util.spawn
cmd: path.resolve __dirname, 'node_modules', '.bin', cmd
args: [fin, '--out', fout]
, done
grunt.registerTask 'default', ['lint', 'test', 'build']
grunt.registerTask 'dev', ['lint', 'test']
grunt.registerTask 'lint', [
'coffeelint:build'
]
grunt.registerTask 'test', ['mochaTest:test']
grunt.registerTask 'build', [
'coffee:build'
'grammar'
'copy:build'
]
grunt.registerTask 'grammar', ['nearley:src/grammar.ne:src/grammar.js']