mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
updating for Node.js' change from 'posix' to 'fs'
This commit is contained in:
@@ -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).
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user