Class: QB::Repo::Git::GitHub
Overview
Git repo where the origin remote points to GitHub, which is used to
determine it's owner and name.
Constant Summary
collapse
- SSH_URL_RE =
/^git@github\.com\:(?<owner>.*)\/(?<name>.*)\.git$/
- HTTPS_URL_RE =
/^https:\/\/github\.com\/(?<owner>.*)\/(?<name>.*)\.git$/
Instance Attribute Summary
Attributes inherited from QB::Repo
#name, #ref_path, #root_path
Class Method Summary
collapse
Instance Method Summary
collapse
#clean?, from_path, #from_path!, #full_name, #head_short, #lib, #status, #tags
Methods inherited from QB::Repo
from_path, from_path!, #tags
#initialize
Class Method Details
.https_url?(string) ⇒ Boolean
62
63
64
|
# File 'lib/qb/repo/git/github.rb', line 62
def self.https_url? string
!!(HTTPS_URL_RE =~ string)
end
|
.parse_https_url(string) ⇒ Object
77
78
79
|
# 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) ⇒ Object
72
73
74
|
# File 'lib/qb/repo/git/github.rb', line 72
def self.parse_ssh_url string
parse_url_with SSH_URL_RE, string
end
|
Extract owner and name from Git remote URL string pointing to GitHub.
90
91
92
|
# 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) ⇒ Boolean
57
58
59
|
# File 'lib/qb/repo/git/github.rb', line 57
def self.ssh_url? string
!!(SSH_URL_RE =~ string)
end
|
.url?(string) ⇒ Boolean
67
68
69
|
# File 'lib/qb/repo/git/github.rb', line 67
def self.url? string
ssh_url?( string ) || https_url?( string )
end
|
Instance Method Details
#api ⇒ Object
134
135
136
|
# File 'lib/qb/repo/git/github.rb', line 134
def api
QB::GitHub::API.client.repo repo_id.path
end
|
#github? ⇒ true
129
130
131
|
# File 'lib/qb/repo/git/github.rb', line 129
def github?
true
end
|
#issue(number) ⇒ Object
139
140
141
142
|
# File 'lib/qb/repo/git/github.rb', line 139
def issue number
QB::GitHub::Issue.find_by repo_id: repo_id, number: number
end
|