module.exports.init = function(callback) { var setupMail = function(err, result) { if(!config.from) { config.from = config.email } if(!config.smtp) { config.smtp = 'smtp.gmail.com' } if(!config.user) { config.user = config.email } if(result) { log.info('Got it.'); config.password = result.password; } server = email.server.connect({ user: config.user, password: config.password, host: config.smtp, ssl: true }); if(config.sendMailOnStart) { server.send({ from: "Gekko <" + config.from + ">", to: "Bud Fox <" + config.email + ">", subject: "Gekko has started", text: [ "I've just started watching the markets, ", "I'll let you know when I got some advice" ].join('') }, send); } log.debug('Setup email adviser.'); callback(); } if(!config.password) { // ask for the mail password var prompt = require('prompt-lite'); prompt.start(); var warning = [ '\n\n\tYou configured Gekko to mail you advice, Gekko needs your email', 'password to send emails (to you). Gekko is an opensource project', '[ http://github.com/askmike/gekko ], you can take my word but always', 'check the code yourself.', '\n\n\tWARNING: If you have not downloaded Gekko from the github page above we', 'CANNOT garantuee that your email address & password are safe!\n' ].join('\n\t'); log.warn(warning); prompt.get({name: 'password', hidden: true}, setupMail); } else { setupMail(false, false); } }
module.exports.init = function(callback) { var setupMail = function(err, result) { if(result) { log.info('Got it.'); config.password = result.password; } server = email.server.connect({ user: config.email, password: config.password, host: "smtp.gmail.com", ssl: true }); log.debug('Setup email adviser.'); callback(); } if(!config.password) { // ask for the mail password var prompt = require('prompt-lite'); prompt.start(); var warning = [ '\n\n\tYou configured Gekko to mail you advice, Gekko needs your email', 'password to send emails (to you). Gekko is an opensource project', '[ http://github.com/askmike/gekko ], you can take my word but always', 'check the code yourself.', '\n\n\tWARNING: If you have not downloaded Gekko from the github page above we', 'CANNOT garantuee that your email address & password are safe!\n' ].join('\n\t'); log.warn(warning); prompt.get({name: 'password', hidden: true}, setupMail); } else { setupMail(false, false); } }
Mailer.prototype.setup = function(done) { var setupMail = function(err, result) { if(result) { console.log('Got it.'); mailConfig.password = result.password; } if(_.isEmpty(mailConfig.to)) mailConfig.to = mailConfig.email; if(_.isEmpty(mailConfig.from)) mailConfig.from = mailConfig.email; if(_.isEmpty(mailConfig.user) && mailConfig.smtpauth) mailConfig.user = mailConfig.email; this.server = email.server.connect({ user: mailConfig.user, password: mailConfig.password, host: mailConfig.server, ssl: mailConfig.ssl, port: mailConfig.port, tls: mailConfig.tls }); if(mailConfig.sendMailOnStart) { this.mail( "Gekko has started", [ "I've just started watching ", config.watch.exchange, ' ', config.watch.currency, '/', config.watch.asset, ". I'll let you know when I got some advice" ].join(''), _.bind(function(err) { this.checkResults(err); this.done(); }, this) ); } else this.done(); log.debug('Setup email adviser.'); }; if(!mailConfig.password) { // ask for the mail password var prompt = require('prompt-lite'); prompt.start(); var warning = [ '\n\n\tYou configured Gekko to mail you advice, Gekko needs your email', 'password to send emails (to you). Gekko is an opensource project', '[ http://github.com/askmike/gekko ], you can take my word but always', 'check the code yourself.', '\n\n\tWARNING: If you have not downloaded Gekko from the github page above we', 'CANNOT guarantuee that your email address & password are safe!\n' ].join('\n\t'); log.warn(warning); prompt.get({name: 'password', hidden: true}, _.bind(setupMail, this)); } else { setupMail.call(this); } };
askAndroidPromptResult(config); promptQuestionsResult(config); } else if (isNativeScriptCLI250 && process.argv.indexOf("setup") === -1) { console.log("*******************************************************************"); console.log("*******************************************************************"); console.log("************************** IMPORTANT: *****************************"); console.log("******************* with nativescript 2.5.0 *********************"); console.log("************** now execute 'npm run setup' manually ***************"); console.log("***** in the node_modules/nativescript-plugin-firebase folder *****"); console.log("*******************************************************************"); console.log("*******************************************************************"); } else if (!isInteractive()) { console.log("No existing " + pluginConfigFile + " config file found and terminal is not interactive! Default configuration will be used."); } else { console.log("No existing " + pluginConfigFile + " config file found, so let's configure the Firebase plugin!"); prompt.start(); askiOSPrompt(); } /** * Prompt the user if they are integrating Firebase with iOS */ function askiOSPrompt() { prompt.get({ name: 'using_ios', description: 'Are you using iOS (y/n)', default: 'y' }, function (err, result) { if (err) { return console.log(err); }