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.
61
62
63
64
|
# File 'lib/bb_flow/github.rb', line 61
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
|
.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
67
68
69
|
# File 'lib/bb_flow/github.rb', line 67
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
72
73
74
|
# File 'lib/bb_flow/github.rb', line 72
def pushed?
unpushed_commits_number == 0
end
|
.remote_branch ⇒ String
92
93
94
|
# File 'lib/bb_flow/github.rb', line 92
def remote_branch
"#{remote_name}/#{local_branch}"
end
|
.remote_name ⇒ String
87
88
89
|
# File 'lib/bb_flow/github.rb', line 87
def remote_name
remote.name
end
|
.unpushed_commits_number ⇒ Integer
77
78
79
80
|
# File 'lib/bb_flow/github.rb', line 77
def unpushed_commits_number
git_command = "git rev-list --count HEAD ^#{remote_branch}"
Misc.execute(git_command).strip.to_i
end
|