Class: EasyAuto::PullRequest
Instance Attribute Summary collapse
Instance Method Summary
collapse
#check_install, #cli_send, #os
#client, #username
Methods included from GitWrapper
#git
#ask, #hidden_input
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
11
12
13
|
# File 'lib/easy_auto/pull_request.rb', line 11
def body
@body
end
|
#title ⇒ Object
Returns the value of attribute title.
11
12
13
|
# File 'lib/easy_auto/pull_request.rb', line 11
def title
@title
end
|
Instance Method Details
#ask_body ⇒ Object
36
37
38
|
# File 'lib/easy_auto/pull_request.rb', line 36
def ask_body
self.body = ask "Description:"
end
|
#ask_title ⇒ Object
32
33
34
|
# File 'lib/easy_auto/pull_request.rb', line 32
def ask_title
self.title = ask "Title:"
end
|
#base ⇒ Object
40
41
42
|
# File 'lib/easy_auto/pull_request.rb', line 40
def base
'master'
end
|
#head ⇒ Object
44
45
46
|
# File 'lib/easy_auto/pull_request.rb', line 44
def head
git.current_branch_name
end
|
#open_in_browser(pr_number) ⇒ Object
23
24
25
|
# File 'lib/easy_auto/pull_request.rb', line 23
def open_in_browser pr_number
cli_send "open 'https://github.com/#{repo_path}/pull/#{pr_number}'"
end
|
#push_changes ⇒ Object
60
61
62
|
# File 'lib/easy_auto/pull_request.rb', line 60
def push_changes
git.perform "push"
end
|
#remote_paths ⇒ Object
64
65
66
|
# File 'lib/easy_auto/pull_request.rb', line 64
def remote_paths
git.perform "remote -v"
end
|
#repo_name ⇒ Object
48
49
50
|
# File 'lib/easy_auto/pull_request.rb', line 48
def repo_name
remote_paths.match(/\/(.+)\.git/)[1]
end
|
#repo_owner ⇒ Object
52
53
54
|
# File 'lib/easy_auto/pull_request.rb', line 52
def repo_owner
(origin_owner || any_owner)[1]
end
|
#repo_path ⇒ Object
56
57
58
|
# File 'lib/easy_auto/pull_request.rb', line 56
def repo_path
"#{repo_owner}/#{repo_name}"
end
|
#run ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'lib/easy_auto/pull_request.rb', line 13
def run
state_merge_intent
ask_title
ask_body
push_changes
resp = client.create_pull_request(repo_path, base, head, title, body)
pr_number = resp.attrs[:number]
open_in_browser pr_number
end
|
#state_merge_intent ⇒ Object
27
28
29
30
|
# File 'lib/easy_auto/pull_request.rb', line 27
def state_merge_intent
puts "Preparing pull request:"
puts "#{repo_owner}/#{repo_name}/#{head} -> #{repo_owner}/#{repo_name}/master"
end
|