diff --git a/Cakefile b/Cakefile index 58ec4849..e33f3d2e 100644 --- a/Cakefile +++ b/Cakefile @@ -17,7 +17,7 @@ task 'install', 'install CoffeeScript into /usr/local', -> task 'build', 'build the CoffeeScript language from source', -> - fs.readdir 'src', (err, files) -> + fs.readdir('src').addCallback (files) -> files: 'src/' + file for file in files when file.match(/\.coffee$/) run ['-o', 'lib'].concat(files) @@ -51,8 +51,8 @@ task 'test', 'run the CoffeeScript language test suite', -> process.addListener 'exit', -> time: ((new Date() - start_time) / 1000).toFixed(2) puts '\033[0;32mpassed ' + test_count + ' tests in ' + time + ' seconds\033[0m' - fs.readdir 'test', (err, files) -> + fs.readdir('test').addCallback (files) -> for file in files - fs.readFile 'test/' + file, (err, 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 b9027c64..f9345c01 100755 --- a/lib/cake.js +++ b/lib/cake.js @@ -57,7 +57,7 @@ throw new Error('Cakefile not found in ' + process.cwd()); } args = process.ARGV.slice(2, process.ARGV.length); - return fs.readFile('Cakefile', function(err, 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 89a734e2..06cd0754 100644 --- a/lib/command_line.js +++ b/lib/command_line.js @@ -72,7 +72,7 @@ if (!((source = sources.shift()))) { return null; } - return fs.readFile(source, function(err, 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.readFile(source, function(err, code) { + return fs.readFile(source).addCallback(function(code) { return compile_script(source, code); }); })); diff --git a/src/cake.coffee b/src/cake.coffee index 6e3ecd83..5fb2cfa8 100644 --- a/src/cake.coffee +++ b/src/cake.coffee @@ -36,7 +36,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.readFile 'Cakefile', (err, 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 1ca12963..5cae2864 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.readFile source, 'raw', (err, 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.readFile source, (err, code) -> compile_script(source, code) + fs.readFile(source).addCallback (code) -> compile_script(source, code) # Write out a JavaScript source file with the compiled code. write_js: (source, js) ->