-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathGruntfile.coffee
132 lines (118 loc) · 3.29 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffeelint:
options:
arrow_spacing: level: 'error'
empty_constructor_needs_parens: level: 'error'
non_empty_constructor_needs_parens: level: 'error'
no_trailing_whitespace: level: 'error'
no_empty_param_list: level: 'error'
no_stand_alone_at: level: 'error'
no_backticks: level: 'ignore'
no_implicit_braces: level: 'ignore'
space_operators: level: 'error'
all:
src: [
'src/**/*.coffee'
'test/**/*.coffee'
]
coffee_build:
options:
globalAliases: ['Vm']
src: 'src/**/*.coffee'
main: 'src/index.coffee'
browser:
options:
dest: 'build/browser/vm.js'
browser_test:
options:
src: 'test/**/*.coffee'
dest: 'build/browser/test.js'
nodejs:
options:
src: ['src/**/*.coffee', 'test/**/*.coffee']
dest: 'build/nodejs'
uglify:
browser_dist:
options:
sourceMap: 'build/browser/vm.min.js.map'
sourceMapIn: 'build/browser/vm.js.map'
files:
'build/browser/vm.min.js': ['build/browser/vm.js']
mocha_debug:
options:
reporter: 'dot'
check: ['src/**/*.coffee', 'test/**/*.coffee']
nodejs:
options:
src: [
'build/self.js'
'test/node_init.js'
'build/nodejs/**/*.js'
]
browser:
options:
phantomjs: true
listenAddress: '0.0.0.0'
listenPort: 8000
src: [
'build/self.js'
'node_modules/expect.js/expect.js'
'build/browser/test.js'
]
watch:
options:
nospawn: true
all:
files: [
'src/**/*.coffee'
'test/**/*.coffee'
]
tasks: [
'coffeelint'
'coffee_build'
'livereload'
'mocha_debug'
]
clean:
all: ['build']
nodejs: ['build/nodejs']
browser: ['build/browser']
self: ['build/self.js']
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-livereload'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-coffeelint'
grunt.loadNpmTasks 'grunt-coffee-build'
grunt.loadNpmTasks 'grunt-mocha-debug'
grunt.loadNpmTasks 'grunt-release'
grunt.registerTask 'self_load', ->
code = grunt.file.read('./build/browser/vm.js')
assign = "vmjs = #{JSON.stringify(code)}"
grunt.file.write('./build/self.js', assign)
grunt.registerTask 'test', ['mocha_debug']
grunt.registerTask 'rebuild', [
'clean:all'
'coffeelint'
'coffee_build'
'self_load'
'mocha_debug'
'clean:self'
'uglify'
]
grunt.registerTask 'debug', [
'livereload-start'
'coffeelint'
'coffee_build'
'self_load'
'mocha_debug'
'watch'
]
grunt.registerTask 'publish', ['rebuild', 'release']
grunt.registerTask 'default', [ 'debug' ]
grunt.event.on 'watch', (action, filepath) ->
grunt.config('coffeelint.all.src', filepath)
if /\.coffee$/.test filepath
grunt.regarde = changed: ['test.js']