-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cakefile
54 lines (41 loc) · 1.41 KB
/
Cakefile
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
# Module requires
{spawn, exec} = require 'child_process'
sys = require 'sys'
# ## Helpers
# Helper function for showing error messages if anyting happens
printOutput = (process) ->
process.stdout.on 'data', (data) -> sys.print data
process.stderr.on 'data', (data) -> sys.print data
# Watch Javascript for changes
watchJS = ->
coffee = exec 'coffee -cw -o ./ src/'
printOutput(coffee)
# Watch CSS for changes
watchCSS = ->
# Without Nib
stylus = exec 'stylus --watch --include ./public --out ./public/css ./src/public/css'
# Use this line instead if you're using Nib
# stylus = exec 'stylus --watch --include ./public --use ./node_modules/nib/lib/nib.js --out ./public/css ./src/public/css'
printOutput(stylus)
# ## Tasks
# I guess pretty self explainory? lol
task 'watch', 'Watches all Coffeescript(JS) and Stylus(CSS) files', ->
watchJS()
watchCSS()
task 'watchJS', 'Watches all coffeescript files for changes', ->
watchJS()
task 'watchCSS', 'Watches all CSS files for changes', ->
watchCSS()
task 'compileJS', 'Compiles all Coffeescript files into JS', ->
coffee = exec "coffee -c -o ./ src/"
printOutput(coffee)
task 'test', 'Runs all tests', ->
vows = exec 'vows test/*.test.js'
printOutput(vows)
task 'docs', 'Create documentation using Docco', ->
docco = exec """
docco src/*.coffee
docco src/lib/*.coffee
docco src/test/*.coffee
"""
printOutput(docco)