Sys is now util, switch to util

This commit is contained in:
Tom MacWright 2012-06-26 14:38:51 -04:00
parent d7e6cdf082
commit d244fd0da8

View File

@ -2,7 +2,7 @@
var path = require('path'),
fs = require('fs'),
sys = require('sys'),
util = require('util'),
carto = require('carto');
var args = process.argv.slice(1);
@ -17,7 +17,7 @@ args = args.filter(function (arg) {
switch (arg) {
case 'v':
case 'version':
sys.puts("carto " + carto.version.join('.') + " (Carto map stylesheet compiler)");
util.puts("carto " + carto.version.join('.') + " (Carto map stylesheet compiler)");
process.exit(0);
break;
case 'b':
@ -26,10 +26,10 @@ args = args.filter(function (arg) {
break;
default:
sys.puts("Usage: carto <source MML file>");
sys.puts("Options:");
sys.puts(" -v --version Parse JSON map manifest");
sys.puts(" -b --benchmark Outputs total compile time");
util.puts("Usage: carto <source MML file>");
util.puts("Options:");
util.puts(" -v --version Parse JSON map manifest");
util.puts(" -b --benchmark Outputs total compile time");
process.exit(0);
break;
}
@ -41,7 +41,7 @@ if (input && input[0] != '/') {
}
if (!input) {
sys.puts("carto: no input files");
util.puts("carto: no input files");
process.exit(1);
}
@ -52,14 +52,14 @@ if (options.benchmark) {
try {
var data = fs.readFileSync(input, 'utf-8');
} catch(err) {
sys.puts("carto: " + err.message.replace(/^[A-Z]+, /, ''));
util.puts("carto: " + err.message.replace(/^[A-Z]+, /, ''));
process.exit(1);
}
try {
data = JSON.parse(data);
} catch(err) {
sys.puts("carto: " + err.message.replace(/^[A-Z]+, /, ''));
util.puts("carto: " + err.message.replace(/^[A-Z]+, /, ''));
process.exit(1);
}
@ -94,7 +94,7 @@ function compile(err, data) {
process.exit(1);
} else {
if (!options.benchmark) {
sys.puts(output);
util.puts(output);
} else {
var duration = (+new Date) - start;
console.log('TOTAL: ' + (duration) + 'ms');
@ -103,9 +103,9 @@ function compile(err, data) {
});
} catch (e) {
if (e.stack) {
sys.error(e.stack);
util.error(e.stack);
} else {
sys.error(e);
util.error(e);
}
}
};