Sahli/Cakefile
Howland Owl 49d411a3d1 split classes into files for better understanding
- also for excluding some things in the build, as I may not need
 to support PCBoard at revision. Actually, I don't. Later I can
 add that support, but for now, I need the Revision bits working.
2014-04-05 13:30:28 +03:00

47 lines
No EOL
1.5 KiB
CoffeeScript

fs = require 'fs'
option '-o', '--output [dir]', 'dir for compiled code'
task 'watch', 'watch current dir', (options) ->
{spawn} = require 'child_process'
args = ['-w','-c']
if options.output
args = args.concat ['./']
process.chdir __originalDirname
coffee = spawn 'coffee', args
coffee.stderr.on 'data', (data) ->
process.stderr.write data.toString()
coffee.stdout.on 'data', (data) ->
console.log data.toString()
source = [
'16col/imgtxtmode.coffee',
'16col/ansi.coffee',
'16col/bin.coffee',
'16col/idf.coffee',
'16col/adf.coffee',
'16col/sauce.coffee',
'16col/tundra.coffee',
'16col/pcboard.coffee',
'16col/avatar.coffee',
'16col/xbin.coffee',
'16col/pallette.coffee',
'16col/fonts.coffee'
]
task 'build', 'Build merged file for production', (options) ->
{exec} = require 'child_process'
content = []
for file, index in source then do (file, index) ->
fs.readFile file, 'utf8', (err, fileContents) ->
throw err if err
content[index] = fileContents
if index == source.length - 1
coffee = content.join('\n')
fs.writeFile 'textmode.coffee', coffee, 'utf8', (err) ->
throw err if err
command = 'coffee --compile textmode.coffee'
exec command, (err, stdout, stderr) ->
throw err if err
console.log stdout + stderr