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