-
Notifications
You must be signed in to change notification settings - Fork 288
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
Issue/788 #801
Changes from 4 commits
cc5974e
351dbf7
f275862
17c8ad2
e0372bb
d5814d7
9b48032
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -362,7 +362,7 @@ Origin.prototype.createServer = function (options, cb) { | |
}, configuration.getConfig('dbName')); | ||
}; | ||
|
||
Origin.prototype.startServer = function () { | ||
Origin.prototype.startServer = function (options) { | ||
// configure server | ||
var serverOptions = {}; | ||
if (!this.configuration || !this.configuration.getConfig('dbName')) { | ||
|
@@ -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(); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: { | ||
|
@@ -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; | ||
} | ||
|
@@ -412,7 +414,7 @@ Origin.prototype.startServer = function () { | |
}); | ||
}, | ||
function(callback) { | ||
if (true === configuration.getConfig('isTestEnvironment')) { | ||
if (true === configuration.getConfig('isTestEnvironment') || options.skipVersionCheck) { | ||
return callback(); | ||
} | ||
|
||
|
@@ -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(); | ||
} | ||
|
||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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"); | ||
|
@@ -571,7 +574,13 @@ Origin.prototype.restartServer = function () { | |
* @api public | ||
*/ | ||
|
||
Origin.prototype.run = function () { | ||
Origin.prototype.run = function (options) { | ||
if (!options) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just saw this - this would be better in the startServer function There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 { | ||
|
@@ -584,7 +593,7 @@ Origin.prototype.run = function () { | |
} | ||
app.mailer = new Mailer(); | ||
|
||
app.startServer(); | ||
app.startServer(options); | ||
}); | ||
|
||
|
||
|
@@ -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(); | ||
}; | ||
|
||
|
There was a problem hiding this comment.
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:
or similar