Module: Reissue

Defined in:
lib/reissue.rb,
lib/reissue/gem.rb,
lib/reissue/rake.rb,
lib/reissue/parser.rb,
lib/reissue/printer.rb,
lib/reissue/version.rb,
lib/reissue/markdown.rb,
lib/reissue/version_updater.rb,
lib/reissue/changelog_updater.rb

Overview

Reissue is a module that provides functionality for updating version numbers and changelogs.

Defined Under Namespace

Modules: Gem, Versioning Classes: ChangelogUpdater, Markdown, Parser, Printer, Task, VersionUpdater

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.call(version_file:, changelog_file: "CHANGELOG.md", segment: "patch", date: "Unreleased", changes: {}, version_limit: 2, version_redo_proc: nil) ⇒ String

Updates the version number and changelog.

Parameters:

  • version_file (String)

    The path to the version file.

  • changelog_file (String) (defaults to: "CHANGELOG.md")

    The path to the changelog file. Default: CHANGELOG.md

  • segment (String) (defaults to: "patch")

    The segment of the version number to update. Default: patch

  • date (String) (defaults to: "Unreleased")

    The release date. Default: Unreleased

  • changes (Hash) (defaults to: {})

    The changes made in this release. Default: {}

  • version_limit (Integer) (defaults to: 2)

    The number of versions to retain in the changes. Default: 2

Returns:

  • (String)

    The new version number.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/reissue.rb', line 19

def self.call(
  version_file:,
  changelog_file: "CHANGELOG.md",
  segment: "patch",
  date: "Unreleased",
  changes: {},
  version_limit: 2,
  version_redo_proc: nil
)
  version_updater = VersionUpdater.new(version_file, version_redo_proc:)
  new_version = version_updater.call(segment, version_file:)
  if changelog_file
    changelog_updater = ChangelogUpdater.new(changelog_file)
    changelog_updater.call(new_version, date:, changes:, changelog_file:, version_limit:)
  end
  new_version
end

.finalize(date = Date.today, changelog_file: "CHANGELOG.md") ⇒ Array

Finalizes the changelog for an unreleased version to set the release date.

Parameters:

  • date (String) (defaults to: Date.today)

    The release date.

  • changelog_file (String) (defaults to: "CHANGELOG.md")

    The path to the changelog file.

Returns:

  • (Array)

    The version number and release date.



43
44
45
46
47
# File 'lib/reissue.rb', line 43

def self.finalize(date = Date.today, changelog_file: "CHANGELOG.md")
  changelog_updater = ChangelogUpdater.new(changelog_file)
  changelog = changelog_updater.finalize(date:, changelog_file:)
  changelog["versions"].first.slice("version", "date").values
end

.greeksObject



2
3
4
# File 'lib/reissue/version_updater.rb', line 2

module_function def greeks
  %w[alpha beta gamma delta epsilon zeta eta theta kappa lambda mu nu xi omicron pi rho sigma tau upsilon phi chi psi omega]
end

.reformat(file, version_limit: 2) ⇒ Object

Reformats the changelog file to ensure it is correctly formatted.

Parameters:

  • file (String)

    The path to the changelog file.

  • version_limit (Integer) (defaults to: 2)

    The number of versions to retain in the changelog. Default: 2



53
54
55
56
# File 'lib/reissue.rb', line 53

def self.reformat(file, version_limit: 2)
  changelog_updater = ChangelogUpdater.new(file)
  changelog_updater.reformat(version_limit:)
end