Soft migration of sys -> util, Removal of deprecated utils module.

This commit is contained in:
Micheil Smith authored and Ryan Dahl committed 2010-10-11 15:21:36 -07:00
1 parent 0a0e90dcca
commit e38eb0c5a4
55 files changed
+543 -541

No files matched your search

+9 -8
View File
@@ -3,10 +3,12 @@
var opts = require(__dirname + '/../lib/ext/opts');
var ronn = require(__dirname + '/../lib/ronn');
var util = require("util");
var options = [
{ short : 'V'
, description : 'Show version and exit'
, callback : function () { sys.puts('0.1'); process.exit(1); }
, callback : function () { util.puts('0.1'); process.exit(1); }
},
{ short : 'b'
, long : 'build'
@@ -50,7 +52,6 @@ var arguments = [
opts.parse(options, arguments, true);
var sys = require('sys');
var fs = require('fs');
var path = require('path');
@@ -64,10 +65,10 @@ if (opts.get("man") && !opts.get("build")) {
var spawn = require('child_process').spawn;
var man = spawn('man', ['--warnings', '-E UTF-8', '-l', '-'], {"LANG":"C"});
man.stdout.addListener('data', function (data) {
sys.puts(data);
util.puts(data);
});
man.stderr.addListener('data', function (data) {
sys.puts(data);
util.puts(data);
});
man.addListener('exit', function() {
process.exit(0);
@@ -84,7 +85,7 @@ if (opts.get("man") && !opts.get("build")) {
if (opts.get("html")) fHtml = ronn.html();
if (opts.get("fragment")) {
if (opts.get("html")) {
sys.debug("Can't use both --fragment and --html");
util.debug("Can't use both --fragment and --html");
process.exit(-1);
}
fFrag = ronn.fragment();
@@ -95,8 +96,8 @@ if (opts.get("man") && !opts.get("build")) {
if (fHtml) fs.writeFileSync(fBase + ".html", fHtml, 'utf8');
if (fFrag) fs.writeFileSync(fBase + ".fragment", fFrag, 'utf8');
} else {
if (fRoff) sys.puts(fRoff);
if (fHtml) sys.puts(fHtml);
if (fFrag) sys.puts(fFrag);
if (fRoff) util.puts(fRoff);
if (fHtml) util.puts(fHtml);
if (fFrag) util.puts(fFrag);
}
}
+9 -9
View File
@@ -34,7 +34,7 @@ of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Joey Mazzarelli.
***************************************************************************/
var puts = require('sys').puts
var util = require('util')
, values = {}
, args = {}
, argv = []
@@ -133,8 +133,8 @@ exports.parse = function (options, params, help) {
}
}
} else {
puts('Conflicting flags: ' + prefix + name + '\n');
puts(helpString());
util.puts('Conflicting flags: ' + prefix + name + '\n');
util.puts(helpString());
process.exit(1);
}
}
@@ -173,8 +173,8 @@ exports.parse = function (options, params, help) {
// No match. If it starts with a dash, show an error. Otherwise
// add it to the extra params.
if (inp[0] == '-') {
puts('Unknown option: ' + inp);
if (opts['--help']) puts('Try --help');
util.puts('Unknown option: ' + inp);
if (opts['--help']) util.puts('Try --help');
process.exit(1);
} else {
argv.push(inp);
@@ -198,8 +198,8 @@ exports.parse = function (options, params, help) {
}
}
if (errors.length) {
for (var i=0; i<errors.length; i++) puts(errors[i]);
puts('\n' + helpString());
for (var i=0; i<errors.length; i++) util.puts(errors[i]);
util.puts('\n' + helpString());
process.exit(1);
}
};
@@ -226,7 +226,7 @@ exports.args = function () {
* @return string Value of arg
*/
exports.arg = function (name) {
//puts(require('sys').inspect(arguments));
//util.puts(require('util').inspect(arguments));
return args[name];
};
@@ -234,7 +234,7 @@ exports.arg = function (name) {
* Print the help message and exit
*/
exports.help = function () {
puts(helpString());
util.puts(helpString());
process.exit(0);
};
+4 -4
View File
@@ -4,7 +4,7 @@
*/
var md = require(__dirname + '/ext/markdown');
var sys = require('sys');
var util = require('util');
/* exports Ronn class
* usage :
@@ -36,7 +36,7 @@ exports.Ronn = function(text, version, manual, date) {
function blockFilter(out, node, context) {
if (typeof node == "string") {
if (!node.match(/^\s*$/m)) sys.debug("unexpected text: " + node);
if (!node.match(/^\s*$/m)) util.debug("unexpected text: " + node);
return out;
}
var tag = node.shift();
@@ -150,7 +150,7 @@ exports.Ronn = function(text, version, manual, date) {
out += "\n";
break;
default:
sys.debug("unrecognized block tag: " + tag);
util.debug("unrecognized block tag: " + tag);
break;
}
context.parent = fParent;
@@ -235,7 +235,7 @@ exports.Ronn = function(text, version, manual, date) {
}
break;
default:
sys.debug("unrecognized inline tag: " + tag);
util.debug("unrecognized inline tag: " + tag);
break;
}
context.parent = fParent;