mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
updating for Node.js' change from 'posix' to 'fs'
This commit is contained in:
parent
8b1b3ea402
commit
639be2ff09
4 changed files with 16 additions and 16 deletions
|
@ -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);
|
||||
});
|
||||
})();
|
|
@ -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) ->
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue