diff options
author | Micheil Smith <micheil@brandedcode.com> | 2010-10-12 01:04:09 +0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-10-12 02:21:36 +0400 |
commit | e38eb0c5a4d4e8497f5815be81994ddb01fbceb7 (patch) | |
tree | 6a78ed08f6186930b9ef9984fbd7b4354beae7c7 /tools | |
parent | 0a0e90dcca1642849ffa8b8cee4ad9b8f15c0fc1 (diff) |
Soft migration of sys -> util, Removal of deprecated utils module.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/ronnjs/bin/ronn.js | 17 | ||||
-rwxr-xr-x | tools/ronnjs/lib/ext/opts.js | 18 | ||||
-rw-r--r-- | tools/ronnjs/lib/ronn.js | 8 |
3 files changed, 22 insertions, 21 deletions
diff --git a/tools/ronnjs/bin/ronn.js b/tools/ronnjs/bin/ronn.js index 5087b8e2f15..73fc673d3fe 100755 --- a/tools/ronnjs/bin/ronn.js +++ b/tools/ronnjs/bin/ronn.js @@ -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); } } diff --git a/tools/ronnjs/lib/ext/opts.js b/tools/ronnjs/lib/ext/opts.js index 92263b0bc9c..0c77e05af93 100755 --- a/tools/ronnjs/lib/ext/opts.js +++ b/tools/ronnjs/lib/ext/opts.js @@ -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); }; diff --git a/tools/ronnjs/lib/ronn.js b/tools/ronnjs/lib/ronn.js index aadcb3da606..afe5181c2ef 100644 --- a/tools/ronnjs/lib/ronn.js +++ b/tools/ronnjs/lib/ronn.js @@ -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; |