got a build script for rebuilding the compiler, too

This commit is contained in:
Jeremy Ashkenas
2010-02-16 19:17:57 -05:00
parent c4d19cd1fa
commit 448ed36cd2
3 changed files with 14 additions and 2 deletions

View File

@@ -4,10 +4,22 @@
fs: require 'fs' fs: require 'fs'
# Run a CoffeeScript through our node/coffee interpreter.
run: (args) ->
proc: process.createChildProcess 'bin/node_coffee', args
proc.addListener 'error', (err) -> if err then puts err
# Print the usage message for the build scripts. # Print the usage message for the build scripts.
usage: -> usage: ->
puts "build.coffee usage goes here..." puts "build.coffee usage goes here..."
# Build the CoffeeScript source code -- if you're editing the parser, run
# this before you run "build parser".
build_compiler: ->
fs.readdir('src').addCallback (files) ->
files: 'src/' + file for file in files when file.match(/\.coffee$/)
run ['-o', 'lib/coffee_script'].concat(files)
# Rebuild the Jison parser from the compiled lib/grammar.js file. # Rebuild the Jison parser from the compiled lib/grammar.js file.
build_parser: -> build_parser: ->
parser: require('grammar').parser parser: require('grammar').parser

View File

@@ -83,7 +83,7 @@
} else { } else {
js = coffee.compile(code); js = coffee.compile(code);
if (opts.run) { if (opts.run) {
process.compile(js, source); eval(js);
} else if (opts.print) { } else if (opts.print) {
puts(js); puts(js);
} else if (opts.lint) { } else if (opts.lint) {

View File

@@ -78,7 +78,7 @@ compile_scripts: ->
else if opts.tree then puts coffee.tree(code).toString() else if opts.tree then puts coffee.tree(code).toString()
else else
js: coffee.compile code js: coffee.compile code
if opts.run then process.compile js, source if opts.run then eval js
else if opts.print then puts js else if opts.print then puts js
else if opts.lint then lint js else if opts.lint then lint js
else write_js source, coffee.compile code else write_js source, coffee.compile code