forked from grmble/node-dicom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.coffee
57 lines (46 loc) · 1.32 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
path = require 'path'
srcDir = 'src'
dstDir = 'lib'
tstDir = 'test'
sourceMap = false
srcRe = new RegExp "^#{srcDir}/"
module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-nodeunit'
grunt.initConfig
watch:
coffee:
files: ["#{srcDir}/**/*.coffee", "#{tstDir}/test_*.coffee"]
tasks: ['coffee:watched', 'nodeunit']
options:
spawn: false
coffee:
compile:
expand: true,
cwd: "#{srcDir}/",
src: ['**/*.coffee'],
dest: "#{dstDir}/",
ext: '.js'
options:
sourceMap: sourceMap
watched:
expand: true,
cwd: "#{srcDir}/",
src: ['**/*.coffee'],
dest: "#{dstDir}/",
ext: '.js'
options:
sourceMap: sourceMap
nodeunit:
all: ["#{tstDir}/test_*.coffee"]
grunt.event.on 'watch', (action, filepath) ->
if srcRe.test filepath
coffeeConfig = grunt.config "coffee"
coffeeConfig.watched.src = path.relative(srcDir, filepath)
grunt.config "coffee", coffeeConfig
else
coffeeConfig = grunt.config "coffee"
coffeeConfig.watched.src = []
grunt.config "coffee", coffeeConfig
grunt.registerTask 'default', ['coffee', 'nodeunit', 'watch']