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 4 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
46 changes: 28 additions & 18 deletions lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ 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

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

Expand All @@ -424,19 +426,21 @@ 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();
}

Expand All @@ -449,13 +453,12 @@ Origin.prototype.startServer = function () {
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) {
console.log(chalk.green('Adapt Framework %s'), installedFrameworkVersion);
Copy link
Member

Choose a reason for hiding this comment

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

can we use the logger module rather than the console?

} else {
console.log(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");
Expand Down Expand Up @@ -571,7 +574,13 @@ Origin.prototype.restartServer = function () {
* @api public
*/

Origin.prototype.run = function () {
Origin.prototype.run = function (options) {
if (!options) {
Copy link
Member

Choose a reason for hiding this comment

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

just saw this - this would be better in the startServer function

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree.

options = {
skipVersionCheck: false
};
}

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

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


Expand All @@ -602,6 +611,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