Update generator.js

Added Mandrill option to generator
This commit is contained in:
Jake Larson
2014-04-23 11:56:57 -05:00
parent ab9dc26340
commit b8dbe3cebe

View File

@@ -30,7 +30,7 @@ inquirer.prompt({
type: 'list', type: 'list',
name: 'email', name: 'email',
message: 'Choose Email Delivery Service:', message: 'Choose Email Delivery Service:',
choices: ['SendGrid', 'Mailgun', 'Cancel'] choices: ['SendGrid', 'Mailgun', 'Mandrill', 'Cancel']
}, function(answer) { }, function(answer) {
var index; var index;
@@ -86,6 +86,29 @@ inquirer.prompt({
console.log('✓ Email Delivery Service has been switched to'.info, '@'.error + 'mail'.data + 'gun'.error); console.log('✓ Email Delivery Service has been switched to'.info, '@'.error + 'mail'.data + 'gun'.error);
} }
if (answer.email.match('Mandrill')) {
// Change SMPT Transport to Mailgun in controllers/contact.js
index = contactController.indexOf('var smtpTransport = nodemailer.createTransport(\'SMTP\', {');
contactController.splice(index + 1, 1, ' service: \'Mandrill\',');
contactController.splice(index + 3, 1, ' user: secrets.mandrill.login,');
contactController.splice(index + 4, 1, ' pass: secrets.mandrill.password');
fs.writeFileSync(contactControllerFile, contactController.join(os.EOL));
// Change SMPT Transport to Mailgun in controllers/user.js
index = userController.indexOf(' var smtpTransport = nodemailer.createTransport(\'SMTP\', {');
userController.splice(index + 1, 1, ' service: \'Mandrill\',');
userController.splice(index + 3, 1, ' user: secrets.mandrill.login,');
userController.splice(index + 4, 1, ' pass: secrets.mandrill.password');
index = userController.indexOf(' var smtpTransport = nodemailer.createTransport(\'SMTP\', {', 1);
userController.splice(index + 1, 1, ' service: \'Mandrill\',');
userController.splice(index + 3, 1, ' user: secrets.mandrill.login,');
userController.splice(index + 4, 1, ' pass: secrets.mandrill.password');
fs.writeFileSync(userControllerFile, userController.join(os.EOL));
console.log('✓ Email Delivery Service has been switched to'.info, 'Mandrill'.help);
}
}); });
} }
@@ -1039,4 +1062,4 @@ inquirer.prompt({
} }
}); });
} }
}); });