Removing the mixed-in sys/util module. Switching from 'puts' to console.log

This commit is contained in:
Jeremy Ashkenas
2010-10-24 12:48:42 -04:00
parent aed0e8790e
commit 26a115adcf
23 changed files with 86 additions and 89 deletions

View File

@@ -57,18 +57,18 @@
};
printTasks = function() {
var _ref, desc, name, spaces, task;
puts('');
console.log('');
for (name in _ref = tasks) {
task = _ref[name];
spaces = 20 - name.length;
spaces = spaces > 0 ? Array(spaces + 1).join(' ') : '';
desc = task.description ? "# " + task.description : '';
puts("cake " + name + spaces + " " + desc);
console.log("cake " + name + spaces + " " + desc);
}
return switches.length ? puts(oparse.help()) : undefined;
return switches.length ? console.log(oparse.help()) : undefined;
};
missingTask = function(task) {
puts("No such task: \"" + task + "\"");
console.log("No such task: \"" + task + "\"");
return process.exit(1);
};
}).call(this);

View File

@@ -104,13 +104,13 @@
if (o.tokens) {
return printTokens(CoffeeScript.tokens(t.input));
} else if (o.nodes) {
return puts(CoffeeScript.nodes(t.input).toString().trim());
return console.log(CoffeeScript.nodes(t.input).toString().trim());
} else if (o.run) {
return CoffeeScript.run(t.input, t.options);
} else {
t.output = CoffeeScript.compile(t.input, t.options);
CoffeeScript.emit('success', task);
return o.print ? print(t.output) : o.compile ? writeJs(t.file, t.output, base) : o.lint ? lint(t.output) : undefined;
return o.print ? console.log(t.output.trim()) : o.compile ? writeJs(t.file, t.output, base) : o.lint ? lint(t.output) : undefined;
}
} catch (err) {
CoffeeScript.emit('failure', err, task);
@@ -118,7 +118,7 @@
return;
}
if (o.watch) {
return puts(err.message);
return console.log(err.message);
}
error(err.stack);
return process.exit(1);
@@ -163,7 +163,7 @@
js = ' ';
}
return fs.writeFile(jsPath, js, function(err) {
return err ? puts(err.message) : opts.compile && opts.watch ? puts("Compiled " + source) : undefined;
return err ? console.log(err.message) : opts.compile && opts.watch ? console.log("Compiled " + source) : undefined;
});
};
return path.exists(dir, function(exists) {
@@ -173,7 +173,7 @@
lint = function(js) {
var conf, jsl, printIt;
printIt = function(buffer) {
return puts(buffer.toString().trim());
return console.log(buffer.toString().trim());
};
conf = __dirname + '/../extras/jsl.conf';
jsl = spawn('jsl', ['-nologo', '-stdin', '-conf', conf]);
@@ -193,7 +193,7 @@
}
return _result;
})();
return puts(strings.join(' '));
return console.log(strings.join(' '));
};
parseOptions = function() {
var o;
@@ -211,11 +211,11 @@
};
};
usage = function() {
puts(optionParser.help());
console.log(optionParser.help());
return process.exit(0);
};
version = function() {
puts("CoffeeScript version " + CoffeeScript.VERSION);
console.log("CoffeeScript version " + CoffeeScript.VERSION);
return process.exit(0);
};
}).call(this);

View File

@@ -18,10 +18,10 @@
fileName: 'repl'
});
if (val !== undefined) {
puts(inspect(val));
console.log(inspect(val));
}
} catch (err) {
puts(err.stack || err.toString());
console.log(err.stack || err.toString());
}
return repl.prompt();
};