Class: Houston::Adapters::VersionControl::GitAdapter::GithubRepo
- Inherits:
-
RemoteRepo
- Object
- Repo
- RemoteRepo
- Houston::Adapters::VersionControl::GitAdapter::GithubRepo
show all
- Defined in:
- app/adapters/houston/adapters/version_control/git_adapter/github_repo.rb
Constant Summary
Constants inherited
from RemoteRepo
RemoteRepo::RETRY_COOLDOWN
Instance Attribute Summary
Attributes inherited from RemoteRepo
#location
Instance Method Summary
collapse
Methods inherited from RemoteRepo
#clone!, #initialize, #origin, #pull!, #refresh!, #to_s
Methods inherited from Repo
#all_commit_times, #all_commits, #ancestors, #ancestors_until, #branch, #branches, #branches_at, #changes, #commits_between, #exists?, #find_file, #initialize, #location, #native_commit, #read_file, #ref, #refresh!, #to_s
Instance Method Details
#add_labels_to(labels, issue_number) ⇒ Object
Also known as:
add_label_to
50
51
52
53
|
# File 'app/adapters/houston/adapters/version_control/git_adapter/github_repo.rb', line 50
def add_labels_to(labels, issue_number)
issue_number = issue_number.number if issue_number.respond_to? :number
Houston.github.add_labels_to_an_issue repo_name, issue_number, Array(labels)
end
|
#commit_range_url(sha0, sha1) ⇒ Object
19
20
21
|
# File 'app/adapters/houston/adapters/version_control/git_adapter/github_repo.rb', line 19
def commit_range_url(sha0, sha1)
"#{project_url}/compare/#{sha0}...#{sha1}"
end
|
#commit_status_url(sha) ⇒ Object
23
24
25
26
27
28
|
# File 'app/adapters/houston/adapters/version_control/git_adapter/github_repo.rb', line 23
def commit_status_url(sha)
sha = native_commit(sha).sha if sha.length < 40
path = Addressable::URI.parse(project_url).path[1..-1]
"https://api.github.com/repos/#{path}/statuses/#{sha}"
end
|
#commit_url(sha) ⇒ Object
15
16
17
|
# File 'app/adapters/houston/adapters/version_control/git_adapter/github_repo.rb', line 15
def commit_url(sha)
"#{project_url}/commit/#{sha}"
end
|
#create_pull_request(base: nil, head: nil, title: nil, body: nil, options: {}) ⇒ Object
42
43
44
|
# File 'app/adapters/houston/adapters/version_control/git_adapter/github_repo.rb', line 42
def create_pull_request(base: nil, head: nil, title: nil, body: nil, options: {})
Houston.github.create_pull_request(repo_name, base, head, title, body, options)
end
|
#issues(options = {}) ⇒ Object
46
47
48
|
# File 'app/adapters/houston/adapters/version_control/git_adapter/github_repo.rb', line 46
def issues(options={})
Houston.github.issues(repo_name, options)
end
|
#project_url ⇒ Object
8
9
10
11
12
13
|
# File 'app/adapters/houston/adapters/version_control/git_adapter/github_repo.rb', line 8
def project_url
location.to_s
.gsub(/^git@(?:www\.)?github.com:/, "https://github.com/")
.gsub(/^git:/, "https:")
.gsub(/\.git$/, "")
end
|
#pull_requests(options = {}) ⇒ Object
38
39
40
|
# File 'app/adapters/houston/adapters/version_control/git_adapter/github_repo.rb', line 38
def pull_requests(options={})
Houston.github.pull_requests(repo_name, options)
end
|
#remove_label_from(label, issue_number) ⇒ Object
56
57
58
59
|
# File 'app/adapters/houston/adapters/version_control/git_adapter/github_repo.rb', line 56
def remove_label_from(label, issue_number)
issue_number = issue_number.number if issue_number.respond_to? :number
Houston.github.remove_label repo_name, issue_number, label
end
|
#repo_name ⇒ Object
30
31
32
|
# File 'app/adapters/houston/adapters/version_control/git_adapter/github_repo.rb', line 30
def repo_name
location.path[0...-4]
end
|