using the new fs.writeFile API instead of fs.open -- much, much nicer

This commit is contained in:
Jeremy Ashkenas
2010-02-19 18:27:50 -05:00
parent dd753d3b78
commit c39415da44
4 changed files with 5 additions and 8 deletions

View File

@@ -99,14 +99,12 @@ watch_scripts: ->
return if curr.mtime.getTime() is prev.mtime.getTime()
fs.readFile(source).addCallback (code) -> compile_script(source, code)
# Write out a JavaScript source file with the compiled code.
write_js: (source, js) ->
filename: path.basename(source, path.extname(source)) + '.js'
dir: options.output or path.dirname(source)
js_path: path.join dir, filename
fs.open(js_path, 'w+', 0755).addCallback (fd) ->
fs.write(fd, js)
fs.writeFile js_path, js
# Pipe compiled JS through JSLint (requires a working 'jsl' command).
lint: (js) ->