Class: DearS3::Cli::AuthenticationHelper
- Inherits:
-
Object
- Object
- DearS3::Cli::AuthenticationHelper
- Includes:
- Thor::Shell
- Defined in:
- lib/dears3/cli/authentication_helper.rb
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize(authentication) ⇒ AuthenticationHelper
constructor
A new instance of AuthenticationHelper.
- #maybe_get_credentials ⇒ Object
- #save_credentials!(credentials) ⇒ Object
Constructor Details
#initialize(authentication) ⇒ AuthenticationHelper
Returns a new instance of AuthenticationHelper.
6 7 8 |
# File 'lib/dears3/cli/authentication_helper.rb', line 6 def initialize authentication @authentication = authentication end |
Instance Method Details
#connect ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/dears3/cli/authentication_helper.rb', line 10 def connect begin authentication.connect rescue Errno::ENOENT say "Credentials file not found. Please run 's3:auth' to authenticate.", :red abort end end |
#maybe_get_credentials ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/dears3/cli/authentication_helper.rb', line 23 def maybe_get_credentials if File.exists?(credentials_path) && !override_credentials? nil else request_credentials end end |
#save_credentials!(credentials) ⇒ Object
19 20 21 |
# File 'lib/dears3/cli/authentication_helper.rb', line 19 def save_credentials! credentials authentication.create_credentials_file! credentials end |