Skip to content

Commit abd1e51

Browse files
committed
📝 Improve documentation of Epoch SemVer
1 parent 95cb0d7 commit abd1e51

File tree

1 file changed

+46
-5
lines changed

1 file changed

+46
-5
lines changed

README.md

+46-5
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,52 @@ Change it to a nested `Version` namespace (the one implied by the path => namesp
177177
```ruby
178178
module MyLib
179179
module Version
180-
VERSION = "1024.3.8"
180+
VERSION = "0.1.0"
181181
end
182182
end
183183
```
184184

185+
This will start your library with the following version segments:
186+
187+
* `epoch = 0`
188+
* `major = 0`
189+
* `minor = 1`
190+
* `patch = 0`
191+
* `pre = nil`
192+
193+
The Epoch and Major versions are derived from the formula:
194+
195+
```
196+
{EPOCH * 1000 + MAJOR}.MINOR.PATCH
197+
```
198+
199+
And the segments are defined as:
200+
201+
```
202+
EPOCH: Increment when you make significant or groundbreaking changes.
203+
MAJOR: Increment when you make minor incompatible API changes.
204+
MINOR: Increment when you add functionality in a backwards-compatible manner.
205+
PATCH: Increment when you make backwards-compatible bug fixes.
206+
```
207+
208+
Therefore if you set your version number to:
209+
210+
```ruby
211+
VERSION = "27016.42.86-pre.7"
212+
```
213+
214+
You will get the following version segments:
215+
216+
```
217+
{
218+
epoch: 27,
219+
major: 16,
220+
minor: 42,
221+
patch: 86,
222+
pre: "pre-7",
223+
}
224+
```
225+
185226
Now add the following near the top of the file the manages requiring external libraries.
186227
Using the same example of `bundle gem my_lib`, this would be `lib/my_lib.rb`.
187228

@@ -475,10 +516,10 @@ or one of the others at the head of this README.
475516
[👽oss-helpi]: https://www.codetriage.com/oauth-xx/version_gem/badges/users.svg
476517
[👽version]: https://rubygems.org/gems/version_gem
477518
[👽versioni]: https://img.shields.io/gem/v/version_gem.svg
478-
[🔑cc-mnt]: https://codeclimate.com/github/oauth-xx/version_gem/maintainability
479-
[🔑cc-mnti♻️]: https://api.codeclimate.com/v1/badges/e26c543320ca0d14e871/maintainability
480-
[🔑cc-cov]: https://codeclimate.com/github/oauth-xx/version_gem/test_coverage
481-
[🔑cc-covi♻️]: https://api.codeclimate.com/v1/badges/e26c543320ca0d14e871/test_coverage
519+
[🔑cc-mnt]: https://qlty.sh/gh/rubocop-lts/projects/standard-rubocop-lts
520+
[🔑cc-mnti♻️]: https://qlty.sh/badges/19404e90-9168-451a-8dac-882382cb768d/maintainability.svg
521+
[🔑cc-cov]: https://qlty.sh/gh/rubocop-lts/projects/standard-rubocop-lts
522+
[🔑cc-covi♻️]: https://qlty.sh/badges/19404e90-9168-451a-8dac-882382cb768d/test_coverage.svg
482523
[🔑codecov]: https://codecov.io/gh/oauth-xx/version_gem
483524
[🔑codecovi♻️]: https://codecov.io/gh/oauth-xx/version_gem/branch/main/graph/badge.svg?token=cc6UdZCpAL
484525
[🔑coveralls]: https://coveralls.io/github/oauth-xx/version_gem?branch=main

0 commit comments

Comments
 (0)