-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCakefile
40 lines (34 loc) · 1.12 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
require('coffee-script/register')
fs = require('fs')
{exec} = require 'child_process'
topl = require('./src/topl')
option '-s', '--string', 'Output test as string'
task 'test', 'Run examples in test/fixtures though topl', (options) ->
fs.readFile './test/fixtures/example.toml', (err, data) =>
if err
console.log err
else
parsed = topl.parse data
if options.string
console.log JSON.stringify(parsed)
else
console.log parsed
fs.readFile './test/fixtures/hard_example.toml', (err, data) =>
if err
console.log err
else
parsed = topl.parse data
if options.string
console.log JSON.stringify(parsed)
else
console.log parsed
task 'build', 'Compile topl JavaScript files from CoffeeScript source', ->
exec './node_modules/.bin/coffee -c -o lib src', (error, stdout, stderr) ->
if error
console.log error
else
exec './node_modules/.bin/uglifyjs -m --comments /topl/ -o ./lib/topl.min.js ./lib/topl.js', (error, stdout, stderr) ->
if error
console.log error
else
console.log 'Build complete!'