class Renuo::Cli::Commands::CreatePr
Public Instance Methods
Source
# File lib/renuo/cli/commands/create_pr.rb, line 21 def run(opts) create_pr(opts) open_pr_in_browser unless opts.web_create end
Private Instance Methods
Source
# File lib/renuo/cli/commands/create_pr.rb, line 28 def create_pr(opts) command = [ "gh pr create", "--assignee @me", pr_title(opts), "--body \"#{pr_body(opts)}\"", ("--web" if opts.web_create), ("--draft" if opts.draft) ].compact.join(" ") puts `#{command}` end
Source
# File lib/renuo/cli/commands/create_pr.rb, line 57 def open_pr_in_browser puts `gh pr view --web` end
Source
# File lib/renuo/cli/commands/create_pr.rb, line 45 def pr_body(opts) redmine_ticket_number = redmine_ticket_number(opts) return "" unless redmine_ticket_number "TICKET-#{redmine_ticket_number}" end
Source
# File lib/renuo/cli/commands/create_pr.rb, line 41 def pr_title(opts) opts.title ? "--title \"#{opts.title}\"" : "--fill" end
Source
# File lib/renuo/cli/commands/create_pr.rb, line 52 def redmine_ticket_number(opts) current_branch = `git branch --show-current`.strip opts.redmine_ticket || current_branch.match(/(\d+)/)&.captures&.first end