Class: QB::Repo::Git::GitHub
- Inherits:
-
QB::Repo::Git
- Object
- Util::Resource
- QB::Repo
- QB::Repo::Git
- QB::Repo::Git::GitHub
- Defined in:
- lib/qb/repo/git/github.rb
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 =
Constants
/^git@github\.com\:(?<owner>.*)\/(?<name>.*)\.git$/
- HTTPS_URL_RE =
/^https:\/\/github\.com\/(?<owner>.*)\/(?<name>.*)\.git$/
Instance Attribute Summary
Attributes inherited from QB::Repo
Class Method Summary collapse
- .https_url?(string) ⇒ Boolean
- .parse_https_url(string) ⇒ Object
- .parse_ssh_url(string) ⇒ Object
-
.parse_url(string) ⇒ nil, QB::GitHub::RepoID
Extract owner and name from Git remote URL string pointing to GitHub.
-
.ssh_url?(string) ⇒ Boolean
Helpers ---------------------------------------------------------------------.
- .url?(string) ⇒ Boolean
Instance Method Summary collapse
- #api ⇒ Object
-
#github? ⇒ true
Part of the QB::Repo::Git API, always
true
for GitHub instances. - #issue(number) ⇒ Object
Methods inherited from QB::Repo::Git
#clean?, from_path, #from_path!, #full_name, #head_short, #lib, #status, #tags
Methods inherited from QB::Repo
Methods inherited from Util::Resource
Constructor Details
This class inherits a constructor from QB::Util::Resource
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 |
.parse_url(string) ⇒ nil, QB::GitHub::RepoID
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
Helpers
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
Part of the QB::Repo::Git API, always true
for GitHub instances.
129 130 131 |
# File 'lib/qb/repo/git/github.rb', line 129 def github? true end |