Class: BBFlow::Github
- Inherits:
-
Object
show all
- Extended by:
- Persistent, Memoist
- Defined in:
- lib/bb_flow/github.rb
Class Method Summary
collapse
Methods included from Persistent
global, local, persistent
Class Method Details
.add_labels_to_pull_request(pull_request, labels) ⇒ void
This method returns an undefined value.
70
71
72
73
|
# File 'lib/bb_flow/github.rb', line 70
def add_labels_to_pull_request(pull_request, labels)
puts 'Adding labels to pull request...'
octokit.add_labels_to_an_issue(repository_name, pull_request, labels)
end
|
.add_reviewers_to_pull_request(pull_request, reviewer_logins) ⇒ void
This method returns an undefined value.
49
50
51
52
|
# File 'lib/bb_flow/github.rb', line 49
def add_reviewers_to_pull_request(pull_request, reviewer_logins)
puts 'Adding reviewers to the pull request...'
octokit.request_pull_request_review(repository_name, pull_request, reviewer_logins)
end
|
.commits_info ⇒ Array<Sawyer::Resource>
20
21
22
|
# File 'lib/bb_flow/github.rb', line 20
memoize def commits_info
octokit.compare(repository_name, Options.get(:base_branch), local_branch).commits
end
|
.create_pull_request(title, body) ⇒ Sawyer::Resource
Returns the newly created pull request.
40
41
42
43
|
# File 'lib/bb_flow/github.rb', line 40
def create_pull_request(title, body)
puts 'Creating a pull request...'
octokit.create_pull_request(repository_name, Options.get(:base_branch), local_branch, title, body)
end
|
.find_pull_request ⇒ Sawyer::Resource
32
33
34
|
# File 'lib/bb_flow/github.rb', line 32
def find_pull_request
octokit.pull_requests(repository_name).detect { |pr| pr.head.ref == local_branch }
end
|
.has_branch? ⇒ Boolean
76
77
78
|
# File 'lib/bb_flow/github.rb', line 76
def has_branch?
Misc.git.is_remote_branch?(local_branch)
end
|
.http_url ⇒ String
10
11
12
|
# File 'lib/bb_flow/github.rb', line 10
def http_url
"https://github.com/#{repository_name}"
end
|
.other_branch_committers ⇒ Array<String>
People who worked with you on this branch.
27
28
29
|
# File 'lib/bb_flow/github.rb', line 27
memoize def other_branch_committers
(commits_info.map(&:author) + commits_info.map(&:committer)).map(&:login).uniq - [octokit.user.login]
end
|
.pushed? ⇒ Boolean
81
82
83
|
# File 'lib/bb_flow/github.rb', line 81
def pushed?
unpushed_commits_number == 0
end
|
.remote_branch ⇒ String
101
102
103
|
# File 'lib/bb_flow/github.rb', line 101
def remote_branch
"#{remote_name}/#{local_branch}"
end
|
.remote_name ⇒ String
96
97
98
|
# File 'lib/bb_flow/github.rb', line 96
def remote_name
remote.name
end
|
.unpushed_commits_number ⇒ Integer
86
87
88
89
|
# File 'lib/bb_flow/github.rb', line 86
def unpushed_commits_number
git_command = "git rev-list --count HEAD ^#{remote_branch}"
Misc.execute(git_command).strip.to_i
end
|