forked from c0bra/markdown-resume-js
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCakefile
30 lines (23 loc) · 868 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
fs = require 'fs'
path = require 'path'
{exec} = require 'child_process'
task 'build', 'Build this module', ->
# Create the bin directory if it doesn't exist
if !fs.existsSync("bin")
fs.mkdirSync "bin"
# Compile the library
exec 'coffee -o lib src/lib/markdown-resume.coffee', (err, stdout, stderr) ->
throw err if err
console.log stdout + stderr
for binfile in fs.readdirSync 'src/bin'
basename = path.basename binfile, '.coffee'
cmd = "coffee -p src/bin/#{binfile}"
console.log "Running command: " + cmd
exec cmd, (err, stdout, stderr) ->
throw err if err
stdout = "#!/usr/bin/env node\n" + stdout
fs.writeFileSync "bin/#{basename}", stdout
fs.chmodSync "bin/#{basename}", '0755'
# cmd = "mv bin/#{basename}.js bin/#{basename}"
# console.log "Running command: " + cmd
# exec cmd