-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
113 lines (98 loc) · 2.95 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
module.exports = (grunt) ->
pkg = grunt.file.readJSON('package.json')
require('matchdep').filterDev(['grunt-*', '!grunt-cli']).forEach(grunt.loadNpmTasks)
grunt.initConfig
pkg: pkg
meta:
banner: '/*!\n * <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
' * <%= pkg.homepage %>\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %> ' +
'<%= pkg.author.name %> <<%= pkg.author.url %>>\n */\n'
clean:
options:
force: true
build:
src: ['<%= pkg.directories.build %>/*']
tests:
src: ['<%= pkg.directories.test %>/**/*.js']
coffee:
lib:
options:
join: true
bare: false
files:
'<%= pkg.directories.build %>/<%= pkg.name %>.js': [
'<%= pkg.directories.lib %>/utils.coffee'
'<%= pkg.directories.lib %>/w3ap.coffee'
'<%= pkg.directories.lib %>/parser.coffee'
'<%= pkg.directories.lib %>/expose.coffee'
]
tests:
expand: true
options:
bare: true
flatten: false
cwd: pkg.directories.test
src: '**/*.coffee'
dest: pkg.directories.test
ext: '.js'
concat:
lib:
options:
banner: '<%= meta.banner %>'
process: true
src: '<%= pkg.directories.build %>/<%= pkg.name %>.js'
dest: '<%= pkg.directories.build %>/<%= pkg.name %>.js'
coffeelint:
lib: '<%= pkg.directories.lib %>/**/*.coffee'
options:
line_endings: level: 'error'
no_backticks: level: 'error'
space_operators: level: 'error'
no_implicit_braces: level: 'error'
no_implicit_parens: level: 'error'
no_empty_param_list: level: 'error'
camel_case_classes: level: 'ignore'
max_line_length: level: 'ignore'
uglify:
options:
banner: '<%= meta.banner %>'
lib:
files: [
{
expand: true
cwd: pkg.directories.build
src: '*.js'
ext: '-min.js'
dest: pkg.directories.build
}
]
jasmine:
tests:
src: '<%= pkg.directories.build %>/<%= pkg.name %>.js'
options:
keepRunner: true
outfile: '<%= pkg.directories.test %>/SpecRunner.html'
vendor: [
'components/underscore/underscore.js'
]
specs: '<%= pkg.directories.test %>/tests/*Spec.js'
helpers: [
'<%= pkg.directories.test %>/helpers/*.js',
'components/jasmine-matchers/dist/jasmine-matchers.js',
'components/sinonjs/sinon.js',
'components/jasmine-sinon/lib/jasmine-sinon.js'
]
grunt.registerTask('default', [
'coffeelint:lib'
'clean:build'
'coffee:lib'
'concat:lib'
'uglify:lib'
])
grunt.registerTask('test', [
'clean:tests'
'coffee:tests'
'jasmine:tests'
])