Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

documented

  • Loading branch information...
commit 0334e6467741d4a15c194ec8175a26ee6b50cabc 1 parent c49b652
@substack authored
Showing with 66 additions and 14 deletions.
  1. +5 −1 bin/cmd.js
  2. +61 −13 readme.markdown
View
6 bin/cmd.js
@@ -1,10 +1,14 @@
#!/usr/bin/env node
var codebux = require('../');
-var dir = process.argv[2] || process.cwd();
+var dir = process.argv[2];
var path = require('path');
var Stream = require('stream');
+if (process.argv.length === 2) {
+ return console.error('usage: codebux [file or directory]');
+}
+
var s = codebux(dir, function (err, total) {
if (err) console.error(err)
else console.log(Array(50).join('') + '\n' + formatPrice(total))
View
74 readme.markdown
@@ -3,18 +3,66 @@
This program computes technical debt for node programs.
Lines of code are spent. You start at $100. You don't get any more codebux.
-There are many ways to fuck up:
+
+You lose codebux for:
* too much code
-* too much indentation
-* too much nested state
-* not having tests
-* not having a readme
-* not having examples
-* not having code in your readme
-
-Your codebux doesn't stop at $0. It could very easily be in the negative
-hundreds of thousands or even millions for especially sprawling projects.
-
-Such is the pernicious trap of technical debt. It's quite easy to destroy more
-value than you create.
+* too many deeply-nested expressions
+
+Your codebux score doesn't stop at $0, it keeps going down into the negative
+numbers.
+
+# usage
+
+```
+usage: codebux [file or directory]
+```
+
+# methods
+
+``` js
+var codebux = require('codebux')
+```
+
+## var s = codebux(file, cb)
+
+Compute the codebux for file or directory entry point `file`. This file or
+directory's dependency graph will be recursively traversed to compute the score.
+
+At the end of the traversal, `cb(err, total)` fires with the final codebux
+tally.
+
+Returns an event emitter that you can latch onto for the specific scores for
+each file along the way.
+
+# events
+
+## s.on('price', fucntion (price, desc) { ... })
+
+Emitted when a price gets computed, including the description of the price.
+
+## s.on('total', function (total) { ... })
+
+Emitted with the running total every time a cost gets computed.
+
+## s.on('file', function (price, file)
+
+Emitted when a file's cost has been completely calculated.
+
+# install
+
+With [npm](http://npmjs.org), to get the bin script do:
+
+```
+npm install -g codebux
+```
+
+and to get the library do:
+
+```
+npm install codebux
+```
+
+# license
+
+MIT
Please sign in to comment.
Something went wrong with that request. Please try again.