Sha256: be484159a2b8d9dd0c901af959fc78106b903aad59f239040dd9849bb61eb68a
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
require "cp8_cli/repo" module Cp8Cli class PullRequest def initialize(from:, target:, story: nil, **options) @story = story @from = from @target = target @options = options end def open Command.open_url url end private attr_reader :story, :from, :target, :options def url repo.url + "/compare/#{target}...#{escape from}?expand=1&title=#{escape title_with_prefixes}&body=#{escape body}" end def title return unless story story.pr_title end def body return unless story body = story.summary body << release_note unless release_branch? body end def release_note "\n\n_Release note: #{story.title}_" end def prefixes prefixes = [] prefixes << "[WIP]" if options[:wip] prefixes << "[#{target.titleize}]" if release_branch? prefixes.join(" ") end def release_branch? target != "master" end def title_with_prefixes "#{prefixes} #{title}".strip end def escape(text) URI.escape text.to_s.strip end def repo @_repo ||= Repo.current end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cp8_cli-4.1.1 | lib/cp8_cli/pull_request.rb |
cp8_cli-4.1.0 | lib/cp8_cli/pull_request.rb |