Class: MetaCommit::Changelog::Adapters::Changelog
- Inherits:
-
Object
- Object
- MetaCommit::Changelog::Adapters::Changelog
- Defined in:
- lib/meta_commit/changelog/adapters/changelog.rb
Overview
Adapter class to write repository changes to changelog file
Constant Summary collapse
- VERSION_DELIMITER =
"\n\n\n"
- VERSION_HEADER_REGEX =
/(## \[.*?\] - \d{4}-\d{2}-\d{2})/m
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#path ⇒ Object
Returns the value of attribute path.
-
#tag ⇒ Object
Returns the value of attribute tag.
Instance Method Summary collapse
-
#initialize(path, filename, tag, date) ⇒ Changelog
constructor
A new instance of Changelog.
-
#write_repository_change_chunk(repo, diffs) ⇒ String
Builds changelog message and adds it after description text and before latest version.
Constructor Details
#initialize(path, filename, tag, date) ⇒ Changelog
Returns a new instance of Changelog.
14 15 16 17 18 19 |
# File 'lib/meta_commit/changelog/adapters/changelog.rb', line 14 def initialize(path, filename, tag, date) @path=path @filename=filename @tag=tag @date=date end |
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
8 9 10 |
# File 'lib/meta_commit/changelog/adapters/changelog.rb', line 8 def date @date end |
#filename ⇒ Object
Returns the value of attribute filename.
8 9 10 |
# File 'lib/meta_commit/changelog/adapters/changelog.rb', line 8 def filename @filename end |
#path ⇒ Object
Returns the value of attribute path.
8 9 10 |
# File 'lib/meta_commit/changelog/adapters/changelog.rb', line 8 def path @path end |
#tag ⇒ Object
Returns the value of attribute tag.
8 9 10 |
# File 'lib/meta_commit/changelog/adapters/changelog.rb', line 8 def tag @tag end |
Instance Method Details
#write_repository_change_chunk(repo, diffs) ⇒ String
Builds changelog message and adds it after description text and before latest version
25 26 27 28 29 30 31 32 33 |
# File 'lib/meta_commit/changelog/adapters/changelog.rb', line 25 def write_repository_change_chunk(repo, diffs) = (@tag, @date) diffs.each do |diff| .add_to_added(diff.string_representation) if diff.type_addition? .add_to_removed(diff.string_representation) if diff.type_deletion? .add_to_changed(diff.string_representation) if diff.type_replace? end prepend_to_changelog(.build) end |