class CiHelper::UserCommandLineInterface
Constants
- REVIEWERS
TODO : need to move to bitbucket related setting to let user set
Attributes
issue_monitor[R]
matching_strategy[RW]
this class is responsible for get the user input and print the question message
user_answer[RW]
this class is responsible for get the user input and print the question message
Public Instance Methods
customize_title()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 80 def customize_title get_user_input do puts cusotmize_title_question end end
force_create_pull_request?()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 40 def force_create_pull_request? self.user_answer = get_user_input do puts fail_test_pull_request_question puts 'y\n' end user_answer? end
get_branch_name()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 74 def get_branch_name get_user_input do puts branch_name_question end end
get_destination()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 62 def get_destination get_user_input do puts destination_question end end
get_issue_numbers()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 100 def get_issue_numbers get_user_input do puts issue_number_question end end
get_more_info()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 68 def get_more_info get_user_input do puts more_info_question end end
get_reviewers()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 92 def get_reviewers option = get_user_input do puts reviewer_question end # FIXME: the responsibility to transfer the option to bitbucket acceptable params should be the bit_bucket_procedure option_to_string(option) end
get_spent_time()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 112 def get_spent_time get_user_input do puts spend_time_question end end
get_status()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 106 def get_status get_user_input do puts 'please input status in value' end end
get_user_choose()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 86 def get_user_choose get_user_input do puts options end end
get_user_issue_pattern()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 17 def get_user_issue_pattern self.matching_strategy = get_user_input do puts matching_strategy_question end matching_strategy end
print_target(target)
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 122 def print_target(target) puts "This is your target branch #{target}\n" end
update_issue?()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 49 def update_issue? self.user_answer = get_user_input do puts update_issue_question puts 'y/n' end user_answer? end
user_answer?()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 58 def user_answer? user_answer == 'y' || user_answer == 'Y' end
user_want_skip?()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 31 def user_want_skip? self.user_answer = get_user_input do puts issue_not_found_question puts 'y\n' end !user_answer? end
wait_issue_finish()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 26 def wait_issue_finish puts waitting_reminder sleep(CiHelper::WAITING_TIME) end
waiting_for_creation()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 118 def waiting_for_creation puts 'Please move your finger away from the enter, and dont keep pushing the fuckkkkkkking enter, I am creating the pf >.^ ' end
wellcome()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 13 def wellcome puts CiHelper::HELLO_MSG end
Private Instance Methods
branch_name_question()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 192 def branch_name_question 'Please Provide branch name you want to merge' end
cusotmize_title_question()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 196 def cusotmize_title_question 'You branch seems have a lot of issue, please provide your title of pull request' end
destination_question()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 180 def destination_question 'Please Provide the destination' end
fail_test_pull_request_question()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 176 def fail_test_pull_request_question "Are You still wanna crete a pull request ? \n Please make sure all the values are all unstable or you will be killed by Gadii >W<" end
get_user_input(&question_block)
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 128 def get_user_input(&question_block) fail CiHelper::Exceptions::NoQuestionError, 'Please assign a question to get user bollean answer' unless question_block question_block.call return gets.chop end
issue_not_found_question()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 160 def issue_not_found_question 'Your issue is queue or enter wrong issue number, do you want to wait the queue?' end
issue_number_question()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 207 def issue_number_question 'please input your ticket number you want to update' end
matching_strategy_question()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 164 def matching_strategy_question 'Please Input your next ticket number or commit hash to specify the multi test result in the CI' end
more_info_question()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 184 def more_info_question 'Please Provide the more description you want add in the text box' end
option_to_string(option)
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 136 def option_to_string(option) choosen_key = option.split(' ') reviewer = [] choosen_key.each do |value| if value.to_i == CiHelper::DANGEROUS print_ngyan_cat fail Exceptions::SettingError, 'Please dont choose Ciao Bao its dangerous !!!!!!!' end reviewer << REVIEWERS[value.to_i] end reviewer.join(',') end
options()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 200 def options " 1. Monitor issue in CI and create pull request \n 2. input branch name to create pull request \n 3. update issue status \n please input 1, 2 or 3" end
print_ngyan_cat()
click to toggle source
TODO: extract to a ngyan cat print lib
# File lib/ci_helper/user_command_line_interface.rb, line 152 def print_ngyan_cat puts ' O----O,' puts ' : | 38|\/\ ^^^^' puts ' M ~\___(+.+)' puts ' U U' end
queueing_question()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 168 def queueing_question 'Your issue is queue or enter wrong issue number, do you want to wait the queue?' end
reviewer_question()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 188 def reviewer_question "Please provide the reviewer 0. Anna 1. Cheryl 2. Millie 3.\\\\ Handsome Alan /////4. GGD 5. Ivan 6. CiaoBao order in gender and alphabetically \n EX: 0 1 2 with one space will be Anna, Cherylyu and Millie" end
spend_time_question()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 215 def spend_time_question 'Please input your spent time' end
update_issue_question()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 211 def update_issue_question 'Do you want me update the issue for you to ut passed ?' end
waitting_reminder()
click to toggle source
# File lib/ci_helper/user_command_line_interface.rb, line 172 def waitting_reminder 'Your Issue is running the test now, I will check for you every 60seconds' end