Skip to content
This repository has been archived by the owner on Dec 20, 2017. It is now read-only.

Commit

Permalink
put print function into class
Browse files Browse the repository at this point in the history
  • Loading branch information
jgallen23 committed May 24, 2012
1 parent fc18163 commit 9f1dbb6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
13 changes: 1 addition & 12 deletions bin/cube-reports.js 100644 → 100755
Expand Up @@ -19,18 +19,7 @@ if (argv._.length == 1) {
var reports = new Reports(file);

if (argv.print) {
reports.fetch(function(reports) {
reports.forEach(function(report) {
console.log(report.name);
console.log('================');
report.metrics.forEach(function(metric) {
console.log('%s: %s', metric.name, metric.count);
});
console.log('');
});

});

reports.print();
} else {
reports.send(function() {
console.log('Email Sent');
Expand Down
14 changes: 14 additions & 0 deletions lib/reports.js
Expand Up @@ -58,4 +58,18 @@ Reports.prototype.send = function(cb) {

};

Reports.prototype.print = function(cb) {
this.fetch(function(reports) {
reports.forEach(function(report) {
console.log(report.name);
console.log('================');
report.metrics.forEach(function(metric) {
console.log('%s: %s', metric.name, metric.count);
});
console.log('');
});
if (cb) cb();
});
};

module.exports = Reports;

0 comments on commit 9f1dbb6

Please sign in to comment.