-
Notifications
You must be signed in to change notification settings - Fork 6
/
Gruntfile.coffee
75 lines (62 loc) · 1.61 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
module.exports = (grunt) ->
_testEnv = {}
if process.env.GLOBAL?
_testEnv.global = 1
# Project configuration.
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
watch:
module:
files: ["_src/**/*.coffee"]
tasks: [ "coffee:base" ]
test:
files: ["_src/**/*.coffee"]
tasks: [ "coffee:base", "mochacli:main" ]
coffee:
base:
expand: true
cwd: '_src',
src: ["**/*.coffee"]
dest: ''
ext: '.js'
clean:
base:
src: [ "lib", "test" ]
includereplace:
pckg:
options:
globals:
version: "<%= pkg.version %>"
prefix: "@@"
suffix: ''
files:
"lib/main.js": ["lib/main.js"]
mochacli:
options:
require: [ "should" ]
reporter: "spec"
bail: false
timeout: 3000
slow: 3
main:
src: [ "test/main.js" ]
options:
env: _testEnv
# Load npm modules
grunt.loadNpmTasks "grunt-contrib-watch"
grunt.loadNpmTasks "grunt-contrib-coffee"
grunt.loadNpmTasks "grunt-contrib-clean"
grunt.loadNpmTasks "grunt-mocha-cli"
grunt.loadNpmTasks "grunt-include-replace"
# just a hack until this issue has been fixed: https://github.com/yeoman/grunt-regarde/issues/3
grunt.option('force', not grunt.option('force'))
# ALIAS TASKS
grunt.registerTask "w", "watch:module"
grunt.registerTask "wt", "watch:test"
grunt.registerTask "b", "build"
grunt.registerTask "t", "test"
grunt.registerTask "default", "build"
grunt.registerTask "clear", [ "clean:base" ]
grunt.registerTask "test", [ "build", "mochacli:main" ]
# build the project
grunt.registerTask "build", [ "clear", "coffee:base", "includereplace" ]