keygen-sh/request_migrations

Idea: generate changelog

Opened this issue · 1 comments

kceb commented

Thanks for the gem!

I was wondering whether it would make sense to include the ability to programatically generate a changelog based on the request migration descriptions.

What did you have in mind? A prettier API for this, or something else? Or would this work?

RequestMigrations.config.versions.flat_map do |version, migrations|
  migrations.map do |migration|
    klass = migration.to_s.classify.constantize

    "#{version}: #{klass.description_value}"
  end
end
# => [
#   "1.4: updates casing of nested keys in metadata to be snake_case instead of lowerCamelCase",
#   "1.3: renames machine uniqueness strategy to fingerprint uniqueness strategy for Policies",
#   "1.3: renames machine uniqueness strategy to fingerprint uniqueness strategy for a Policy",
#   "1.3: renames machine matching strategy to fingerprint matching strategy for Policies",
#   "1.3: renames machine matching strategy to fingerprint matching strategy for a Policy",
#   "1.3: renames Keygen-X headers to Keygen-X-Id for all responses",
#   "1.2: changes the ALIVE status to NOT_STARTED for a new Machine",
#   "1.1: adjusts validity of non-VALID or EXPIRED validation codes to be false",
#   "1.1: renames the code key to constant for a validation",
#   "1.1: adds concurrent attributes to a collection of Policies",
#   "1.1: adds concurrent attribute to a Policy",
#   "1.0: transforms a collection of Releases' artifacts from has-many to has-one relationships",
#   "1.0: transforms a Release's artifacts from a has-many to has-one relationship",
#   "1.0: copies Artifact attributes onto a collection of Releases",
#   "1.0: copies Artifact attributes onto a Release",
#   "1.0: renames the DRAFT statuses to NOT_PUBLISHED for a collection of Releases",
#   "1.0: renames the DRAFT status to NOT_PUBLISHED for a Release",
#   "1.0: renames the ARTIFACT_FILENAME_EXTENSION_INVALID error code to FILENAME_EXTENSION_INVALID for a new Release",
#   "1.0: adds key attributes to a collection of Artifacts",
#   "1.0: adds key attribute to an Artifact",
#   "1.0: adds product relationship to a collection of Artifacts",
#   "1.0: adds product relationship to an Artifact",
# ]