forked from hickford/imgurgitate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCakefile
26 lines (18 loc) · 858 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
path = require 'path'
fs = require 'fs'
wrench = require 'wrench'
task 'build', 'Compile Coffeescript source to Javascript', ->
command = require 'iced-coffee-script/lib/coffee-script/command'
process.argv[2..]=['-o','lib','-c','src']
command.run() # alas, this returns early and doesn't indicate error
# prepend shebang until issue fixed
# https://github.com/jashkenas/coffee-script/issues/2215
script_path = path.join('lib','imgurgitate.js')
shebang = "#!/usr/bin/env node"
# wait until script built
while ! path.existsSync(script_path)
await setTimeout(defer(),1000)
fs.writeFileSync(script_path,[shebang,fs.readFileSync(script_path)].join("\n"))
task 'clean', 'Clean build matter', ->
wrench.rmdirSyncRecursive('lib',true)
wrench.rmdirSyncRecursive('-p',true)