Class: FallCli::Middleware::CheckCredentials

Inherits:
Base
  • Object
show all
Defined in:
lib/fallcli/middleware/check_credentials.rb

Constant Summary

Constants inherited from Base

Base::CLEAR, Base::GREEN, Base::RED, Base::YELLOW

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from FallCli::Middleware::Base

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fallcli/middleware/check_credentials.rb', line 8

def call(env)

  say "Checking credentials with Dropbox..."

  begin
      env['dropbox-client'].ls
  rescue Dropbox::API::Error => e
      say "Connection to Dropbox failed (#{e})", :red
      say "Check your ~/.fallcli/config file, and double check your credentials are correct", :yellow
      exit 1
  end

  say "Connection to dropbox successful!", :green

  @app.call(env)
end