From a8d4c3a5676e11c49b50d55a8ad00bc58914cad4 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Sat, 15 May 2010 00:34:14 -0400 Subject: [PATCH] sprinkling toString() throughout, for Node.js 0.1.95 compatibility. --- Cakefile | 2 +- lib/cake.js | 2 +- lib/command.js | 4 ++-- src/cake.coffee | 2 +- src/command.coffee | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cakefile b/Cakefile index 175b6682..f2670e15 100644 --- a/Cakefile +++ b/Cakefile @@ -95,7 +95,7 @@ task 'test', 'run the CoffeeScript language test suite', -> source: path.join 'test', file fs.readFile source, (err, code) -> try - CoffeeScript.run code, {source: source} + CoffeeScript.run code.toString(), {source: source} catch err failed_tests += 1 puts "${red}failed:${reset} $source" diff --git a/lib/cake.js b/lib/cake.js index 9f5fb939..5f73a8c3 100755 --- a/lib/cake.js +++ b/lib/cake.js @@ -60,7 +60,7 @@ throw new Error(("Cakefile not found in " + (process.cwd()))); } args = process.argv.slice(2, process.argv.length); - CoffeeScript.run(fs.readFileSync('Cakefile'), { + CoffeeScript.run(fs.readFileSync('Cakefile').toString(), { source: 'Cakefile' }); oparse = new optparse.OptionParser(switches); diff --git a/lib/command.js b/lib/command.js index dd5e7e9a..cb1d9e78 100644 --- a/lib/command.js +++ b/lib/command.js @@ -82,7 +82,7 @@ }); } else if (path.extname(source) === '.coffee') { fs.readFile(source, function(err, code) { - return compile_script(source, code, base); + return compile_script(source, code.toString(), base); }); if (options.watch) { return watch(source, base); @@ -158,7 +158,7 @@ puts(("Compiled " + source)); } return fs.readFile(source, function(err, code) { - return compile_script(source, code, base); + return compile_script(source, code.toString(), base); }); }); }; diff --git a/src/cake.coffee b/src/cake.coffee index 8c4c41db..c1e285f4 100644 --- a/src/cake.coffee +++ b/src/cake.coffee @@ -48,7 +48,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] - CoffeeScript.run fs.readFileSync('Cakefile'), {source: 'Cakefile'} + CoffeeScript.run fs.readFileSync('Cakefile').toString(), {source: 'Cakefile'} oparse: new optparse.OptionParser switches return print_tasks() unless args.length options: oparse.parse(args) diff --git a/src/command.coffee b/src/command.coffee index 9fec4efc..9aec6a0d 100644 --- a/src/command.coffee +++ b/src/command.coffee @@ -75,7 +75,7 @@ compile_scripts: -> for file in files compile path.join(source, file) else if path.extname(source) is '.coffee' - fs.readFile source, (err, code) -> compile_script(source, code, base) + fs.readFile source, (err, code) -> compile_script(source, code.toString(), base) watch source, base if options.watch compile source @@ -114,7 +114,7 @@ watch: (source, base) -> fs.watchFile source, {persistent: true, interval: 500}, (curr, prev) -> return if curr.mtime.getTime() is prev.mtime.getTime() puts "Compiled $source" if options.compile - fs.readFile source, (err, code) -> compile_script(source, code, base) + fs.readFile source, (err, code) -> compile_script(source, code.toString(), base) # Write out a JavaScript source file with the compiled code. By default, files # are written out in `cwd` as `.js` files with the same name, but the output