-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCakefile
34 lines (25 loc) · 862 Bytes
/
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
{spawn} = require('child_process')
express = require('express')
build = (options) ->
args = ['-c', '-o', 'lib', 'src']
args.unshift('-w') if options?.watch
coffee = spawn('coffee', args)
coffee.stderr.pipe process.stderr, end: false
coffee.stdout.pipe process.stdout, end: false
startWebServer = ->
app = express()
# Setup directories.
app.use '/', express.static("#{__dirname}/www")
app.use '/lib', express.static("#{__dirname}/lib")
app.use '/ROMs', express.static("#{__dirname}/ROMs")
# Root goes to index.htm
app.get '/', (req, res) ->
res.sendfile "#{__dirname}/www/index.htm"
app.listen 3000
console.log 'Web server is listening on port 3000.'
app
task 'build', 'Build lib/ from src/', ->
build()
task 'server', 'Start a local server and watch src/ for changes.', ->
startWebServer()
build watch: true