diff --git a/Cakefile b/Cakefile index 39e115b7..1d88edd2 100644 --- a/Cakefile +++ b/Cakefile @@ -27,7 +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, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, parseInt('0755', 8)).addCallback (fd) -> + fs.open(parser_path, 'w+', 0755).addCallback (fd) -> fs.write(fd, js) @@ -54,6 +54,6 @@ task 'test', 'run the CoffeeScript language test suite', -> puts '\033[0;32mpassed ' + test_count + ' tests in ' + time + ' seconds\033[0m' fs.readdir('test').addCallback (files) -> for file in files - fs.cat('test/' + file).addCallback (source) -> + fs.readFile('test/' + file).addCallback (source) -> js: coffee.compile source process.compile js, file \ No newline at end of file diff --git a/lib/cake.js b/lib/cake.js index 0370a592..17a10f09 100755 --- a/lib/cake.js +++ b/lib/cake.js @@ -50,7 +50,7 @@ throw new Error('Cakefile not found in ' + process.cwd()); } args = process.ARGV.slice(2, process.ARGV.length); - return fs.cat('Cakefile').addCallback(function(source) { + return fs.readFile('Cakefile').addCallback(function(source) { var _a, _b, _c, arg; eval(coffee.compile(source)); if (!(args.length)) { diff --git a/lib/command_line.js b/lib/command_line.js index 9210fbbc..c3314cf2 100644 --- a/lib/command_line.js +++ b/lib/command_line.js @@ -72,7 +72,7 @@ if (!((source = sources.shift()))) { return null; } - return fs.cat(source).addCallback(function(code) { + return fs.readFile(source).addCallback(function(code) { compile_script(source, code); return compile_scripts(); }); @@ -121,7 +121,7 @@ if (curr.mtime.getTime() === prev.mtime.getTime()) { return null; } - return fs.cat(source).addCallback(function(code) { + return fs.readFile(source).addCallback(function(code) { return compile_script(source, code); }); })); @@ -134,7 +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, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, parseInt('0755', 8)).addCallback(function(fd) { + return fs.open(js_path, 'w+', 0755).addCallback(function(fd) { return fs.write(fd, js); }); }; diff --git a/src/cake.coffee b/src/cake.coffee index af49ed6b..b18a8e35 100644 --- a/src/cake.coffee +++ b/src/cake.coffee @@ -31,7 +31,7 @@ exports.run: -> path.exists 'Cakefile', (exists) -> throw new Error('Cakefile not found in ' + process.cwd()) unless exists args: process.ARGV[2...process.ARGV.length] - fs.cat('Cakefile').addCallback (source) -> + fs.readFile('Cakefile').addCallback (source) -> eval coffee.compile source return print_tasks() unless args.length for arg in args diff --git a/src/command_line.coffee b/src/command_line.coffee index b630f8de..d95cdce3 100644 --- a/src/command_line.coffee +++ b/src/command_line.coffee @@ -71,7 +71,7 @@ compile: (script, source) -> # or JSLint results. compile_scripts: -> return unless source: sources.shift() - fs.cat(source).addCallback (code) -> + fs.readFile(source).addCallback (code) -> compile_script(source, code) compile_scripts() @@ -97,7 +97,7 @@ watch_scripts: -> for source in sources process.watchFile source, {persistent: true, interval: 500}, (curr, prev) -> return if curr.mtime.getTime() is prev.mtime.getTime() - fs.cat(source).addCallback (code) -> compile_script(source, code) + fs.readFile(source).addCallback (code) -> compile_script(source, code) # Write out a JavaScript source file with the compiled code. @@ -105,7 +105,7 @@ 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, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, parseInt('0755', 8)).addCallback (fd) -> + fs.open(js_path, 'w+', 0755).addCallback (fd) -> fs.write(fd, js) # Pipe compiled JS through JSLint (requires a working 'jsl' command).