class RightHook::Authenticator

The authenticator provides an interface to retrieving or creating GitHub authorizations.

Public Class Methods

build(username, password) click to toggle source

Build a client with a username and an explicit password.

# File lib/right_hook/authenticator.rb, line 8
def build(username, password)
  new(Octokit::Client.new(login: username, password: password))
end
interactive_build(username) click to toggle source

Prompt the user for their password (without displaying the entered keys). This approach is offered for convenience to make it easier to not store passwords on disk.

# File lib/right_hook/authenticator.rb, line 14
def interactive_build(username)
  require 'io/console'
  puts "What is the password for #{username}? (Your typing will be hidden.)"
  new(Octokit::Client.new(login: username, password: $stdin.noecho(&:gets).chomp))
end