Sha256: 167143b61a274f181d995a2ee93a304038bd35e46805e556db4cc95a7a28f8c2
Contents?: true
Size: 979 Bytes
Versions: 3
Compression:
Stored size: 979 Bytes
Contents
command :login do |c| c.syntax = 'loom login [options]' c.summary = 'log in with your theengine.co credentials' c.description = 'logging into theengine.co allows certain loom features to be unlocked, such as downloading the latest version of loom or installing a loom gem.' c.example 'login to theengine.co', 'loom login' setup_env c c.action do |args, options| setup_host options say "Logging in to: #{@host}" #ask for email and password email = ask("Email: ") user_password = password # send along the credentials endpoint = URI.parse("http://#{@host}/api/v1/session") response = Net::HTTP.post_form(endpoint, {"email" => email, "password" => user_password}) if response.code == "201" say_ok "Login successful!" File.open(File.expand_path(TOKEN_PATH) , 'w') {|f| f.write(response.body) } #save the token on disk else say_error "Login failed! #{response.body}" exit 1 end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
loom-0.0.46 | lib/loom/login.rb |
loom-0.0.45 | lib/loom/login.rb |
loom-0.0.43 | lib/loom/login.rb |