Module: Git::Hub

Defined in:
lib/git/hub.rb

Class Method Summary collapse

Class Method Details

.client ⇒ Object



22
23
24
25
26
27
# File 'lib/git/hub.rb', line 22

def client
  @client ||= Octokit::Client.new(
    :access_token => Git::Multi::TOKEN,
    :auto_paginate => true,
  )
end

.connected? ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
36
37
38
39
40
# File 'lib/git/hub.rb', line 33

def connected?
  @connected ||= begin
    client.validate_credentials
    true
  rescue Faraday::ConnectionFailed
    false
  end
end

.login ⇒ Object

FIXME update login as part of --refresh



44
45
46
47
48
49
50
# File 'lib/git/hub.rb', line 44

def 
  @login ||= begin
    client.user.
  rescue Octokit::Unauthorized, Faraday::ConnectionFailed
    nil
  end
end

.org_repositories(org, type = :owner) ⇒ Object

all, public, private, forks, sources, member



90
91
92
# File 'lib/git/hub.rb', line 90

def org_repositories(org, type = :owner) # all, public, private, forks, sources, member
  @org_repositories[[org, type]]
end

.orgs ⇒ Object

FIXME update orgs as part of --refresh



54
55
56
57
58
59
60
# File 'lib/git/hub.rb', line 54

def orgs
  @orgs ||= begin
    client.organizations.map(&:login)
  rescue Octokit::Unauthorized, Faraday::ConnectionFailed
    []
  end
end

.user_repositories(user, type = :owner) ⇒ Object

all, owner, member



74
75
76
# File 'lib/git/hub.rb', line 74

def user_repositories(user, type = :owner) # all, owner, member
  @user_repositories[[user, type]]
end