lib/octopolo/scripts/pull_request.rb in octopolo-1.11.0 vs lib/octopolo/scripts/pull_request.rb in octopolo-1.11.1

- old
+ new

@@ -27,13 +27,13 @@ def execute GitHub.connect do if options[:expedite] - infer_questionaire + infer_questionnaire else - ask_questionaire + ask_questionnaire end create_pull_request update_pivotal update_jira @@ -41,36 +41,41 @@ open_in_browser end end # Private: Ask questions to create a pull request - def ask_questionaire + def ask_questionnaire alert_reserved_and_exit if git.reserved_branch? announce ask_title ask_labels ask_pivotal_ids if config.use_pivotal_tracker ask_jira_ids if config.use_jira end - private :ask_questionaire + private :ask_questionnaire - def infer_questionaire + def infer_questionnaire alert_reserved_and_exit if git.reserved_branch? check_branch_format branch_arr = git.current_branch.split('_') issue = branch_arr[0].upcase - descr = branch_arr[1..-1].join(' ') + if issue.include?('-') + descr = branch_arr[1..-1].join(' ') + else + issue = "#{issue}-#{branch_arr[1]}" + descr = branch_arr[2..-1].join(' ') + end - self.title = "#{issue} #{descr}" + self.title = "#{issue} #{descr.capitalize}" self.pivotal_ids = [issue] if config.use_pivotal_tracker self.jira_ids = [issue] if config.use_jira end - private :infer_questionaire + private :infer_questionnaire def check_branch_format - return if /.*-\d+_.*/ =~ git.current_branch + return if (/[a-zA-Z]+-\d+_.*/ =~ git.current_branch || /[a-zA-Z]+_\d+_.*/ =~ git.current_branch) - cli.say "Branch must match format like 'iss-123_describe_branch' to expedite" + cli.say "Branch must match format like 'iss-123_describe_branch' or 'iss_123_describe_branch' to expedite" exit 1 end private :check_branch_format # Private: Announce to the user the branches the pull request will reference