diff --git a/lib/coffee_script/command_line.js b/lib/coffee_script/command_line.js index 15f1bfe9..9c3a47e1 100644 --- a/lib/coffee_script/command_line.js +++ b/lib/coffee_script/command_line.js @@ -1,6 +1,6 @@ (function(){ - var BANNER, SWITCHES, WATCH_INTERVAL, coffee, compile, compile_scripts, lint, option_parser, options, optparse, parse_options, path, posix, sources, usage, version, write_js; - posix = require('posix'); + var BANNER, SWITCHES, WATCH_INTERVAL, coffee, compile, compile_scripts, fs, lint, option_parser, options, optparse, parse_options, path, sources, usage, version, write_js; + fs = require('fs'); path = require('path'); coffee = require('coffee-script'); optparse = require('optparse'); @@ -66,7 +66,7 @@ return null; } opts = options; - return posix.cat(source).addCallback(function(code) { + return fs.cat(source).addCallback(function(code) { var js; if (opts.tokens) { puts(coffee.print_tokens(coffee.tokenize(code))); @@ -93,8 +93,8 @@ filename = path.basename(source, path.extname(source)) + '.js'; dir = options.output || path.dirname(source); js_path = path.join(dir, filename); - return posix.open(js_path, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, parseInt('0755', 8)).addCallback(function(fd) { - return posix.write(fd, js); + return fs.open(js_path, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, parseInt('0755', 8)).addCallback(function(fd) { + return fs.write(fd, js); }); }; // Pipe compiled JS through JSLint (requires a working 'jsl' command). diff --git a/lib/coffee_script/grammar.js b/lib/coffee_script/grammar.js index 9869356b..5df3b40c 100644 --- a/lib/coffee_script/grammar.js +++ b/lib/coffee_script/grammar.js @@ -1,5 +1,5 @@ (function(){ - var Parser, __a, __b, __c, __d, __e, __f, bnf, grammar, js, name, non_terminal, o, operators, option, parser, parser_path, part, posix, tokens, unwrap; + var Parser, __a, __b, __c, __d, __e, __f, bnf, fs, grammar, js, name, non_terminal, o, operators, option, parser, parser_path, part, tokens, unwrap; var __hasProp = Object.prototype.hasOwnProperty; Parser = require('jison').Parser; // DSL =================================================================== @@ -555,9 +555,9 @@ js = parser.generate(); // Save the parser to a file. // puts parser.generate() - posix = require('posix'); + fs = require('fs'); parser_path = 'lib/coffee_script/parser.js'; - posix.open(parser_path, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, parseInt('0755', 8)).addCallback(function(fd) { - return posix.write(fd, js); + fs.open(parser_path, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, parseInt('0755', 8)).addCallback(function(fd) { + return fs.write(fd, js); }); })(); \ No newline at end of file diff --git a/src/command_line.coffee b/src/command_line.coffee index 43d4b107..a0c7f022 100644 --- a/src/command_line.coffee +++ b/src/command_line.coffee @@ -1,4 +1,4 @@ -posix: require 'posix' +fs: require 'fs' path: require 'path' coffee: require 'coffee-script' optparse: require('optparse') @@ -67,7 +67,7 @@ compile: (script, source) -> compile_scripts: -> return unless source: sources.shift() opts: options - posix.cat(source).addCallback (code) -> + fs.cat(source).addCallback (code) -> if opts.tokens then puts coffee.print_tokens coffee.tokenize code else if opts.tree then puts coffee.tree(code).toString() else @@ -83,8 +83,8 @@ 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 - posix.open(js_path, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, parseInt('0755', 8)).addCallback (fd) -> - posix.write(fd, js) + fs.open(js_path, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, parseInt('0755', 8)).addCallback (fd) -> + fs.write(fd, js) # Pipe compiled JS through JSLint (requires a working 'jsl' command). lint: (js) -> diff --git a/src/grammar.coffee b/src/grammar.coffee index d467cb5c..fe7cfb5f 100644 --- a/src/grammar.coffee +++ b/src/grammar.coffee @@ -455,7 +455,7 @@ js: parser.generate() # Save the parser to a file. # puts parser.generate() -posix: require 'posix' +fs: require 'fs' parser_path: 'lib/coffee_script/parser.js' -posix.open(parser_path, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, parseInt('0755', 8)).addCallback (fd) -> - posix.write(fd, js) +fs.open(parser_path, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, parseInt('0755', 8)).addCallback (fd) -> + fs.write(fd, js)