Class: Tugboat::Middleware::CheckConfiguration
- Defined in:
- lib/tugboat/middleware/check_configuration.rb
Overview
Check if the client has set-up configuration yet.
Constant Summary
Constants inherited from Base
Base::CLEAR, Base::GREEN, Base::RED, Base::YELLOW
Instance Method Summary collapse
Methods inherited from Base
#check_response_success, #get_droplet_list, #initialize, #print_droplet_info, #print_droplet_info_full, #response_stringify, #restart_droplet, #verify_credentials, #wait_for_state
Constructor Details
This class inherits a constructor from Tugboat::Middleware::Base
Instance Method Details
#call(env) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/tugboat/middleware/check_configuration.rb', line 5 def call(env) config = env['config'] if !config || !config.data || !config.access_token say 'You must run `tugboat authorize` in order to connect to DigitalOcean', :red exit 1 end # If the user passes the global `-q/--quiet` flag, redirect # stdout $stdout = File.new('/dev/null', 'w') if env['user_quiet'] @app.call(env) end |