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