Sha256: dd843c829541dec1dd58efaeeeda651f2f15c94012d87a5c90d9bbeb9eb5c37d

Contents?: true

Size: 834 Bytes

Versions: 3

Compression:

Stored size: 834 Bytes

Contents

class Tane::Commands::Signup < Tane::Commands::Base
  include Tane::Helpers

  class << self
    def process(args)
      warn_if_credentials

      email, password = prompt_for_credentials

      auth_token, errors = Tane::Helpers::Bushido.signup(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


    def help_text
      <<-EOL
Usage:

    tane signup
    
Prompts you to signup for a Bushido account.
EOL
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tane-0.0.3 lib/tane/commands/signup.rb
tane-0.0.2 lib/tane/commands/signup.rb
tane-0.0.1 lib/tane/commands/signup.rb