Class: Factorix::CLI::Commands::MOD::Changelog::Release

Inherits:
Base
  • Object
show all
Defined in:
lib/factorix/cli/commands/mod/changelog/release.rb

Overview

Convert the Unreleased section to a versioned release

Instance Method Summary collapse

Methods inherited from Base

backup_support!, confirmable!, inherited, require_game_stopped!

Instance Method Details

#call(version: nil, date: nil, changelog: "changelog.txt", info_json: "info.json") ⇒ void

This method returns an undefined value.

Parameters:

  • version (String, nil) (defaults to: nil)

    version string (X.Y.Z)

  • date (String, nil) (defaults to: nil)

    release date (YYYY-MM-DD)

  • changelog (String) (defaults to: "changelog.txt")

    path to changelog file

  • info_json (String) (defaults to: "info.json")

    path to info.json file



22
23
24
25
26
27
28
29
30
# File 'lib/factorix/cli/commands/mod/changelog/release.rb', line 22

def call(version: nil, date: nil, changelog: "changelog.txt", info_json: "info.json", **)
  parsed_version = resolve_version(version, Pathname(info_json))
  release_date = date || Time.now.utc.strftime("%Y-%m-%d")
  path = Pathname(changelog)
  log = Factorix::Changelog.load(path)
  log.release_section(parsed_version, date: release_date)
  log.save(path)
  say "Converted Unreleased to #{parsed_version} (#{release_date})", prefix: :success
end