lib/pt-flow/ui.rb in pt-flow-2.3.3 vs lib/pt-flow/ui.rb in pt-flow-2.4.0

- old
+ new

@@ -33,14 +33,17 @@ task end end def finish - run("git push origin #{branch} -u") - pull_request - finish_task(current_task) - deliver! if @params.include?('--deliver') + run "git push origin #{branch} -u" + finish_task current_task + if @params.include?('--deliver') + deliver! + else + open_url draft_pr_url + end end def cleanup title("Cleaning merged story branches for [#{branch.target}]") @@ -87,25 +90,29 @@ task_title = current_task.name.gsub('"',"'") + " [Delivers ##{current_task.id}]" task_title = 'Bugfix: ' + task_title if current_task.story_type == 'bug' task_title end - def pull_request - if @params.include?('--draft') - pr_url = repo.url + "/compare/#{branch.target}...#{branch}?expand=1&title=#{URI.escape(task_title)}" - run "open \"#{pr_url}\"" - else - run("hub pull-request -b #{branch.target} -h #{repo.user}:#{branch} -m \"#{task_title}\"") - end + def draft_pr_url + repo.url + "/compare/#{branch.target}...#{branch}?expand=1&title=#{URI.escape(task_title)}" end def deliver! + run "hub pull-request -b #{branch.target} -h #{repo.user}:#{branch} -m \"#{task_title}\"" finished_branch = branch title = task_title run "git checkout #{finished_branch.target}" run "git pull" run "git merge #{finished_branch} --no-ff -m \"#{title}\"" run "git push origin #{finished_branch.target}" + end + + def open_url(url) + if ENV['BROWSER'] == 'echo' + title url + else + run "open \"#{url}\"" + end end def run(command) title(command) error("Error running: #{command}") unless system(command)