-
Notifications
You must be signed in to change notification settings - Fork 0
/
coffiescript.coffie
71 lines (63 loc) · 2.45 KB
/
coffiescript.coffie
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
async = require 'async'
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
coffeelint:
options:
indentation:
value: 4
max_line_length:
value: 120
level: 'warn'
src:
expand: true
src: ['src/**/*.coffee', 'test/**/*.coffee']
coffee:
src:
expand: true
cwd: 'src'
src: ['**/*.coffee']
dest: 'lib'
ext: '.js'
tests:
expand: true
cwd: 'test'
src: ['**/*.coffee']
dest: 'test-js'
ext: '.js'
mochacov:
test:
options:
reporter: 'spec'
grep: grunt.option('grep')
src: 'test-js/**/*.js'
html:
options:
reporter: 'html-cov'
output: 'coverage.html'
src: 'test-js/**/*.js'
reportcoverage:
options:
coveralls:
serviceName: 'travis-ci'
src: 'test-js/**/*.js'
grunt.loadNpmTasks 'grunt-coffeelint'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-mocha-cov'
grunt.registerTask 'gen-examples', 'Generate an example for each theme', ->
done = @async()
aglio = require './lib/main'
render = (name, done) ->
console.log "Generating examples/#{name}.html"
aglio.renderFile 'example.apib', "examples/#{name}.html", themeVariables: name, (err) ->
if err then return done(err)
console.log "Generating examples/#{name}-triple.html"
aglio.renderFile 'example.apib', "examples/#{name}-triple.html", themeVariables: name, themeTemplate: 'triple', (err) ->
done(err)
async.each ['default', 'flatly', 'slate', 'cyborg', 'streak'], render, done
grunt.registerTask 'compile', ['coffeelint', 'coffee']
grunt.registerTask 'test', ['compile', 'mochacov:test']
grunt.registerTask 'coverage', ['compile', 'mochacov:html']
grunt.registerTask 'coveralls', ['compile', 'mochacov:reportcoverage']
grunt.registerTask 'examples', ['compile', 'gen-examples']
grunt.registerTask 'default', ['compile']