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



14
15
16
# File 'lib/auth/github.rb', line 14

def self.client
  new.client
end

Instance Method Details

#clientObject



18
19
20
21
22
23
24
25
# File 'lib/auth/github.rb', line 18

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