Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/788 #801

Merged
merged 7 commits into from
Sep 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/core/scaffold/scaffoldOverrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ define(function(require) {
{ name: 'styles', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock']},
{ name: 'links', items: [ 'Link', 'Unlink' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
{ name: 'insert', items: [ 'SpecialChar' ] },
{ name: 'insert', items: [ 'SpecialChar', 'Table' ] },
{ name: 'tools', items: [ ] },
{ name: 'others', items: [ '-' ] }
],
Expand Down
55 changes: 32 additions & 23 deletions lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,13 @@ Origin.prototype.createServer = function (options, cb) {
}, configuration.getConfig('dbName'));
};

Origin.prototype.startServer = function () {
Origin.prototype.startServer = function (options) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

options should be checked, and defaulted if not passed:

options = 'undefined' === typeof options ? { skipVersionCheck: false } : options;

or similar


// Ensure that the options object is set.
options = typeof options === 'undefined'
? { skipVersionCheck: false }
: options;

// configure server
var serverOptions = {};
if (!this.configuration || !this.configuration.getConfig('dbName')) {
Expand All @@ -388,10 +394,10 @@ Origin.prototype.startServer = function () {
callback();
},
function(callback) {
if (true === configuration.getConfig('isTestEnvironment')) {
if (true === configuration.getConfig('isTestEnvironment') || options.skipVersionCheck) {
return callback();
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you enabled .editorconfig in your editor and merge the develop branch, you'll not add this kind of whitespace ;)

// Check the latest version of the project
request({
headers: {
Expand All @@ -400,9 +406,11 @@ Origin.prototype.startServer = function () {
uri: 'https://api.github.com/repos/adaptlearning/adapt_authoring/tags',
method: 'GET'
}, function (error, response, body) {
if (!error && response.statusCode == 200) {
if (error) {
logger.log('error', error);
} else if (response.statusCode == 200) {
var tagInfo = JSON.parse(body);

if (tagInfo) {
latestBuilderTag = tagInfo[0].name;
}
Expand All @@ -412,7 +420,7 @@ Origin.prototype.startServer = function () {
});
},
function(callback) {
if (true === configuration.getConfig('isTestEnvironment')) {
if (true === configuration.getConfig('isTestEnvironment') || options.skipVersionCheck) {
return callback();
}

Expand All @@ -424,42 +432,42 @@ Origin.prototype.startServer = function () {
uri: 'https://api.github.com/repos/adaptlearning/adapt_framework/tags',
method: 'GET'
}, function (error, response, body) {
if (!error && response.statusCode == 200) {
if (error) {
logger.log('error', error);
} else if (response.statusCode == 200) {
var tagInfo = JSON.parse(body);

if (tagInfo) {
latestFrameworkTag = tagInfo[0].name;
}
}
}

callback();
});
},
function(callback) {
if (true === configuration.getConfig('isTestEnvironment')) {
if (true === configuration.getConfig('isTestEnvironment') || options.skipVersionCheck) {
return callback();
}

var isUpdateAvailable = false;

if (installedBuilderVersion == latestBuilderTag) {
console.log(chalk.green('Adapt Builder %s'), installedBuilderVersion);
logger.log('info', chalk.green('Adapt Builder %s'), installedBuilderVersion);
} else {
console.log(chalk.yellow('You are currently running Adapt Builder %s - %s is now available'), installedBuilderVersion, latestBuilderTag);
logger.log('info', chalk.yellow('You are currently running Adapt Builder %s - %s is now available'), installedBuilderVersion, latestBuilderTag);
isUpdateAvailable = true;
}

// @TODO #771 - remove this check until the builder supports v2 of the framework
// if (installedFrameworkVersion == latestFrameworkTag) {
// console.log(chalk.green('Adapt Framework %s'), installedFrameworkVersion);
// } else {
// console.log(chalk.yellow('The Adapt Framework being used is %s - %s is now available'), installedFrameworkVersion, latestFrameworkTag);
// isUpdateAvailable = true;
// }
if (installedFrameworkVersion == latestFrameworkTag) {
logger.log('info', chalk.green('Adapt Framework %s'), installedFrameworkVersion);
} else {
logger.log('info', chalk.yellow('The Adapt Framework being used is %s - %s is now available'), installedFrameworkVersion, latestFrameworkTag);
isUpdateAvailable = true;
}

if (isUpdateAvailable) {
console.log("Run " + chalk.bgRed('"node upgrade.js"') + " to update to the latest version");
console.log();
logger.log('info', "Run " + chalk.bgRed('"node upgrade.js"') + " to update to the latest version");
}

callback();
Expand Down Expand Up @@ -561,7 +569,7 @@ Origin.prototype.restartServer = function () {
app.startServer();
});
} catch (error) {
console.log(error);
logger.log('error', error);
}
}
};
Expand All @@ -571,7 +579,7 @@ Origin.prototype.restartServer = function () {
* @api public
*/

Origin.prototype.run = function () {
Origin.prototype.run = function (options) {
// some modules are loaded async, so wait for them before actually starting the server
this.once('modulesReady', function (app) {
try {
Expand All @@ -584,7 +592,7 @@ Origin.prototype.run = function () {
}
app.mailer = new Mailer();

app.startServer();
app.startServer(options);
});


Expand All @@ -602,6 +610,7 @@ Origin.prototype.run = function () {
this.preloadModule('usermanager', require('./usermanager'));
this.preloadModule('tenantmanager', require('./tenantmanager'));
this.preloadModule('rolemanager', require('./rolemanager'));
this.preloadModule('bowermanager', require('./bowermanager'));
this.preload();
};

Expand Down
Loading