forked from machty/emblem.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
138 lines (115 loc) · 3.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
module.exports = (grunt) ->
require('matchdep').filterDev('grunt-*')
.filter((n) -> n != 'grunt-cli')
.forEach(grunt.loadNpmTasks);
browsers = [
browserName: "firefox",
version: "19",
platform: "XP"
,
browserName: "chrome",
platform: "XP"
,
browserName: "chrome",
platform: "linux"
,
browserName: "internet explorer",
platform: "WIN8",
version: "10"
,
browserName: "internet explorer",
platform: "VISTA",
version: "9"
,
browserName: "opera",
platform: "Windows 2008",
version: "12"
]
# Project configuration.
grunt.initConfig
clean: ["tmp", "dist"]
coffee:
lib:
files: [
expand: true
cwd: 'src/'
src: ['**/*.coffee']
dest: 'lib/'
ext: '.js'
]
test:
files:
'test/qunit_spec.js': 'test/qunit_spec.coffee'
options:
bare: true
peg:
grammar:
src: "src/grammar.pegjs"
dest: "tmp/grammar.js"
options:
exportVar: 'Emblem.Parser'
concat:
grammar:
src: "tmp/grammar.js"
dest: "lib/parser.js"
options:
banner: "var Emblem = require('./emblem');\n\n"
footer: "\n\nmodule.exports = Emblem.Parser;\n"
browserify:
dist:
files:
'dist/emblem.js': 'lib/emblem.js'
uglify:
dist:
files:
'dist/emblem.min.js': 'dist/emblem.js'
options:
beautify:
# Special unicode IN/DEDENT tokens get clobbered unless this is set.
ascii_only : true
qunit:
all: ['test/**/*.html']
simplemocha:
all:
src: ['test/**/*.js']
options:
ui: 'qunit'
connect:
server:
options:
base: ""
port: 9999
middleware: (connect, options) ->
[
require('connect-redirection')(),
((req, res, next) ->
if (req.url == '/')
res.redirect('/test')
else
next()
),
connect.static(options.base)
]
watch: {}
open:
dev:
path: 'http://127.0.0.1:9999/',
app: 'Google Chrome'
'saucelabs-qunit':
all:
options:
urls: ["http://127.0.0.1:9999/test/index.html"]
tunnelTimeout: 5
build: process.env.TRAVIS_JOB_ID
concurrency: 3
browsers: browsers
testname: "qunit tests"
tags: ["master"]
grunt.registerTask 'dev', ['connect', 'open:dev', 'watch']
grunt.registerTask 'compileParser', 'Compile PegJS grammar file',
['peg', 'concat:grammar']
grunt.registerTask 'build', ['clean', 'compileParser', 'coffee:lib', 'browserify', 'uglify']
grunt.registerTask 'test', ['coffee:test', 'qunit', 'simplemocha', 'saucelabs']
grunt.registerTask 'saucelabs', ['connect', 'saucelabs-qunit']
# Default task is to build and test.
grunt.registerTask 'default', ['build', 'test']