This repository has been archived by the owner on Nov 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.coffee
145 lines (127 loc) · 3.25 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
133
134
135
136
137
138
139
140
141
142
143
144
145
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
# Clean
clean:
lib:
src: ['temp/lib']
test:
src: ['temp/specs', 'temp/fixtures']
# Lint
jshint:
options:
curly : true
eqeqeq : true
immed : true
latedef: true
newcap : true
noarg : true
sub : true
undef : true
boss : true
eqnull : true
globals:
exports : true
module : false
define : false
describe : false
xdescribe : false
it : false
xit : false
beforeEach: false
afterEach : false
expect : false
spyOn : false
uses_defaults: [
'grunt.js'
'lib/scripts/**/*.js'
'test/specs/**/*.js'
'test/fixtures/**/*.js'
]
coffeelint:
files: [
'lib/scripts/**/*.coffee'
'test/specs/**/*.coffee'
'test/fixtures/**/*.coffee'
]
# Compile
coffee:
options:
bare: true
lib:
expand: true
cwd : 'lib/scripts'
src : ['**/*.coffee']
dest : 'temp/lib/scripts'
ext : '.js'
test:
expand: true
cwd : 'test/specs'
src : ['**/*.coffee']
dest : 'temp/specs'
ext : '.spec.js'
fixtures:
expand: true
cwd : 'test/fixtures'
src : ['**/*.coffee']
dest : 'temp/fixtures'
ext : '.js'
# Copy
copy:
lib:
files: [
(
expand: true
cwd : 'lib/scripts/'
src : '**/*.!(coffee)'
dest : 'temp/lib/scripts/'
)
]
dist:
files: [
(
expand: true
cwd : 'temp/lib/scripts/'
src : 'glue.js'
dest : 'dist/'
)
]
# Watch
# Only watching frequently changed files. When non-frequent changes
# are made, tasks must be run manually.
watch:
code:
files: ['<%= coffeelint.files %>', '<%= jshint.uses_defaults %>']
tasks: [
'jshint', 'coffeelint', 'coffee:lib', 'copy:lib',
'coffee:test', 'coffee:fixtures', 'test']
# Tests
mocha:
all:
src : ['test/**/*.html']
options:
bail: true
bump:
options:
files: ['package.json', 'bower.json']
commit: true
commitMessage: 'Release v%VERSION%'
commitFiles: ['package.json', 'bower.json']
createTag: true
tagName: 'v%VERSION%'
push: true
pushTo: 'origin'
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d'
# Aliasing 'mocha' task
grunt.registerTask 'test', 'mocha'
# Local task to set up lib environment ready for testing
grunt.registerTask 'lib', [
'clean:lib', 'jshint', 'coffeelint',
'copy:lib', 'coffee:lib', 'coffee:test', 'coffee:fixtures']
# Distribution task
grunt.registerTask 'dist', ['lib', 'copy:dist']
# Loading plugins
grunt.loadNpmTasks 'grunt-contrib'
grunt.loadNpmTasks 'grunt-coffeelint'
grunt.loadNpmTasks 'grunt-mocha'
grunt.loadNpmTasks 'grunt-bump'