module Git::Hub
Public Instance Methods
client()
click to toggle source
# File lib/git/hub.rb, line 21 def client @client ||= Octokit::Client.new( access_token: Git::Multi::TOKEN, auto_paginate: true, ) end
connected?()
click to toggle source
# File lib/git/hub.rb, line 30 def connected? @connected ||= begin client.validate_credentials true rescue Faraday::ConnectionFailed false end end
login()
click to toggle source
FIXME: update login as part of `–refresh`
# 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)
click to toggle source
# 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()
click to toggle source
FIXME: update orgs as part of `–refresh`
# File lib/git/hub.rb, line 51 def orgs @orgs ||= begin client.organizations.map(&:login) rescue Octokit::Unauthorized, Faraday::ConnectionFailed [] end end
query_args()
click to toggle source
# File lib/git/hub.rb, line 65 def query_args # rubocop:disable Style/FormatStringToken repository_fields.sort.each_slice(3).map { |foo, bar, qux| format('%-20s %-20s %-20s', foo, bar, qux).rstrip }.join("\n ") # rubocop:enable Style/FormatStringToken end
repository_fields()
click to toggle source
pick a (semi-)random repo from GitHub
# File lib/git/hub.rb, line 61 def repository_fields client.repo('git/git').fields end
user_repositories(user, type = :owner)
click to toggle source
# 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