Class: GitHelper::HighlineCli
- Inherits:
-
Object
- Object
- GitHelper::HighlineCli
- Defined in:
- lib/git_helper/highline_cli.rb
Instance Method Summary collapse
- #accept_autogenerated_title?(autogenerated_title) ⇒ Boolean
- #apply_template?(template_file_name, request_type) ⇒ Boolean
- #base_branch ⇒ Object
- #base_branch_default?(default_branch) ⇒ Boolean
- #code_request_id(request_type) ⇒ Object
- #conflicting_remote_clarification ⇒ Object
- #merge_method(merge_options) ⇒ Object
- #new_branch_name ⇒ Object
- #process_directory_remotes?(directory) ⇒ Boolean
- #remove_source_branch? ⇒ Boolean
- #squash_merge_request? ⇒ Boolean
- #template_to_apply(template_options, request_type) ⇒ Object
- #title ⇒ Object
Instance Method Details
#accept_autogenerated_title?(autogenerated_title) ⇒ Boolean
28 29 30 31 32 |
# File 'lib/git_helper/highline_cli.rb', line 28 def accept_autogenerated_title?(autogenerated_title) return false unless autogenerated_title answer = ask("Accept the autogenerated code request title '#{autogenerated_title}'? (y/n)") answer.empty? ? true : !!(answer =~ /^y/i) end |
#apply_template?(template_file_name, request_type) ⇒ Boolean
54 55 56 57 |
# File 'lib/git_helper/highline_cli.rb', line 54 def apply_template?(template_file_name, request_type) answer = ask("Apply the #{request_type} request template from #{template_file_name}? (y/n)") answer.empty? ? true : !!(answer =~ /^y/i) end |
#base_branch ⇒ Object
20 21 22 |
# File 'lib/git_helper/highline_cli.rb', line 20 def base_branch ask('Base branch?') end |
#base_branch_default?(default_branch) ⇒ Boolean
34 35 36 37 |
# File 'lib/git_helper/highline_cli.rb', line 34 def base_branch_default?(default_branch) answer = ask("Is '#{default_branch}' the correct base branch for your new code request? (y/n)") answer.empty? ? true : !!(answer =~ /^y/i) end |
#code_request_id(request_type) ⇒ Object
24 25 26 |
# File 'lib/git_helper/highline_cli.rb', line 24 def code_request_id(request_type) ask("#{request_type} Request ID?") end |
#conflicting_remote_clarification ⇒ Object
12 13 14 |
# File 'lib/git_helper/highline_cli.rb', line 12 def conflicting_remote_clarification ask('Found git remotes for both GitHub and GitLab. Would you like to proceed with GitLab or GitHub? (github/gitlab)').downcase end |
#merge_method(merge_options) ⇒ Object
49 50 51 52 |
# File 'lib/git_helper/highline_cli.rb', line 49 def merge_method() index = ("Merge method?", ) [index] end |
#new_branch_name ⇒ Object
3 4 5 |
# File 'lib/git_helper/highline_cli.rb', line 3 def new_branch_name ask('New branch name?') end |
#process_directory_remotes?(directory) ⇒ Boolean
7 8 9 10 |
# File 'lib/git_helper/highline_cli.rb', line 7 def process_directory_remotes?(directory) answer = ask("Found git directory: #{directory}. Do you wish to proceed in updating #{directory}'s remote URLs? (y/n)") answer.empty? ? true : !!(answer =~ /^y/i) end |
#remove_source_branch? ⇒ Boolean
44 45 46 47 |
# File 'lib/git_helper/highline_cli.rb', line 44 def remove_source_branch? answer = ask('Remove source branch after merging? (y/n)') answer.empty? ? true : !!(answer =~ /^y/i) end |
#squash_merge_request? ⇒ Boolean
39 40 41 42 |
# File 'lib/git_helper/highline_cli.rb', line 39 def squash_merge_request? answer = ask('Squash merge request? (y/n)') answer.empty? ? true : !!(answer =~ /^y/i) end |
#template_to_apply(template_options, request_type) ⇒ Object
59 60 61 62 63 |
# File 'lib/git_helper/highline_cli.rb', line 59 def template_to_apply(, request_type) = << 'None' index = ("Which #{request_type} request template should be applied?", ) [index] end |
#title ⇒ Object
16 17 18 |
# File 'lib/git_helper/highline_cli.rb', line 16 def title ask('Title?') end |