class QB::Repo::Git::GitHub
Git repo where the `origin` remote points to GitHub
, which is used to determine it's owner and name.
Constants
- HTTPS_URL_RE
- SSH_URL_RE
Constants
¶ ↑
Public Class Methods
https_url?(string)
click to toggle source
# File lib/qb/repo/git/github.rb, line 62 def self.https_url? string !!(HTTPS_URL_RE =~ string) end
parse_https_url(string)
click to toggle source
# File lib/qb/repo/git/github.rb, line 77 def self.parse_https_url string parse_url_with HTTPS_URL_RE, string end
parse_ssh_url(string)
click to toggle source
# File lib/qb/repo/git/github.rb, line 72 def self.parse_ssh_url string parse_url_with SSH_URL_RE, string end
parse_url(string)
click to toggle source
Extract owner and name from Git remote URL string pointing to GitHub
.
@return [nil]
If the URL is not recognized.
@return [QB::GitHub::RepoID]
If the URL successfully parses.
# File lib/qb/repo/git/github.rb, line 90 def self.parse_url string parse_ssh_url( string ) || parse_https_url( string ) end
ssh_url?(string)
click to toggle source
Helpers
# File lib/qb/repo/git/github.rb, line 57 def self.ssh_url? string !!(SSH_URL_RE =~ string) end
url?(string)
click to toggle source
# File lib/qb/repo/git/github.rb, line 67 def self.url? string ssh_url?( string ) || https_url?( string ) end
Protected Class Methods
parse_url_with(regexp, string)
click to toggle source
@todo Document parse_url_with
method.
@param [type] arg_name
@todo Add name param description.
@return [return_type]
@todo Document return value.
# File lib/qb/repo/git/github.rb, line 111 def parse_url_with regexp, string if match = regexp.match( string ) QB::GitHub::RepoID.new owner: match['owner'], name: match['name'] end end
Public Instance Methods
api()
click to toggle source
# File lib/qb/repo/git/github.rb, line 134 def api QB::GitHub::API.client.repo repo_id.path end
github?()
click to toggle source
Part of the {QB::Repo::Git} API, always `true` for GitHub
instances.
@return [true]
# File lib/qb/repo/git/github.rb, line 129 def github? true end
issue(number)
click to toggle source
# File lib/qb/repo/git/github.rb, line 139 def issue number # QB::GitHub::API.client.issue( repo_id.path, number ).to_h.stringify_keys QB::GitHub::Issue.find_by repo_id: repo_id, number: number end