Class: Dependabot::PullRequestCreator::MessageBuilder::TitleBuilder

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/pull_request_creator/message_builder/title_builder.rb

Overview

Composes a final PR title from a base title + prefix.

Works in two modes:

  1. With a full PrNamePrefixer (updater path — has source/credentials for commit style auto-detection)

  2. With just commit_message_options (API path — explicit prefix only, no network calls needed)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_title:, prefixer: nil, commit_message_options: nil, dependencies: nil) ⇒ TitleBuilder

Returns a new instance of TitleBuilder.



42
43
44
45
46
47
# File 'lib/dependabot/pull_request_creator/message_builder/title_builder.rb', line 42

def initialize(base_title:, prefixer: nil, commit_message_options: nil, dependencies: nil)
  @base_title = base_title
  @prefixer = prefixer
  @commit_message_options = commit_message_options
  @dependencies = dependencies
end

Instance Attribute Details

#base_titleObject (readonly)

Returns the value of attribute base_title.



23
24
25
# File 'lib/dependabot/pull_request_creator/message_builder/title_builder.rb', line 23

def base_title
  @base_title
end

#commit_message_optionsObject (readonly)

Returns the value of attribute commit_message_options.



29
30
31
# File 'lib/dependabot/pull_request_creator/message_builder/title_builder.rb', line 29

def commit_message_options
  @commit_message_options
end

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



32
33
34
# File 'lib/dependabot/pull_request_creator/message_builder/title_builder.rb', line 32

def dependencies
  @dependencies
end

#prefixerObject (readonly)

Returns the value of attribute prefixer.



26
27
28
# File 'lib/dependabot/pull_request_creator/message_builder/title_builder.rb', line 26

def prefixer
  @prefixer
end

Class Method Details

.multi_ecosystem_base_title(group_name:, update_count:) ⇒ Object



51
52
53
54
# File 'lib/dependabot/pull_request_creator/message_builder/title_builder.rb', line 51

def self.multi_ecosystem_base_title(group_name:, update_count:)
  "bump the \"#{group_name}\" group with " \
    "#{update_count} update#{'s' unless update_count == 1} across multiple ecosystems"
end

Instance Method Details

#buildObject



57
58
59
60
61
# File 'lib/dependabot/pull_request_creator/message_builder/title_builder.rb', line 57

def build
  name = base_title.dup
  name[0] = T.must(name[0]).capitalize if !name.empty? && capitalize?
  "#{prefix}#{name}"
end