updating for Node.js' change from 'posix' to 'fs'

This commit is contained in:
Jeremy Ashkenas
2010-02-15 19:08:14 -05:00
parent 8b1b3ea402
commit 639be2ff09
4 changed files with 16 additions and 16 deletions

View File

@@ -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).