Use async series in installer for better readability

pull/10/head
Chocobozzz 2016-05-13 21:34:47 +02:00
parent 1cad0f395f
commit cefc718dd6
1 changed files with 14 additions and 12 deletions

View File

@ -16,21 +16,23 @@ const installer = {
}
function installApplication (callback) {
// Creates directories
createDirectoriesIfNotExist(function (err) {
if (err) return callback(err)
async.series([
function createDirectories (callbackAsync) {
createDirectoriesIfNotExist(callbackAsync)
},
// ----------- Create the certificates if they don't already exist -----------
peertubeCrypto.createCertsIfNotExist(function (err) {
if (err) return callback(err)
function createCertificates (callbackAsync) {
peertubeCrypto.createCertsIfNotExist(callbackAsync)
},
createOAuthClientIfNotExist(function (err) {
if (err) return callback(err)
function createOAuthClient (callbackAsync) {
createOAuthClientIfNotExist(callbackAsync)
},
createOAuthUserIfNotExist(callback)
})
})
})
function createOAuthUser (callbackAsync) {
createOAuthUserIfNotExist(callbackAsync)
}
], callback)
}
// ---------------------------------------------------------------------------