fixed setup script
modified: public/dist/application.js modified: public/dist/application.min.js
This commit is contained in:
parent
20634f8f19
commit
e6660308fa
|
@ -19,7 +19,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "grunt",
|
"start": "grunt",
|
||||||
"test": "grunt test && grunt coveralls",
|
"test": "grunt test && grunt coveralls",
|
||||||
"postinstall": "bower install --config.interactive=false; grunt build"
|
"postinstall": "bower install --config.interactive=false; grunt build; node scripts/setup.js;"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "^1.4.2",
|
"async": "^1.4.2",
|
||||||
|
|
|
@ -172,50 +172,51 @@ var questions = [
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
console.log(chalk.green('\n\nHi, welcome to TellForm Setup'));
|
if(!fs.existsSync('./\.env')) {
|
||||||
|
console.log(chalk.green('\n\nHi, welcome to TellForm Setup'));
|
||||||
|
|
||||||
console.log(chalk.green('You should only run this the first time you setup TellForm\n--------------------------------------------------\n\n'));
|
console.log(chalk.green('You should only run this the first time you setup TellForm\n--------------------------------------------------\n\n'));
|
||||||
|
|
||||||
inquirer.prompt([questions[0]]).then(function (confirmAns) {
|
inquirer.prompt([questions[0]]).then(function (confirmAns) {
|
||||||
if(confirmAns['shouldContinue']) {
|
if (confirmAns['shouldContinue']) {
|
||||||
|
|
||||||
inquirer.prompt(questions.slice(1)).then(function (answers) {
|
inquirer.prompt(questions.slice(1)).then(function (answers) {
|
||||||
answers['NODE_ENV'] = 'production';
|
answers['NODE_ENV'] = 'production';
|
||||||
answers['SIGNUP_DISABLED'] = false ? answers['SIGNUP_DISABLED'] === false : true;
|
answers['SIGNUP_DISABLED'] = false ? answers['SIGNUP_DISABLED'] === false : true;
|
||||||
|
|
||||||
|
var email = answers['email'];
|
||||||
|
var pass = answers['password'];
|
||||||
|
delete answers['email'];
|
||||||
|
delete answers['password'];
|
||||||
|
|
||||||
var email = answers['email'];
|
envfile.stringify(answers, function (err, str) {
|
||||||
var pass = answers['password'];
|
fs.outputFile('./\.env', str, function (err) {
|
||||||
delete answers['email'];
|
if (err) return console.error(chalk.red(err));
|
||||||
delete answers['password'];
|
console.log(chalk.green('Successfully created .env file'));
|
||||||
|
});
|
||||||
|
user = new User({
|
||||||
|
firstName: 'Admin',
|
||||||
|
lastName: 'Account',
|
||||||
|
email: email,
|
||||||
|
username: email,
|
||||||
|
password: pass,
|
||||||
|
provider: 'local',
|
||||||
|
roles: ['admin', 'user']
|
||||||
|
});
|
||||||
|
|
||||||
envfile.stringify(answers, function (err, str) {
|
user.save(function (err) {
|
||||||
fs.outputFile('..//.env', str, function(err){
|
if (err) return console.error(chalk.red(err));
|
||||||
if (err) return console.error(chalk.red(err));
|
console.log(chalk.green('Successfully created user'));
|
||||||
console.log(chalk.green('Successfully created .env file'));
|
delete email;
|
||||||
});
|
delete pass;
|
||||||
user = new User({
|
|
||||||
firstName: 'Admin',
|
|
||||||
lastName: 'Account',
|
|
||||||
email: email,
|
|
||||||
username: email,
|
|
||||||
password: pass,
|
|
||||||
provider: 'local',
|
|
||||||
roles: ['admin', 'user']
|
|
||||||
});
|
|
||||||
|
|
||||||
user.save(function (err) {
|
console.log(chalk.green('Have fun using TellForm!'));
|
||||||
if (err) return console.error(chalk.red(err));
|
process.exit(1);
|
||||||
console.log(chalk.green('Successfully created user'));
|
});
|
||||||
delete email;
|
|
||||||
delete pass;
|
|
||||||
|
|
||||||
console.log(chalk.green('Have fun using TellForm!'));
|
|
||||||
process.exit(1);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
} else {
|
||||||
} else {
|
console.log(chalk.green('Have fun using TellForm!'));
|
||||||
console.log(chalk.green('Have fun using TellForm!'));
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
|
|
Loading…
Reference in a new issue