Class: Tane::Commands::Signup

Inherits:
Base
  • Object
show all
Includes:
Helpers
Defined in:
lib/tane/commands/signup.rb

Class Method Summary collapse

Methods included from Helpers

included

Methods inherited from Base

fire

Class Method Details

.help_textObject



32
33
34
35
36
37
38
39
40
# File 'lib/tane/commands/signup.rb', line 32

def help_text
  <<-EOL
Usage:

tane signup

Prompts you to signup for a Cloudfuji account.
EOL
end

.process(args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/tane/commands/signup.rb', line 5

def process(args)
  warn_if_credentials

  email, password = prompt_for_credentials

  auth_token, errors = Tane::Helpers::Cloudfuji.(email, password)

  if auth_token.nil?
    term.say "Couldn't signup - "
    errors.each do |field|
      term.say "\n"
      field.last.each do |error|
        term.say "  #{field.first} #{error} \n"
      end
    end
    
    exit
  else
    term.say "Ok, you're signed up as #{email}!"
  end

  term.say "Done!"
  term.say "Saving credentials"
  save_credentials(email, auth_token)
end