Class: Release::Notes::Configuration
- Inherits:
-
Object
- Object
- Release::Notes::Configuration
- Defined in:
- lib/release/notes/configuration.rb
Instance Attribute Summary collapse
-
#bug_labels ⇒ Array
Controls the labels grepped for in your commit subjects that will be add under you bug title Defaults to
%w(Fix Update). -
#bug_title ⇒ String
Controls the title used in your generated log for all bugs listed Defaults to
**Fixed bugs:**. -
#extended_regex ⇒ Boolean
Consider the limiting patterns to be extended regular expressions patterns when printing your git log.
-
#feature_labels ⇒ Array
Controls the labels grepped for in your commit subjects that will be add under you feature title Defaults to
%w(Add Create). -
#feature_title ⇒ String
Controls the title used in your generated log for all features listed Defaults to
**Implemented enhancements:**. -
#for_each_ref_format ⇒ String
Controls what will be passed to the format flag in
git for-each-refDefaults totag. -
#header_title ⇒ String
Controls the headers that will be used for your tags Defaults to
tag. -
#ignore_case ⇒ Boolean
Match the regular expression limiting patterns without regard to letter case when printing your git log.
-
#include_merges ⇒ Boolean
Determines whether to print commits with more than one parent.
-
#link_to_humanize ⇒ Array
The humanized output that you'd like to represent the associated
:link_to_labelThe index within the array must match the index for the site in:link_to_labeland:link_to_sites. -
#link_to_labels ⇒ Array
The labels grepped for in your commit subject that you want to linkify.
-
#link_to_sites ⇒ Array
The url for the site that you'd like to represent the associated
:link_to_labelThe index within the array must match the index for the site in:link_to_labeland:link_to_humanize. -
#log_all ⇒ Boolean
Controls whether all logs that do not match the other labels are listed Defaults to
false. -
#log_all_title ⇒ String
Controls the title used in your generated log for all commits listed Defaults to
**Other:**. -
#misc_labels ⇒ Array
Controls the labels grepped for in your commit subjects that will be add under you miscellaneous title Defaults to
%w(Refactor). -
#misc_title ⇒ String
Controls the title used in your generated log for all misc commits listed Defaults to
**Miscellaneous:**. -
#output_file ⇒ String
The absolute path of your generated log.
-
#prettify_messages ⇒ Boolean
Controls whether your commit subject labels should be removed from the final ouput of your message on the generated log.
-
#single_label ⇒ 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.
-
#temp_file ⇒ String
The absolute path of the temporary generated log.
-
#timezone ⇒ String
Sets the timezone that should be used for setting the date.
-
#update_release_notes_before_tag ⇒ Boolean
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.
Instance Method Summary collapse
- #all_labels ⇒ String
- #bugs ⇒ String
- #features ⇒ String
- #grep_insensitive_flag ⇒ String
- #header_title_type ⇒ String
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #link_commits? ⇒ Boolean
- #merge_flag ⇒ String
- #misc ⇒ String
- #regex_type ⇒ String
- #release_notes_exist? ⇒ Boolean
- #set_instance_var(var, val) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# 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 |
Instance Attribute Details
#bug_labels ⇒ Array
Controls the labels grepped for in your commit subjects that will
be add under you bug title
Defaults to %w(Fix Update).
45 46 47 |
# File 'lib/release/notes/configuration.rb', line 45 def bug_labels @bug_labels end |
#bug_title ⇒ String
Controls the title used in your generated log for all bugs listed
Defaults to **Fixed bugs:**.
62 63 64 |
# File 'lib/release/notes/configuration.rb', line 62 def bug_title @bug_title end |
#extended_regex ⇒ Boolean
Consider the limiting patterns to be extended regular expressions patterns
when printing your git log.
Defaults to true. For more, see
Git Log Docs
34 35 36 |
# File 'lib/release/notes/configuration.rb', line 34 def extended_regex @extended_regex end |
#feature_labels ⇒ Array
Controls the labels grepped for in your commit subjects that will
be add under you feature title
Defaults to %w(Add Create).
51 52 53 |
# File 'lib/release/notes/configuration.rb', line 51 def feature_labels @feature_labels end |
#feature_title ⇒ String
Controls the title used in your generated log for all features listed
Defaults to **Implemented enhancements:**.
67 68 69 |
# File 'lib/release/notes/configuration.rb', line 67 def feature_title @feature_title end |
#for_each_ref_format ⇒ String
Controls what will be passed to the format flag in git for-each-ref
Defaults to tag.
127 128 129 |
# File 'lib/release/notes/configuration.rb', line 127 def for_each_ref_format @for_each_ref_format end |
#header_title ⇒ String
Controls the headers that will be used for your tags
Defaults to tag.
39 40 41 |
# File 'lib/release/notes/configuration.rb', line 39 def header_title @header_title end |
#ignore_case ⇒ Boolean
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
27 28 29 |
# File 'lib/release/notes/configuration.rb', line 27 def ignore_case @ignore_case end |
#include_merges ⇒ Boolean
Determines whether to print commits with more than one parent.
Defaults to false. For more, see
Git Log Docs
20 21 22 |
# File 'lib/release/notes/configuration.rb', line 20 def include_merges @include_merges end |
#link_to_humanize ⇒ Array
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 [].
96 97 98 |
# File 'lib/release/notes/configuration.rb', line 96 def link_to_humanize @link_to_humanize end |
#link_to_labels ⇒ 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 [].
89 90 91 |
# File 'lib/release/notes/configuration.rb', line 89 def link_to_labels @link_to_labels end |
#link_to_sites ⇒ 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 [].
103 104 105 |
# File 'lib/release/notes/configuration.rb', line 103 def link_to_sites @link_to_sites end |
#log_all ⇒ Boolean
Controls whether all logs that do not match the other labels are listed
Defaults to false
77 78 79 |
# File 'lib/release/notes/configuration.rb', line 77 def log_all @log_all end |
#log_all_title ⇒ String
Controls the title used in your generated log for all commits listed
Defaults to **Other:**.
82 83 84 |
# File 'lib/release/notes/configuration.rb', line 82 def log_all_title @log_all_title end |
#misc_labels ⇒ Array
Controls the labels grepped for in your commit subjects that will
be add under you miscellaneous title
Defaults to %w(Refactor).
57 58 59 |
# File 'lib/release/notes/configuration.rb', line 57 def misc_labels @misc_labels end |
#misc_title ⇒ String
Controls the title used in your generated log for all misc commits listed
Defaults to **Miscellaneous:**.
72 73 74 |
# File 'lib/release/notes/configuration.rb', line 72 def misc_title @misc_title end |
#output_file ⇒ String
The absolute path of your generated log.
Defaults to ./RELEASE_NOTES.md.
9 10 11 |
# File 'lib/release/notes/configuration.rb', line 9 def output_file @output_file end |
#prettify_messages ⇒ Boolean
Controls whether your commit subject labels should be removed from the final
ouput of your message on the generated log.
Defaults to false.
115 116 117 |
# File 'lib/release/notes/configuration.rb', line 115 def @prettify_messages end |
#single_label ⇒ 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.
122 123 124 |
# File 'lib/release/notes/configuration.rb', line 122 def single_label @single_label end |
#temp_file ⇒ String
The absolute path of the temporary generated log.
Defaults to ./release-notes.tmp.md.
14 15 16 |
# File 'lib/release/notes/configuration.rb', line 14 def temp_file @temp_file end |
#timezone ⇒ String
Sets the timezone that should be used for setting the date.
Defaults to America/New_York. For more, see
ActiveSupport Time Zones
109 110 111 |
# File 'lib/release/notes/configuration.rb', line 109 def timezone @timezone end |
#update_release_notes_before_tag ⇒ Boolean
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.
134 135 136 |
# File 'lib/release/notes/configuration.rb', line 134 def update_release_notes_before_tag @update_release_notes_before_tag end |
Instance Method Details
#all_labels ⇒ String
206 207 208 |
# File 'lib/release/notes/configuration.rb', line 206 def all_labels @all_labels ||= generate_regex(@bug_labels + @feature_labels + @misc_labels) end |
#bugs ⇒ String
191 192 193 |
# File 'lib/release/notes/configuration.rb', line 191 def bugs @bugs ||= generate_regex(@bug_labels) end |
#features ⇒ String
196 197 198 |
# File 'lib/release/notes/configuration.rb', line 196 def features @features ||= generate_regex(@feature_labels) end |
#grep_insensitive_flag ⇒ String
186 187 188 |
# File 'lib/release/notes/configuration.rb', line 186 def grep_insensitive_flag ignore_case? ? "-i" : "" end |
#header_title_type ⇒ String
171 172 173 |
# File 'lib/release/notes/configuration.rb', line 171 def header_title_type @header_title.match?(/^[tag|date]+$/) ? @header_title : "tag" end |
#link_commits? ⇒ Boolean
216 217 218 219 |
# File 'lib/release/notes/configuration.rb', line 216 def link_commits? link_to_labels.present? && link_to_humanize.present? && link_to_sites.present? end |
#merge_flag ⇒ String
176 177 178 |
# File 'lib/release/notes/configuration.rb', line 176 def merge_flag include_merges? ? "" : "--no-merges" end |
#misc ⇒ String
201 202 203 |
# File 'lib/release/notes/configuration.rb', line 201 def misc @misc ||= generate_regex(@misc_labels) end |
#regex_type ⇒ String
181 182 183 |
# File 'lib/release/notes/configuration.rb', line 181 def regex_type extended_regex? ? "-E" : "" end |
#release_notes_exist? ⇒ Boolean
211 212 213 |
# File 'lib/release/notes/configuration.rb', line 211 def release_notes_exist? File.exist? output_file end |
#set_instance_var(var, val) ⇒ Object
221 222 223 224 225 226 227 228 229 230 |
# 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 |