Permalink
Browse files

renamed

  • Loading branch information...
1 parent b317eeb commit 0ce762c7e8635bb859cd2b3f3997a6078ceb2ee6 @tj committed Aug 3, 2011
View
@@ -4,7 +4,7 @@
* Module dependencies.
*/
-var jss = require('../')
+var stats = require('../')
, fs = require('fs');
/**
@@ -23,7 +23,7 @@ var paths = [];
* Statistics.
*/
-var stats = {};
+var statistics = {};
/**
* Options.
@@ -37,15 +37,15 @@ var options = { format: 'text' };
var usage = [
''
- , ' Usage: jss [options] [file|dir ...]'
+ , ' Usage: stats [options] [file|dir ...]'
, ''
, ' Options:'
, ''
, ' -f, --format <name> Output the given format. text, json'
, ' -j, --json Output JSON statistics'
, ' -t, --text Output human-readable plain-text stats'
, ' -T, --totals Output totals only'
- , ' -V, --version Display the version of jss'
+ , ' -V, --version Display the version of stats'
, ' -h, --help Display help information'
, ''
].join('\n');
@@ -65,7 +65,7 @@ while (args.length) {
process.exit(1);
case '-V':
case '--version':
- console.log(jss.version);
+ console.log(stats.version);
process.exit(0);
break;
case '-j':
@@ -88,18 +88,18 @@ while (args.length) {
// process
var totals;
-jss.find(paths, function(err, files){
+stats.find(paths, function(err, files){
var pending = files.length;
files.forEach(function(file){
fs.readFile(file, 'utf8', function(err, str){
if (err) throw err;
- stats[file] = jss.stats(str);
+ statistics[file] = stats.parse(str);
if (totals) {
- Object.keys(stats[file]).forEach(function(key){
- totals[key] += stats[file][key];
+ Object.keys(statistics[file]).forEach(function(key){
+ totals[key] += statistics[file][key];
});
} else {
- totals = stats[file];
+ totals = statistics[file];
}
--pending || done();
});
@@ -110,10 +110,12 @@ jss.find(paths, function(err, files){
function done() {
if (options.text) {}
- var format = jss.formats[options.format];
+ var format = stats.formats[options.format];
if (!format) throw new Error('invalid format "' + options.format + '"');
var obj = { totals: totals };
- totals.files = Object.keys(stats).length;
- if (!options.totalsOnly) for (var file in stats) obj[file] = stats[file];
+ totals.files = Object.keys(statistics).length;
+ if (!options.totalsOnly) {
+ for (var file in statistics) obj[file] = statistics[file];
+ }
format(obj);
}
View
@@ -1,2 +1,2 @@
-module.exports = require('./lib/jss');
+module.exports = require('./lib/stats');
View
@@ -1,6 +1,6 @@
/*!
- * jss - find
+ * stats - find
* Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
@@ -1,6 +1,6 @@
/*!
- * jss - formats
+ * stats - formats
* Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
View
@@ -1,6 +1,6 @@
/*!
- * jss - formats - json
+ * stats - formats - json
* Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
View
@@ -1,6 +1,6 @@
/*!
- * jss - formats - text
+ * stats - formats - text
* Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
View
@@ -1,39 +0,0 @@
-
-/*!
- * jss
- * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Library version.
- */
-
-exports.version = '0.0.1';
-
-/**
- * Return stats for the given javascript `str`.
- *
- * @param {String} str
- * @return {Object}
- * @api public
- */
-
-exports.stats = require('./stats');
-
-/**
- * Find JavaScript files by the given `paths`
- * and callback `fn(err, files)`.
- *
- * @param {Array} paths
- * @param {Function} fn
- * @api public
- */
-
-exports.find = require('./find');
-
-/**
- * Expose formatters.
- */
-
-exports.formats = require('./formats');
Oops, something went wrong.

0 comments on commit 0ce762c

Please sign in to comment.