forked from danielgtaylor/aglio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
70 lines (62 loc) · 2.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
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 = (template, done) ->
console.log "Generating examples/#{template}.html"
aglio.renderFile 'example.md', "examples/#{template}.html", template, (err) ->
if err then return done(err)
done()
aglio.getTemplates (err, templates) ->
async.each templates, 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']