Module: Git::Hub
- Defined in:
- lib/git/hub.rb
Class Method Summary collapse
- .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
.connected? ⇒ Boolean
30 31 32 33 34 35 36 37 |
# File 'lib/git/hub.rb', line 30 def connected? @connected ||= begin client.validate_credentials true rescue Faraday::ConnectionFailed false end end |
.login ⇒ Object
FIXME: update login as part of ‘–refresh`
41 42 43 44 45 46 47 |
# File 'lib/git/hub.rb', line 41 def login @login ||= begin client.user.login rescue Octokit::Unauthorized, Faraday::ConnectionFailed nil end end |
.org_repositories(org, type = :owner) ⇒ Object
102 103 104 105 |
# File 'lib/git/hub.rb', line 102 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`
51 52 53 54 55 56 57 |
# File 'lib/git/hub.rb', line 51 def orgs @orgs ||= begin client.organizations.map(&:login) rescue Octokit::Unauthorized, Faraday::ConnectionFailed [] end end |
.query_args ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/git/hub.rb', line 65 def query_args # rubocop:disable Style/FormatStringToken repository_fields.sort.each_slice(3).map { |foo, , qux| format('%-20s %-20s %-20s', foo, , qux).rstrip }.join("\n ") # rubocop:enable Style/FormatStringToken end |
.repository_fields ⇒ Object
pick a (semi-)random repo from GitHub
61 62 63 |
# File 'lib/git/hub.rb', line 61 def repository_fields client.repo('git/git').fields end |
.user_repositories(user, type = :owner) ⇒ Object
85 86 87 88 |
# File 'lib/git/hub.rb', line 85 def user_repositories(user, type = :owner) # type can be one of: all, owner, member @user_repositories[[user, type]] end |