-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.coffee
82 lines (67 loc) · 1.98 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 = (grunt) ->
# Project configuration.
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
regarde:
module:
files: ["_src/**/*.coffee"]
tasks: [ "coffee:changed" ]
coffee:
changed:
expand: true
cwd: '_src'
src: [ '<% print( _.first( ((typeof grunt !== "undefined" && grunt !== null ? (_ref = grunt.regarde) != null ? _ref.changed : void 0 : void 0) || ["_src/nothing"]) ).slice( "_src/".length ) ) %>' ]
# template to cut off `_src/` and throw on error on non-regrade call
# CF: `_.first( grunt?.regarde?.changed or [ "_src/nothing" ] ).slice( "_src/".length )
dest: ''
ext: '.js'
base:
expand: true
cwd: '_src',
src: ["**/*.coffee"]
dest: ''
ext: '.js'
clean:
base:
src: [ "lib", "test/*.js" ]
copy:
base:
expand: true
cwd: '_src'
src: "lib/soyer/*.js"
dest:""
includereplace:
pckg:
options:
globals:
version: "<%= pkg.version %>"
prefix: "@@"
suffix: ''
files:
"lib/soyer/index.js": ["lib/soyer/index.js"]
mochacli:
options:
require: [ "should" ]
reporter: "spec"
bail: false
timeout: 3000
slow: 20
main:
src: [ "test/main.js" ]
# Load npm modules
grunt.loadNpmTasks "grunt-regarde"
grunt.loadNpmTasks "grunt-contrib-coffee"
grunt.loadNpmTasks "grunt-contrib-clean"
grunt.loadNpmTasks "grunt-contrib-copy"
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 "watch", "regarde"
grunt.registerTask "default", "build"
grunt.registerTask "clear", [ "clean:base" ]
grunt.registerTask "test", [ "build", "mochacli:main" ]
# build the project
grunt.registerTask "build", [ "clear", "coffee:base", "copy:base", "includereplace" ]
grunt.registerTask "build-dev", [ "clear", "coffee:base", "test" ]