-
Notifications
You must be signed in to change notification settings - Fork 105
/
Gruntfile.coffee
164 lines (148 loc) · 4.12 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
module.exports = ->
# Project configuration
@initConfig
pkg: @file.readJSON 'package.json'
clean:
dist:
src: ['dist/**/*.js']
spec:
src: ['spec/js/**/*.js']
browserify:
options:
transform: ['coffeeify']
browserifyOptions:
extensions: ['.coffee']
fullPaths: false
dist:
files: [{
expand: true
cwd: 'bundles'
src: '**/*.coffee'
dest: 'dist'
ext: '.js'
extDot: 'last'
}]
spec:
files:
'spec/js/specs.js': ['spec/specs.coffee']
# Automated recompilation and testing when developing
watch:
spec:
files: ['spec/**/*.coffee']
tasks: ['browserify:spec']
src:
files: ['src/**/*.coffee']
tasks: ['browserify:dist']
# JavaScript minification for the browser
uglify:
options:
report: 'min'
dist:
files: [{
expand: true
cwd: 'dist'
src: '**/*.js'
dest: 'dist'
ext: '.min.js'
extDot: 'last'
}]
# Adding version information to the generated files
banner: '/* <%= pkg.name %> - version <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>) - http://gridstylesheets.org */'
usebanner:
dist:
options:
position: 'top'
banner: '<%= banner %>'
files:
src: ['dist/**/*.js']
# Syntax checking
coffeelint:
options:
'max_line_length':
level: 'ignore'
'no_trailing_whitespace':
level: 'ignore'
'no_backticks':
level: 'ignore'
bundle:
files:
src: ['src/**/*.coffee']
src:
files:
src: ['src/**/*.coffee']
spec:
files:
src: ['spec/*.coffee']
docco:
src:
src: ['src/**/*.coffee']
options:
output: 'docs/'
css: 'vendor/docs.css'
# Cross-browser testing
connect:
server:
options:
base: ''
port: 9999
# BDD tests on browser
mocha_phantomjs:
all:
options:
reporter: 'node_modules/mocha/lib/reporters/spec.js'
urls: ['http://127.0.0.1:9999/spec/runner.html']
'saucelabs-mocha':
all:
options:
urls: ['http://127.0.0.1:9999/spec/runner.html']
browsers: [
browserName: 'googlechrome'
platform: 'OS X 10.8'
version: '37'
,
browserName: 'firefox'
platform: 'Windows 7',
version: '33'
,
browserName: 'safari'
platform: 'OS X 10.9'
version: '7'
#,
# browserName: 'internet explorer'
# platform: 'Windows 8.1',
# version: '11'
,
browserName: 'internet explorer'
version: '10'
,
browserName: 'internet explorer'
version: '9'
,
browserName: 'iPhone'
platform: "OS X 10.10"
version: '8.0'
,
browserName: "android"
]
build: process.env.TRAVIS_JOB_ID
testname: 'GSS browser tests'
tunnelTimeout: 20
concurrency: 6
# Grunt plugins used for building
@loadNpmTasks 'grunt-browserify'
@loadNpmTasks 'grunt-contrib-uglify'
@loadNpmTasks 'grunt-contrib-clean'
@loadNpmTasks 'grunt-docco'
@loadNpmTasks 'grunt-banner'
# Grunt plugins used for testing
@loadNpmTasks 'grunt-coffeelint'
@loadNpmTasks 'grunt-mocha-phantomjs'
@loadNpmTasks 'grunt-contrib-watch'
# Cross-browser testing in the cloud
@loadNpmTasks 'grunt-contrib-connect'
@loadNpmTasks 'grunt-saucelabs'
@registerTask 'build', ['coffeelint:src', 'coffeelint:bundle', 'clean:dist', 'browserify:dist', 'uglify:dist', 'usebanner:dist']
@registerTask 'test', ['coffeelint:spec', 'clean:spec', 'browserify:spec', 'build', 'phantom']
@registerTask 'phantom', ['connect', 'mocha_phantomjs']
@registerTask 'crossbrowser', ['test', 'saucelabs-mocha']
@registerTask 'default', ['test']