From 6c36d865353f84c8561c2b0759eecc87d24e58ea Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 30 Aug 2011 18:48:06 -0700 Subject: [PATCH] exec cs process instead of requiring cs module https://github.com/jashkenas/coffee-script/issues/1620 the coffee-script module isn't documented, everyone seems to prefer exec --- Cakefile | 14 +++++--------- readme.md | 6 +++--- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/Cakefile b/Cakefile index 1b1645407..9243e37d2 100644 --- a/Cakefile +++ b/Cakefile @@ -1,19 +1,15 @@ -cs = require 'coffee-script' -fs = require 'fs' -{log} = console +{log} = console +{exec} = require 'child_process' +fs = require 'fs' HEADER = fs.readFileSync 'header', 'utf8' INFILE = 'script.coffee' OUTFILE = '4chan_x.user.js' build = -> - fs.readFile INFILE, 'utf8', (err, code) -> + exec 'coffee --print script.coffee', (err, stdout, stderr) -> throw err if err - try - code = HEADER + cs.compile code - catch e - log e - fs.writeFile OUTFILE, code, (err) -> + fs.writeFile OUTFILE, HEADER + stdout, (err) -> throw err if err task 'build', -> diff --git a/readme.md b/readme.md index 933e72e48..7b849ac02 100644 --- a/readme.md +++ b/readme.md @@ -4,6 +4,6 @@ [install nodejs and npm](https://github.com/joyent/node/wiki/Installation), install [coffee-script](https://github.com/jashkenas/coffee-script/) with -`npm install -g coffee-script`, clone 4chan x, cd into it and run -`npm link coffee-script`. actually build it with `cake build`. for development -(continuous builds), run `cake dev &`. kill the process with `killall node`. +`npm install -g coffee-script`, clone 4chan x, cd into it and actually build +with `cake build`. for development (continuous builds), run `cake dev &`. +kill the process with `killall node`.