Class: Snipe::InitCommand
- Defined in:
- lib/snipe/commands/init_command.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ InitCommand
constructor
A new instance of InitCommand.
- #run ⇒ Object
- #validate! ⇒ Object
Methods inherited from Command
#assert_configured!, #create_subject, options, report_error
Constructor Details
#initialize(argv) ⇒ InitCommand
Returns a new instance of InitCommand.
10 11 12 |
# File 'lib/snipe/commands/init_command.rb', line 10 def initialize(argv) # Prevent super from initializing stuff end |
Instance Method Details
#run ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/snipe/commands/init_command.rb', line 18 def run config = Config.new cli = HighLine.new config.api_key = cli.ask("MailGun API Key?") config.domain = cli.ask("Sending Domain?") config.from = cli.ask("Default \"From\" Address?") { |q| q.validate = Validate::EMAIL_REGEX # TODO: Better response on validation error } config.save puts "All done! You can now send email with snipe." end |
#validate! ⇒ Object
14 15 16 |
# File 'lib/snipe/commands/init_command.rb', line 14 def validate! # Prevent super from validating stuff end |