frankendoc
Version:
bringing documents alive
60 lines (47 loc) • 1.46 kB
JavaScript
// Generated by CoffeeScript 1.3.3
(function() {
var Fiber, Frank;
require('fibrous');
Fiber = require('fibers');
Frank = (function() {
function Frank() {
require('./readers/settings').read();
this.docs = require('./readers/' + settings.docs.reader).read();
this.code = require('./readers/' + settings.code.reader).read();
this.runner = new (require('./runner/runner').Runner);
this.report = new (require('./reports/' + settings.report).Report);
}
Frank.prototype.run = function() {
this.report.start();
this.run_docs();
return this.report.stop();
};
Frank.prototype.run_docs = function() {
var doc, _i, _len, _ref, _results;
_ref = this.docs;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
doc = _ref[_i];
if (doc.is_suite) {
_results.push(this.report.suite(doc));
} else {
_results.push(this.run_doc(doc));
}
}
return _results;
};
Frank.prototype.run_doc = function(doc) {
this.report.running(doc.name);
return this.report.finished(this.run_steps(doc.steps));
};
Frank.prototype.run_steps = function(steps) {
return this.runner.run_steps(this.code["new"](), steps);
};
return Frank;
})();
this.frank = function() {
return Fiber(function() {
return new Frank().run();
}).run();
};
}).call(this);