Class: GemHadar::ChangelogConfig

Inherits:
Object
  • Object
show all
Extended by:
DSLKit::DSLAccessor
Defined in:
lib/gem_hadar/changelog_config.rb

Overview

A class that encapsulates changelog configuration settings for a gem project.

This class provides a structured way to define and manage settings related to changelog generation within the GemHadar framework. It allows configuration of the changelog filename and the commit message used when adding entries.

Examples:

Configuring changelog settings

GemHadar do
  changelog do
    filename 'CHANGELOG.md'
    commit_message 'Update changelog'
  end
end

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ GemHadar::ChangelogConfig

This method creates a new instance of the ChangelogConfig class and then evaluates the provided block in the context of the new instance to configure the changelog settings.

Parameters:

  • block (Proc)

    the block to be evaluated for configuring the changelog settings



26
27
28
# File 'lib/gem_hadar/changelog_config.rb', line 26

def initialize(&block)
  instance_eval(&block)
end

Instance Method Details

#commit_messageString

The commit_message method retrieves or sets the Git commit message used when adding changelog entries.

This method serves as an accessor for the commit_message attribute within the ChangelogConfig class. When called without arguments, it returns the configured commit message, which defaults to ‘Add to changes’. When called with an argument, it sets the commit message to be used for Git operations related to changelog management.

Returns:

  • (String)

    the default commit message ‘Add to changes’ when no custom message is set



51
# File 'lib/gem_hadar/changelog_config.rb', line 51

dsl_accessor :commit_message, 'Add to changes'

#filenameString?

The filename attribute accessor for configuring the changelog filename.

This method sets up a DSL accessor for the filename attribute, which specifies the name of the changelog file to be used when generating or modifying changelog entries. It provides a way to define the location of the changelog file that will be processed during various changelog operations within the gem project.

Returns:

  • (String, nil)

    the name of the changelog file or nil if not set



39
# File 'lib/gem_hadar/changelog_config.rb', line 39

dsl_accessor :filename