Class: GitHelper::HighlineCli

Inherits:
Object
  • Object
show all
Defined in:
lib/git_helper/highline_cli.rb

Instance Method Summary collapse

Instance Method Details

#accept_autogenerated_title?(autogenerated_title) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
33
34
# File 'lib/git_helper/highline_cli.rb', line 30

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

Returns:

  • (Boolean)


56
57
58
59
# File 'lib/git_helper/highline_cli.rb', line 56

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_branchObject



22
23
24
# File 'lib/git_helper/highline_cli.rb', line 22

def base_branch
  ask('Base branch?')
end

#base_branch_default?(default_branch) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
39
# File 'lib/git_helper/highline_cli.rb', line 36

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



26
27
28
# File 'lib/git_helper/highline_cli.rb', line 26

def code_request_id(request_type)
  ask("#{request_type} Request ID?")
end

#conflicting_remote_clarificationObject



14
15
16
# File 'lib/git_helper/highline_cli.rb', line 14

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



51
52
53
54
# File 'lib/git_helper/highline_cli.rb', line 51

def merge_method(merge_options)
  index = ask_options("Merge method?", merge_options)
  merge_options[index]
end

#new_branch_nameObject



5
6
7
# File 'lib/git_helper/highline_cli.rb', line 5

def new_branch_name
  ask('New branch name?')
end

#process_directory_remotes?(directory) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/git_helper/highline_cli.rb', line 9

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

Returns:

  • (Boolean)


46
47
48
49
# File 'lib/git_helper/highline_cli.rb', line 46

def remove_source_branch?
  answer = ask('Remove source branch after merging? (y/n)')
  answer.empty? ? true : !!(answer =~ /^y/i)
end

#squash_merge_request?Boolean

Returns:

  • (Boolean)


41
42
43
44
# File 'lib/git_helper/highline_cli.rb', line 41

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



61
62
63
64
65
# File 'lib/git_helper/highline_cli.rb', line 61

def template_to_apply(template_options, request_type)
  complete_options = template_options << 'None'
  index = ask_options("Which #{request_type} request template should be applied?", complete_options)
  complete_options[index]
end

#titleObject



18
19
20
# File 'lib/git_helper/highline_cli.rb', line 18

def title
  ask('Title?')
end