diff --git a/Cakefile b/Cakefile index a1b78ec2..e33f3d2e 100644 --- a/Cakefile +++ b/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 diff --git a/lib/command_line.js b/lib/command_line.js index c3314cf2..6b98ae2e 100644 --- a/lib/command_line.js +++ b/lib/command_line.js @@ -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) { diff --git a/src/command_line.coffee b/src/command_line.coffee index d95cdce3..d5e05e69 100644 --- a/src/command_line.coffee +++ b/src/command_line.coffee @@ -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) -> diff --git a/test/test_assignment.coffee b/test/test_assignment.coffee index 7fdb6129..e8c1b80c 100644 --- a/test/test_assignment.coffee +++ b/test/test_assignment.coffee @@ -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