class Release::Notes::Configuration

Attributes

bug_labels[RW]

Controls the labels grepped for in your commit subjects that will be add under you bug title Defaults to `%w(Fix Update)`. @return [Array]

bug_title[RW]

Controls the title used in your generated log for all bugs listed Defaults to `**Fixed bugs:**`. @return [String]

extended_regex[RW]

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]

feature_labels[RW]

Controls the labels grepped for in your commit subjects that will be add under you feature title Defaults to `%w(Add Create)`. @return [Array]

feature_title[RW]

Controls the title used in your generated log for all features listed Defaults to `**Implemented enhancements:**`. @return [String]

for_each_ref_format[RW]

Controls what will be passed to the format flag in `git for-each-ref` Defaults to `tag`. @return [String]

header_title[RW]

Controls the headers that will be used for your tags Defaults to `tag`. @return [String]

ignore_case[RW]

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]

include_merges[RW]

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]

log_all[RW]

Controls whether all logs that do not match the other labels are listed Defaults to `false` @return [Boolean]

log_all_title[RW]

Controls the title used in your generated log for all commits listed Defaults to `Other:`. @return [String]

misc_labels[RW]

Controls the labels grepped for in your commit subjects that will be add under you miscellaneous title Defaults to `%w(Refactor)`. @return [Array]

misc_title[RW]

Controls the title used in your generated log for all misc commits listed Defaults to `Miscellaneous:`. @return [String]

output_file[RW]

The absolute path of your generated log. Defaults to `./RELEASE_NOTES.md`. @return [String]

prettify_messages[RW]

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]

single_label[RW]

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]

temp_file[RW]

The absolute path of the temporary generated log. Defaults to `./release-notes.tmp.md`. @return [String]

timezone[RW]

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]

update_release_notes_before_tag[RW]

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

new() click to toggle source
# 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

all_labels() click to toggle source

@return [String]

# File lib/release/notes/configuration.rb, line 206
def all_labels
  @all_labels ||= generate_regex(@bug_labels + @feature_labels + @misc_labels)
end
bugs() click to toggle source

@return [String]

# File lib/release/notes/configuration.rb, line 191
def bugs
  @bugs ||= generate_regex(@bug_labels)
end
features() click to toggle source

@return [String]

# File lib/release/notes/configuration.rb, line 196
def features
  @features ||= generate_regex(@feature_labels)
end
grep_insensitive_flag() click to toggle source

@return [String]

# File lib/release/notes/configuration.rb, line 186
def grep_insensitive_flag
  ignore_case? ? "-i" : ""
end
header_title_type() click to toggle source

@return [String]

# File lib/release/notes/configuration.rb, line 171
def header_title_type
  @header_title.match?(/^[tag|date]+$/) ? @header_title : "tag"
end
merge_flag() click to toggle source

@return [String]

# File lib/release/notes/configuration.rb, line 176
def merge_flag
  include_merges? ? "" : "--no-merges"
end
misc() click to toggle source

@return [String]

# File lib/release/notes/configuration.rb, line 201
def misc
  @misc ||= generate_regex(@misc_labels)
end
regex_type() click to toggle source

@return [String]

# File lib/release/notes/configuration.rb, line 181
def regex_type
  extended_regex? ? "-E" : ""
end
release_notes_exist?() click to toggle source

@return [Boolean]

# File lib/release/notes/configuration.rb, line 211
def release_notes_exist?
  File.exist? output_file
end
set_instance_var(var, val) click to toggle source
# 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

generate_regex(arr) click to toggle source

@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