Skip to content

Commit

Permalink
Merge pull request #1552 from picomancer/master
Browse files Browse the repository at this point in the history
Replace deprecated sys.puts with console.log, resolve #1529
  • Loading branch information
lukeapage committed Sep 17, 2013
2 parents 577751a + a6cdb81 commit 40cd226
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 56 deletions.
8 changes: 4 additions & 4 deletions benchmark/less-benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (process.argv[2]) { file = path.join(process.cwd(), process.argv[2]) }
fs.readFile(file, 'utf8', function (e, data) {
var tree, css, start, end, total;

sys.puts("Benchmarking...\n", path.basename(file) + " (" +
console.log("Benchmarking...\n", path.basename(file) + " (" +
parseInt(data.length / 1024) + " KB)", "");

start = new(Date);
Expand All @@ -20,21 +20,21 @@ fs.readFile(file, 'utf8', function (e, data) {

total = end - start;

sys.puts("Parsing: " +
console.log("Parsing: " +
total + " ms (" +
Number(1000 / total * data.length / 1024) + " KB\/s)");

start = new Date();
css = tree.toCSS();
end = new Date();

sys.puts("Generation: " + (end - start) + " ms (" +
console.log("Generation: " + (end - start) + " ms (" +
parseInt(1000 / (end - start) *
data.length / 1024) + " KB\/s)");

total += end - start;

sys.puts("Total: " + total + "ms (" +
console.log("Total: " + total + "ms (" +
Number(1000 / total * data.length / 1024) + " KB/s)");

if (err) {
Expand Down
16 changes: 8 additions & 8 deletions bin/lessc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ process.on('exit', function() { process.reallyExit(currentErrorcode) });

var checkArgFunc = function(arg, option) {
if (!option) {
sys.puts(arg + " option requires a parameter");
console.log(arg + " option requires a parameter");
continueProcessing = false;
return false;
}
Expand All @@ -46,7 +46,7 @@ var checkArgFunc = function(arg, option) {
var checkBooleanArg = function(arg) {
var onOff = /^((on|t|true|y|yes)|(off|f|false|n|no))$/i.exec(arg);
if (!onOff) {
sys.puts(" unable to parse "+arg+" as a boolean. use one of on/t/true/y/yes/off/f/false/n/no");
console.log(" unable to parse "+arg+" as a boolean. use one of on/t/true/y/yes/off/f/false/n/no");
continueProcessing = false;
return false;
}
Expand All @@ -69,7 +69,7 @@ args = args.filter(function (arg) {
switch (arg) {
case 'v':
case 'version':
sys.puts("lessc " + less.version.join('.') + " (LESS Compiler) [JavaScript]");
console.log("lessc " + less.version.join('.') + " (LESS Compiler) [JavaScript]");
continueProcessing = false;
case 'verbose':
options.verbose = true;
Expand Down Expand Up @@ -202,24 +202,24 @@ if (output) {
options.sourceMapOutputFilename = output;
output = path.resolve(process.cwd(), output);
if (warningMessages) {
sys.puts(warningMessages);
console.log(warningMessages);
}
}

options.sourceMapBasepath = options.sourceMapBasepath || (input ? path.dirname(input) : process.cwd());

if (options.sourceMap === true) {
if (!output) {
sys.puts("the sourcemap option only has an optional filename if the css filename is given");
console.log("the sourcemap option only has an optional filename if the css filename is given");
return;
}
options.sourceMapFullFilename = options.sourceMapOutputFilename + ".map";
options.sourceMap = path.basename(options.sourceMapFullFilename);
}

if (! input) {
sys.puts("lessc: no input files");
sys.puts("");
console.log("lessc: no input files");
console.log("");
require('../lib/less/lessc_helper').printUsage();
currentErrorcode = 1;
return;
Expand Down Expand Up @@ -257,7 +257,7 @@ if (options.sourceMap !== "inline") {

var parseLessFile = function (e, data) {
if (e) {
sys.puts("lessc: " + e.message);
console.log("lessc: " + e.message);
currentErrorcode = 1;
return;
}
Expand Down
88 changes: 44 additions & 44 deletions lib/less/lessc_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,50 +23,50 @@ var lessc_helper = {

//Print command line options
printUsage: function() {
sys.puts("usage: lessc [option option=parameter ...] <source> [destination]");
sys.puts("");
sys.puts("If source is set to `-' (dash or hyphen-minus), input is read from stdin.");
sys.puts("");
sys.puts("options:");
sys.puts(" -h, --help Print help (this message) and exit.");
sys.puts(" --include-path=PATHS Set include paths. Separated by `:'. Use `;' on Windows.");
sys.puts(" -M, --depends Output a makefile import dependency list to stdout");
sys.puts(" --no-color Disable colorized output.");
sys.puts(" --no-ie-compat Disable IE compatibility checks.");
sys.puts(" --no-js Disable JavaScript in less files");
sys.puts(" -l, --lint Syntax check only (lint).");
sys.puts(" -s, --silent Suppress output of error messages.");
sys.puts(" --strict-imports Force evaluation of imports.");
sys.puts(" --insecure Allow imports from insecure https hosts.");
sys.puts(" --verbose Be verbose.");
sys.puts(" -v, --version Print version number and exit.");
sys.puts(" -x, --compress Compress output by removing some whitespaces.");
sys.puts(" --clean-css Compress output using clean-css");
sys.puts(" -O0, -O1, -O2 Set the parser's optimization level. The lower");
sys.puts(" the number, the less nodes it will create in the");
sys.puts(" tree. This could matter for debugging, or if you");
sys.puts(" want to access the individual nodes in the tree.");
sys.puts(" --line-numbers=TYPE Outputs filename and line numbers.");
sys.puts(" TYPE can be either 'comments', which will output");
sys.puts(" the debug info within comments, 'mediaquery'");
sys.puts(" that will output the information within a fake");
sys.puts(" media query which is compatible with the SASS");
sys.puts(" format, and 'all' which will do both.");
sys.puts(" --source-map[=FILENAME] Outputs a v3 sourcemap to the filename (or output filename.map)");
sys.puts(" --source-map-rootpath=X adds this path onto the sourcemap filename and less file paths");
sys.puts(" --source-map-basepath=X Sets sourcemap base path, defaults to current working directory.");
sys.puts(" --source-map-inline puts the less files into the map instead of referencing them");
sys.puts(" -rp, --rootpath=URL Set rootpath for url rewriting in relative imports and urls.");
sys.puts(" Works with or without the relative-urls option.");
sys.puts(" -ru, --relative-urls re-write relative urls to the base less file.");
sys.puts(" -sm=on|off Turn on or off strict math, where in strict mode, math");
sys.puts(" --strict-math=on|off requires brackets. This option may default to on and then");
sys.puts(" be removed in the future.");
sys.puts(" -su=on|off Allow mixed units, e.g. 1px+1em or 1px*1px which have units");
sys.puts(" --strict-units=on|off that cannot be represented.");
sys.puts("");
sys.puts("Report bugs to: http://github.com/less/less.js/issues");
sys.puts("Home page: <http://lesscss.org/>");
console.log("usage: lessc [option option=parameter ...] <source> [destination]");
console.log("");
console.log("If source is set to `-' (dash or hyphen-minus), input is read from stdin.");
console.log("");
console.log("options:");
console.log(" -h, --help Print help (this message) and exit.");
console.log(" --include-path=PATHS Set include paths. Separated by `:'. Use `;' on Windows.");
console.log(" -M, --depends Output a makefile import dependency list to stdout");
console.log(" --no-color Disable colorized output.");
console.log(" --no-ie-compat Disable IE compatibility checks.");
console.log(" --no-js Disable JavaScript in less files");
console.log(" -l, --lint Syntax check only (lint).");
console.log(" -s, --silent Suppress output of error messages.");
console.log(" --strict-imports Force evaluation of imports.");
console.log(" --insecure Allow imports from insecure https hosts.");
console.log(" --verbose Be verbose.");
console.log(" -v, --version Print version number and exit.");
console.log(" -x, --compress Compress output by removing some whitespaces.");
console.log(" --clean-css Compress output using clean-css");
console.log(" -O0, -O1, -O2 Set the parser's optimization level. The lower");
console.log(" the number, the less nodes it will create in the");
console.log(" tree. This could matter for debugging, or if you");
console.log(" want to access the individual nodes in the tree.");
console.log(" --line-numbers=TYPE Outputs filename and line numbers.");
console.log(" TYPE can be either 'comments', which will output");
console.log(" the debug info within comments, 'mediaquery'");
console.log(" that will output the information within a fake");
console.log(" media query which is compatible with the SASS");
console.log(" format, and 'all' which will do both.");
console.log(" --source-map[=FILENAME] Outputs a v3 sourcemap to the filename (or output filename.map)");
console.log(" --source-map-rootpath=X adds this path onto the sourcemap filename and less file paths");
console.log(" --source-map-basepath=X Sets sourcemap base path, defaults to current working directory.");
console.log(" --source-map-inline puts the less files into the map instead of referencing them");
console.log(" -rp, --rootpath=URL Set rootpath for url rewriting in relative imports and urls.");
console.log(" Works with or without the relative-urls option.");
console.log(" -ru, --relative-urls re-write relative urls to the base less file.");
console.log(" -sm=on|off Turn on or off strict math, where in strict mode, math");
console.log(" --strict-math=on|off requires brackets. This option may default to on and then");
console.log(" be removed in the future.");
console.log(" -su=on|off Allow mixed units, e.g. 1px+1em or 1px*1px which have units");
console.log(" --strict-units=on|off that cannot be represented.");
console.log("");
console.log("Report bugs to: http://github.com/less/less.js/issues");
console.log("Home page: <http://lesscss.org/>");
}
};

Expand Down

0 comments on commit 40cd226

Please sign in to comment.