Sha256: fc312833e2a0ae447f4a25267dc913ffe6d9301e5dea26ea51acb1e9c526d2e8
Contents?: true
Size: 948 Bytes
Versions: 1
Compression:
Stored size: 948 Bytes
Contents
require "shelly" module Shelly class CLI < Thor include Thor::Actions autoload :User, "shelly/user" map %w(-v --version) => :version desc "version", "Displays shelly version" def version say "shelly version #{Shelly::VERSION}" end desc "register", "Registers new user at Shelly Cloud" def register email_question = User.guess_email.blank? ? "Email:" : "Email (default #{User.guess_email}):" email = ask(email_question) email = User.guess_email if email.blank? password = ask("Password:") if email.blank? or password.blank? say "Email and password can't be blank" and exit 1 end user = User.new(email, password) say "Check you mailbox for email confirmation" if user.register rescue Client::APIError => e if e.message == "Validation Failed" e.errors.each { |error| say "#{error.first} #{error.last}" } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shelly-0.0.2 | lib/shelly/cli.rb |