using the new fs.writeFile API instead of fs.open -- much, much nicer
This commit is contained in:
parent
dd753d3b78
commit
c39415da44
4
Cakefile
4
Cakefile
|
@ -27,8 +27,7 @@ task 'build:parser', 'rebuild the Jison parser', ->
|
|||
parser: require('grammar').parser
|
||||
js: parser.generate()
|
||||
parser_path: 'lib/parser.js'
|
||||
fs.open(parser_path, 'w+', 0755).addCallback (fd) ->
|
||||
fs.write(fd, js)
|
||||
fs.writeFile parser_path, js
|
||||
|
||||
|
||||
task 'build:ultraviolet', 'build and install the Ultraviolet syntax highlighter', ->
|
||||
|
@ -39,6 +38,7 @@ task 'build:ultraviolet', 'build and install the Ultraviolet syntax highlighter'
|
|||
task 'build:underscore', 'rebuild the Underscore.coffee documentation page', ->
|
||||
exec 'uv -s coffeescript -t idle -h examples/underscore.coffee > documentation/underscore.html'
|
||||
|
||||
|
||||
task 'test', 'run the CoffeeScript language test suite', ->
|
||||
process.mixin require 'assert'
|
||||
test_count: 0
|
||||
|
|
|
@ -134,9 +134,7 @@
|
|||
filename = path.basename(source, path.extname(source)) + '.js';
|
||||
dir = options.output || path.dirname(source);
|
||||
js_path = path.join(dir, filename);
|
||||
return fs.open(js_path, 'w+', 0755).addCallback(function(fd) {
|
||||
return fs.write(fd, js);
|
||||
});
|
||||
return fs.writeFile(js_path, js);
|
||||
};
|
||||
// Pipe compiled JS through JSLint (requires a working 'jsl' command).
|
||||
lint = function lint(js) {
|
||||
|
|
|
@ -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) ->
|
||||
|
|
|
@ -18,6 +18,7 @@ x: if get_x() then 100
|
|||
|
||||
ok x is 100, 'can assign a conditional statement'
|
||||
|
||||
|
||||
tester: ->
|
||||
@example: -> puts 'example function'
|
||||
this
|
||||
|
|
Loading…
Reference in New Issue