Class: GitHubAuth

Inherits:
Object
  • Object
show all
Defined in:
lib/auth/github.rb

Constant Summary collapse

NOTE =

Change NOTE, SCOPES and CREDENTIALS to match your app’s needs.

"Pullcrusher!"
SCOPES =
["user","repo"]
CREDENTIALS =
File.join("#{ENV['HOME']}", ".config", "pullcrusher.yml")

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.clientObject



17
18
19
# File 'lib/auth/github.rb', line 17

def self.client
  new.client
end

Instance Method Details

#clientObject



21
22
23
24
25
26
27
28
# File 'lib/auth/github.rb', line 21

def client
  @client ||= lambda do
    unless File.exist?(CREDENTIALS)
      authenticate
    end
    Octokit::Client.new(YAML.load_file(CREDENTIALS))
  end.call
end