renamed the runner to sitespeed, yep its better

This commit is contained in:
soulgalore 2014-09-10 14:56:52 +02:00
parent 15d74fcdae
commit 14a7b2b80b
3 changed files with 15 additions and 15 deletions

View File

@ -1,8 +1,8 @@
#!/usr/bin/env node
var Runner = require('../lib/runner'),
var Sitespeed = require('../lib/sitespeed'),
config = require('../lib/conf');
var r = new Runner(config);
var sitespeed = new Sitespeed(config);
require('whereis')('java', function searched(err) {
// yep, we still need Java for the crawler & browsertime
@ -11,7 +11,7 @@ require('whereis')('java', function searched(err) {
'Could not find Java, make sure it is installed in your $PATH');
}
else {
r.run(function() {
sitespeed.run(function() {
// TODO this is only used to check that everything is ok
console.log('Finished callback');
});

View File

@ -21,7 +21,7 @@ var crawler = require('./crawler'),
childProcess = require('child_process'),
log = require('winston');
function Runner(config) {
function Sitespeed(config) {
this.config = config;
this.analyzer = new Analyzer();
this.collector = new Collector(config);
@ -36,7 +36,7 @@ function Runner(config) {
});
}
Runner.prototype.run = function(finshedCb) {
Sitespeed.prototype.run = function(finshedCb) {
finshedCb = finshedCb || function() {};
var self = this;
@ -66,7 +66,7 @@ Runner.prototype.run = function(finshedCb) {
};
Runner.prototype._analyzeSites = function(cb) {
Sitespeed.prototype._analyzeSites = function(cb) {
var self = this;
// store all site data here, use it when parsing
self.sites = {};
@ -108,7 +108,7 @@ Runner.prototype._analyzeSites = function(cb) {
});
};
Runner.prototype._setupConfigurationForSite = function(args, cb) {
Sitespeed.prototype._setupConfigurationForSite = function(args, cb) {
var url = args.url;
var config = args.runner.config;
@ -130,7 +130,7 @@ Runner.prototype._setupConfigurationForSite = function(args, cb) {
level: 'info'
});
*/
fs.mkdirs(dataDir, function(err) {
if (err) {
log.log('error', 'Couldnt create the data dir:' + dataDir + ' ' + err);
@ -142,7 +142,7 @@ Runner.prototype._setupConfigurationForSite = function(args, cb) {
};
Runner.prototype._analyzeSite = function(cb) {
Sitespeed.prototype._analyzeSite = function(cb) {
var self = this;
/**
@ -175,7 +175,7 @@ Runner.prototype._analyzeSite = function(cb) {
});
};
Runner.prototype._fineTuneUrls = function (okUrls, errorUrls, callback) {
Sitespeed.prototype._fineTuneUrls = function (okUrls, errorUrls, callback) {
var downloadErrors = {};
Object.keys(errorUrls).forEach(function(url) {
log.log('error', 'Failed to download ' + url);
@ -198,7 +198,7 @@ Runner.prototype._fineTuneUrls = function (okUrls, errorUrls, callback) {
}
};
Runner.prototype._fetchUrls = function (crawler, callback) {
Sitespeed.prototype._fetchUrls = function (crawler, callback) {
if (this.config.url) {
log.log('info', 'Will crawl from start point ' + this.config.url +
' with crawl depth ' + this.config.deep);
@ -220,7 +220,7 @@ Runner.prototype._fetchUrls = function (crawler, callback) {
}
};
Runner.prototype._analyze = function (urls, downloadErrors, callback) {
Sitespeed.prototype._analyze = function (urls, downloadErrors, callback) {
var analysisErrors = {};
var self = this;
log.log('info', 'Will analyze ' + urls.length + ' pages');
@ -282,7 +282,7 @@ function storeSummary(aggregates,cb, config) {
});
}
Runner.prototype._createOutput = function (downloadErrors, analysisErrors, callBack) {
Sitespeed.prototype._createOutput = function (downloadErrors, analysisErrors, callBack) {
log.log('info', 'Done analyzing urls');
// fetch all the data we need, and then generate the output
@ -396,4 +396,4 @@ function logVersions(cb) {
}
module.exports = Runner;
module.exports = Sitespeed;

View File

@ -40,7 +40,7 @@
"expect.js": "0.3.x",
"jshint":"2.5.3"
},
"main": "./lib/runner.js",
"main": "./lib/sitespeed.js",
"dependencies": {
"handlebars": "2.0.x",
"phantomjs": "1.9.x",