Refactor SemanticVersionable concern to support v-prefix for versions
What does this MR do and why?
- Refactors SemanticVerisionable concern and add support for a
v
prefix for versions. Ex -v1.2.3
. NOTE: We will only allow lowercasev
- Removes configuration options.
- Removes the optional validation - since the concern is purely for versions that are meant to be semver, the functionality of the concern would be rendered meaningless if the versions aren't following the specification -
1.2.3
orv1.2.3
.- NOTE: If the concern is added to a model which has existing records, a backfill migration to make sure records follow semver specs should be made first in order to prevent a breaking changes to the user.
- Removes the custom name configuration option for setter and getter and opts for a generic
semver
method - this will make our codebase consistent and will follow the convention over configuration paradigm.
- Removes the optional validation - since the concern is purely for versions that are meant to be semver, the functionality of the concern would be rendered meaningless if the versions aren't following the specification -
- Removes configuration options.
- Adds a regex for an optional
v
prefix
NOTES:
There are a lot of file changes, which seems like a lot. But most of the changes are simple:
- 8 file changes are simply renaming
version
tosemver
in tests and files, including the factory - 2 removals of code from models (this is possible thanks to the simplifying of the concern)
- 1 docs update
- 1 TODO added to a file
- Regex that supports an additional
v
and its corresponding test - Refactoring itself
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
Make a version, with or without v
. See it show up properly :)
This is MR 1/2 for #441467 (closed)
The following MR will add the database column for semver_prefixed
Edited by Laura Montemayor