Module: Git::Hub
- Defined in:
- lib/git/hub.rb
Class Method Summary collapse
- .client ⇒ Object
- .connected? ⇒ Boolean
-
.login ⇒ Object
FIXME: update login as part of ‘–refresh`.
- .org_repositories(org, type = :owner) ⇒ Object
-
.orgs ⇒ Object
FIXME: update orgs as part of ‘–refresh`.
- .query_args ⇒ Object
-
.repository_fields ⇒ Object
pick a (semi-)random repo from GitHub.
- .user_repositories(user, type = :owner) ⇒ Object
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
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 @login ||= begin client.user.login rescue Octokit::Unauthorized, Faraday::ConnectionFailed nil end end |
.org_repositories(org, type = :owner) ⇒ Object
103 104 105 106 |
# File 'lib/git/hub.rb', line 103 def org_repositories(org, type = :owner) # type can be one of: 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 |
.query_args ⇒ Object
68 69 70 71 72 |
# File 'lib/git/hub.rb', line 68 def query_args repository_fields.sort.each_slice(3).map { |foo, , qux| format('%-20s %-20s %-20s', foo, , qux).rstrip }.join("\n ") end |
.repository_fields ⇒ Object
pick a (semi-)random repo from GitHub
64 65 66 |
# File 'lib/git/hub.rb', line 64 def repository_fields client.repo('git/git').fields end |
.user_repositories(user, type = :owner) ⇒ Object
86 87 88 89 |
# File 'lib/git/hub.rb', line 86 def user_repositories(user, type = :owner) # type can be one of: all, owner, member @user_repositories[[user, type]] end |