Skip to content

Commit

Permalink
feat: display the version when starting
Browse files Browse the repository at this point in the history
Closes #391
  • Loading branch information
vojtajina committed Mar 13, 2013
1 parent 21dd142 commit 3961739
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ var start = function(injector, config, launcher, globalEmitter, preprocess, file
});

webServer.listen(config.port, function() {
log.info('Testacular server started at http:https://%s:%s%s', config.hostname, config.port,
config.urlRoot);
log.info('Testacular v%s server started at http:https://%s:%s%s', constant.VERSION, config.hostname,
config.port, config.urlRoot);

if (config.browsers && config.browsers.length) {
injector.invoke(launcher.launch, launcher);
Expand Down
4 changes: 3 additions & 1 deletion lib/web-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var httpProxy = require('http-proxy');
var pause = require('pause');
var mime = require('mime');

var VERSION = require('./constants').VERSION;
var helper = require('./helper');
var proxy = require('./proxy');
var log = require('./logger').create('web server');
Expand Down Expand Up @@ -66,7 +67,8 @@ var createTestacularSourceHandler = function(promiseContainer, staticFolder, ada
// SERVE testacular.js
if (requestUrl === '/testacular.js') {
return serveStaticFile(staticFolder + '/testacular.js', response, function(data) {
return data.replace('%TESTACULAR_SRC_PREFIX%', urlRoot.substring(1));
return data.replace('%TESTACULAR_SRC_PREFIX%', urlRoot.substring(1))
.replace('%TESTACULAR_VERSION%', VERSION);
});
}

Expand Down
6 changes: 5 additions & 1 deletion static/testacular.src.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var CONTEXT_URL = 'context.html';
var VERSION = '%TESTACULAR_VERSION%';

// connect socket.io
// https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO
Expand Down Expand Up @@ -27,7 +28,8 @@ var titleElement = document.getElementById('title');
var bannerElement = document.getElementById('banner');
var updateStatus = function(status) {
return function(param) {
titleElement.innerHTML = 'Testacular - ' + (param ? status.replace('$', param) : status);
var paramStatus = param ? status.replace('$', param) : status;
titleElement.innerHTML = 'Testacular v' + VERSION + ' - ' + paramStatus;
bannerElement.className = status === 'connected' ? 'online' : 'offline';
};
};
Expand All @@ -44,6 +46,8 @@ var Testacular = function(socket, context, navigator, location) {
var hasError = false;
var store = {};

this.VERSION = VERSION;

this.setupContext = function(contextWindow) {

var getConsole = function(currentWindow) {
Expand Down

0 comments on commit 3961739

Please sign in to comment.