Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Formatting and Indentation
Browse files Browse the repository at this point in the history
Changes to formatting and indentation.
  • Loading branch information
mleanos committed Oct 9, 2015
1 parent 0560062 commit 75cf745
Show file tree
Hide file tree
Showing 2 changed files with 148 additions and 135 deletions.
52 changes: 27 additions & 25 deletions config/lib/seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ function checkUserNotExists (user) {
function reportSuccess (password) {
return function (user) {
return new Promise(function (resolve, reject) {
if (seedOptions.logResults) console.log(chalk.bold.red('Database Seeding:\t\t\tLocal ' + user.username + ' added with password set to ' + password));
if (seedOptions.logResults) {
console.log(chalk.bold.red('Database Seeding:\t\t\tLocal ' + user.username + ' added with password set to ' + password));
}
resolve();
});
};
Expand All @@ -73,24 +75,24 @@ function seedTheUser (user) {

if (user.username === seedOptions.seedAdmin.username && process.env.NODE_ENV === 'production') {
checkUserNotExists(user)
.then(saveUser(user))
.then(reportSuccess(password))
.then(function () {
resolve();
})
.catch(function (err) {
reject(err);
});
.then(saveUser(user))
.then(reportSuccess(password))
.then(function () {
resolve();
})
.catch(function (err) {
reject(err);
});
} else {
removeUser(user)
.then(saveUser(user))
.then(reportSuccess(password))
.then(function () {
resolve();
})
.catch(function (err) {
reject(err);
});
.then(saveUser(user))
.then(reportSuccess(password))
.then(function () {
resolve();
})
.catch(function (err) {
reject(err);
});
}
});
};
Expand Down Expand Up @@ -135,22 +137,22 @@ module.exports.start = function start(options) {
//If production only seed admin if it does not exist
if (process.env.NODE_ENV === 'production') {
User.generateRandomPassphrase()
.then(seedTheUser(adminAccount))
.then(function () {
.then(seedTheUser(adminAccount))
.then(function () {
resolve();
})
.catch(reportError(reject));
.catch(reportError(reject));
} else {
// Add both Admin and User account

User.generateRandomPassphrase()
.then(seedTheUser(userAccount))
.then(User.generateRandomPassphrase)
.then(seedTheUser(adminAccount))
.then(function () {
.then(seedTheUser(userAccount))
.then(User.generateRandomPassphrase)
.then(seedTheUser(adminAccount))
.then(function () {
resolve();
})
.catch(reportError(reject));
.catch(reportError(reject));
}
});
};
Loading

0 comments on commit 75cf745

Please sign in to comment.