class Release::Notes::Configuration
Attributes
Controls the labels grepped for in your commit subjects that will be add under you bug title Defaults to `%w(Fix Update)`. @return [Array]
Controls the title used in your generated log for all bugs listed Defaults to `**Fixed bugs:**`. @return [String]
Consider the limiting patterns to be extended regular expressions patterns when printing your git log. Defaults to `true`. For more, see [Git Log
Docs](git-scm.com/docs/git-log) @return [Boolean]
Controls the labels grepped for in your commit subjects that will be add under you feature title Defaults to `%w(Add Create)`. @return [Array]
Controls the title used in your generated log for all features listed Defaults to `**Implemented enhancements:**`. @return [String]
Controls what will be passed to the format flag in `git for-each-ref` Defaults to `tag`. @return [String]
Controls the headers that will be used for your tags Defaults to `tag`. @return [String]
Match the regular expression limiting patterns without regard to letter case when printing your git log. Defaults to `true`. For more, see [Git Log
Docs](git-scm.com/docs/git-log) @return [Boolean]
Determines whether to print commits with more than one parent. Defaults to `false`. For more, see [Git Log
Docs](git-scm.com/docs/git-log) @return [Boolean]
The humanized output that you'd like to represent the associated `:link_to_label` The index within the array must match the index for the site in `:link_to_label` and `:link_to_sites`. Defaults to `[]`. @return [Array]
The labels grepped for in your commit subject that you want to linkify. The index within the array must match the index for the site in `:link_to_humanize` and `:link_to_sites`. Defaults to `[]`. @return [Array]
The url for the site that you'd like to represent the associated `:link_to_label` The index within the array must match the index for the site in `:link_to_label` and `:link_to_humanize`. Defaults to `[]`. @return [Array]
Controls whether all logs that do not match the other labels are listed Defaults to `false` @return [Boolean]
Controls the title used in your generated log for all commits listed Defaults to `Other:`. @return [String]
Controls the labels grepped for in your commit subjects that will be add under you miscellaneous title Defaults to `%w(Refactor)`. @return [Array]
Controls the title used in your generated log for all misc commits listed Defaults to `Miscellaneous:`. @return [String]
The absolute path of your generated log. Defaults to `./RELEASE_NOTES.md`. @return [String]
Controls whether your commit subject labels should be removed from the final ouput of your message on the generated log. Defaults to `false`. @return [Boolean]
If a commit message contains words that match more than one group of labels as defined in your configuration, the output will only contain the commit once. Defaults to `true`. @return [Boolean]
The absolute path of the temporary generated log. Defaults to `./release-notes.tmp.md`. @return [String]
Sets the timezone that should be used for setting the date. Defaults to `America/New_York`. For more, see [ActiveSupport Time Zones](api.rubyonrails.org/classes/ActiveSupport/TimeZone.html) @return [String]
Determines whether to use the last two tags to find commits for the output or if this gem should just find all commits after previous tag Defaults to `true`. @return [Boolean]
Public Class Methods
# File lib/release/notes/configuration.rb, line 136 def initialize @output_file = "./RELEASE_NOTES.md" @temp_file = "./release-notes.tmp.md" @include_merges = false @ignore_case = true @extended_regex = true @header_title = "tag" @bug_labels = %w(Fix Update) @feature_labels = %w(Add Create) @misc_labels = %w(Refactor) @bug_title = "**Fixed bugs:**" @feature_title = "**Implemented enhancements:**" @misc_title = "**Miscellaneous:**" @log_all_title = "**Other**" @log_all = false @link_to_labels = %w() @link_to_humanize = %w() @link_to_sites = %w() @timezone = "America/New_York" @prettify_messages = false @single_label = true @for_each_ref_format = "tag" @update_release_notes_before_tag = true end
Public Instance Methods
@return [String]
# File lib/release/notes/configuration.rb, line 206 def all_labels @all_labels ||= generate_regex(@bug_labels + @feature_labels + @misc_labels) end
@return [String]
# File lib/release/notes/configuration.rb, line 191 def bugs @bugs ||= generate_regex(@bug_labels) end
@return [String]
# File lib/release/notes/configuration.rb, line 196 def features @features ||= generate_regex(@feature_labels) end
@return [String]
# File lib/release/notes/configuration.rb, line 186 def grep_insensitive_flag ignore_case? ? "-i" : "" end
@return [String]
# File lib/release/notes/configuration.rb, line 171 def header_title_type @header_title.match?(/^[tag|date]+$/) ? @header_title : "tag" end
@return [Boolean]
# File lib/release/notes/configuration.rb, line 216 def link_commits? link_to_labels.present? && link_to_humanize.present? && link_to_sites.present? end
@return [String]
# File lib/release/notes/configuration.rb, line 176 def merge_flag include_merges? ? "" : "--no-merges" end
@return [String]
# File lib/release/notes/configuration.rb, line 201 def misc @misc ||= generate_regex(@misc_labels) end
@return [String]
# File lib/release/notes/configuration.rb, line 181 def regex_type extended_regex? ? "-E" : "" end
@return [Boolean]
# File lib/release/notes/configuration.rb, line 211 def release_notes_exist? File.exist? output_file end
# File lib/release/notes/configuration.rb, line 221 def set_instance_var(var, val) instance_variable_set("@#{var}", val) define_singleton_method(var) do instance_variable_get("@#{var}") end define_singleton_method("#{var}?") do return send(var) == true if !!send(var) == send(var) # rubocop:disable Style/DoubleNegation end end
Private Instance Methods
@api private Using over Regexp.union
# File lib/release/notes/configuration.rb, line 236 def generate_regex(arr) arr.join("|").insert(0, "(").insert(-1, ")") end