Class: Fue::Auth
- Inherits:
-
Object
- Object
- Fue::Auth
- Defined in:
- lib/fue/auth.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.instance ⇒ Object
5 6 7 |
# File 'lib/fue/auth.rb', line 5 def self.instance @instance ||= new end |
Instance Method Details
#token ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fue/auth.rb', line 9 def token = { username: username, server: 'github.com', label: 'fue' } stored_token = Fue::Security.get() unless stored_token stored_token = github_token Fue::Security.store!(.merge(password: stored_token)) puts 'Token saved to keychain.' end stored_token end |
#username ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/fue/auth.rb', line 20 def username @username ||= begin username = get_git_username&.chomp username = get_username if username.nil? || username.empty? username end end |