version_gem 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +20 -1
- data/README.md +93 -68
- data/lib/version_gem/api.rb +3 -2
- data/lib/version_gem/basic.rb +7 -5
- data/lib/version_gem/rspec.rb +18 -18
- data/lib/version_gem/ruby.rb +2 -2
- data/lib/version_gem/version.rb +1 -1
- data/lib/version_gem.rb +3 -2
- data.tar.gz.sig +0 -0
- metadata +23 -71
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c7542245fe84d4314202cd4ea1347fdaefce4cdc256fc7216705c90561e0a07f
|
|
4
|
+
data.tar.gz: 8864b667e84866e2d4365b7e2105dbb4e6be10bf64b08547afc357bb1e9a7f96
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 12ece5174289be925d3401789beee24d3ecee4438595fa453d51b57af5d44ffa9edf80cb313fd5c96f1c3f969d0af00a360ce723394d80a33e02c5a6e1064538
|
|
7
|
+
data.tar.gz: ddf738a490b738f42a89d060fa76c0c186a462f0edda7cc970b20e1e62cb918e7e8db06c18b805f31f9933c8c734b9ddebc863481c3ced59e8e4e99092e9d678
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
10
10
|
### Fixed
|
|
11
11
|
### Removed
|
|
12
12
|
|
|
13
|
+
## [1.1.3] 2023-06-05 ([tag][1.1.3t])
|
|
14
|
+
### Added
|
|
15
|
+
- More test coverage (now 100% 🎉) (@pboling)
|
|
16
|
+
- Improved documentation (now 77% 🎉) (@pboling)
|
|
17
|
+
- Gemfile context pattern (@pboling)
|
|
18
|
+
- Improved linting (via rubocop-lts) (@pboling)
|
|
19
|
+
- More robust GHA config (@pboling)
|
|
20
|
+
- (dev) Dependencies (@pboling)
|
|
21
|
+
- yard-junk
|
|
22
|
+
- redcarpet
|
|
23
|
+
- pry, IRB alternative
|
|
24
|
+
- pry-suite
|
|
25
|
+
- debase, for IDE debugging
|
|
26
|
+
- (dev) Rake task for rubocop_gradual (@pboling)
|
|
27
|
+
### Fixed
|
|
28
|
+
- (dev) `yard` documentation task (@pboling)
|
|
29
|
+
|
|
13
30
|
## [1.1.2] - 2023-03-17 ([tag][1.1.2t])
|
|
14
31
|
### Added
|
|
15
32
|
- `VersionGem::Ruby` to help library CI integration against many different versions of Ruby (@pboling)
|
|
@@ -49,7 +66,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
49
66
|
### Added
|
|
50
67
|
- Initial release, with basic version parsing API (@pboling)
|
|
51
68
|
|
|
52
|
-
[Unreleased]: https://gitlab.com/oauth-xx/version_gem/-/compare/v1.1.
|
|
69
|
+
[Unreleased]: https://gitlab.com/oauth-xx/version_gem/-/compare/v1.1.3...HEAD
|
|
70
|
+
[1.1.3]: https://gitlab.com/oauth-xx/version_gem/-/compare/v1.1.2...v1.1.3
|
|
71
|
+
[1.1.3t]: https://gitlab.com/oauth-xx/oauth2/-/tags/v1.1.3
|
|
53
72
|
[1.1.2]: https://gitlab.com/oauth-xx/version_gem/-/compare/v1.1.1...v1.1.2
|
|
54
73
|
[1.1.2t]: https://gitlab.com/oauth-xx/oauth2/-/tags/v1.1.2
|
|
55
74
|
[1.1.1]: https://gitlab.com/oauth-xx/version_gem/-/compare/v1.1.0...v1.1.1
|
data/README.md
CHANGED
|
@@ -8,8 +8,8 @@ This gem has a very niche purpose, which is:
|
|
|
8
8
|
2. while not interfering with `gemspec` parsing where the `VERSION` string is traditionally used.
|
|
9
9
|
|
|
10
10
|
If this isn't **precisely** your use case you may be better off looking at
|
|
11
|
-
[
|
|
12
|
-
gem from the Alchemists, or [
|
|
11
|
+
_[versionaire](https://www.alchemists.io/projects/versionaire)_, a wonderful, performant, well-maintained,
|
|
12
|
+
gem from the Alchemists, or _[version_sorter](https://rubygems.org/gems/version_sorter)_ from GitHub.
|
|
13
13
|
|
|
14
14
|
For more discussion about this [see issue #2](https://gitlab.com/oauth-xx/version_gem/-/issues/2)
|
|
15
15
|
|
|
@@ -27,7 +27,7 @@ MyLib::Version.to_a # => [1, 2, 3, "rc3"]
|
|
|
27
27
|
MyLib::Version.to_h # => { major: 1, minor: 2, patch: 3, pre: "rc3" }
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
This library was extracted from the gem [
|
|
30
|
+
This library was extracted from the gem _[oauth2](https://gitlab.com/oauth-xx/oauth2)_.
|
|
31
31
|
|
|
32
32
|
This gem has no runtime dependencies.
|
|
33
33
|
|
|
@@ -58,15 +58,15 @@ appended indicators:
|
|
|
58
58
|
♻️ - URL needs to be updated from SAAS integration. Find / Replace is insufficient.
|
|
59
59
|
-->
|
|
60
60
|
|
|
61
|
-
| | Project | bundle add version_gem
|
|
62
|
-
|
|
63
|
-
| 1️⃣ | name, license, docs, standards | [![RubyGems.org][⛳️name-img]][⛳️gem] [![License: MIT][🖇src-license-img]][🖇src-license] [![RubyDoc.info][🚎yard-img]][🚎yard] [![SemVer 2.0.0][🧮semver-img]][🧮semver] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog]
|
|
64
|
-
| 2️⃣ | version & activity | [![Gem Version][⛳️version-img]][⛳️gem] [![Total Downloads][🖇DL-total-img]][⛳️gem] [![Download Rank][🏘DL-rank-img]][⛳️gem] [![Source Code][🚎src-main-img]][🚎src-main] [![Open PRs][🖐prs-o-img]][🖐prs-o] [![Closed PRs][🧮prs-c-img]][🧮prs-c]
|
|
65
|
-
| 3️⃣ | maintanence & linting | [![Maintainability][⛳cclim-maint-img♻️]][⛳cclim-maint] [![Helpers][🖇triage-help-img]][🖇triage-help] [![Depfu][🏘depfu-img♻️]][🏘depfu♻️] [![Contributors][🚎contributors-img]][🚎contributors] [![Style][🖐style-wf-img]][🖐style-wf] [![Kloc Roll][🧮kloc-img]][🧮kloc]
|
|
66
|
-
| 4️⃣ | testing | [![Supported][🏘sup-wf-img]][🏘sup-wf] [![Heads][🚎heads-wf-img]][🚎heads-wf] [![Unofficial Support][🖐uns-wf-img]][🖐uns-wf] <!--[![MacOS][🧮mac-wf-img]][🧮mac-wf] [![Windows][📗win-wf-img]][📗win-wf]-->
|
|
67
|
-
| 5️⃣ | coverage & security | [![CodeClimate][⛳cclim-cov-img♻️]][⛳cclim-cov] [![CodeCov][🖇codecov-img♻️]][🖇codecov] [![Coveralls][🏘coveralls-img]][🏘coveralls] [![Security Policy][🚎sec-pol-img]][🚎sec-pol] [![CodeQL][🖐codeQL-img]][🖐codeQL] [![Code Coverage][🧮cov-wf-img]][🧮cov-wf]
|
|
68
|
-
| 6️⃣ | resources | [![Get help on Codementor][🖇codementor-img]][🖇codementor] [![Chat][🏘chat-img]][🏘chat] [![Blog][🚎blog-img]][🚎blog] [![Wiki][🖐wiki-img]][🖐wiki]
|
|
69
|
-
| 7️⃣ | spread 💖 | [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay] [![Sponsor Me][🖇sponsor-img]][🖇sponsor] [![Tweet @ Peter][🏘tweet-img]][🏘tweet] [🌏][aboutme] [👼][angelme] [💻][coderme]
|
|
61
|
+
| | Project | bundle add version_gem |
|
|
62
|
+
|:----|--------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
63
|
+
| 1️⃣ | name, license, docs, standards | [![RubyGems.org][⛳️name-img]][⛳️gem] [![License: MIT][🖇src-license-img]][🖇src-license] [![RubyDoc.info][🚎yard-img]][🚎yard] [![SemVer 2.0.0][🧮semver-img]][🧮semver] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog] |
|
|
64
|
+
| 2️⃣ | version & activity | [![Gem Version][⛳️version-img]][⛳️gem] [![Total Downloads][🖇DL-total-img]][⛳️gem] [![Download Rank][🏘DL-rank-img]][⛳️gem] [![Source Code][🚎src-main-img]][🚎src-main] [![Open PRs][🖐prs-o-img]][🖐prs-o] [![Closed PRs][🧮prs-c-img]][🧮prs-c] |
|
|
65
|
+
| 3️⃣ | maintanence & linting | [![Maintainability][⛳cclim-maint-img♻️]][⛳cclim-maint] [![Helpers][🖇triage-help-img]][🖇triage-help] [![Depfu][🏘depfu-img♻️]][🏘depfu♻️] [![Contributors][🚎contributors-img]][🚎contributors] [![Style][🖐style-wf-img]][🖐style-wf] [![Kloc Roll][🧮kloc-img]][🧮kloc] |
|
|
66
|
+
| 4️⃣ | testing | [![Supported][🏘sup-wf-img]][🏘sup-wf] [![Heads][🚎heads-wf-img]][🚎heads-wf] [![Unofficial Support][🖐uns-wf-img]][🖐uns-wf] <!--[![MacOS][🧮mac-wf-img]][🧮mac-wf] [![Windows][📗win-wf-img]][📗win-wf]--> |
|
|
67
|
+
| 5️⃣ | coverage & security | [![CodeClimate][⛳cclim-cov-img♻️]][⛳cclim-cov] [![CodeCov][🖇codecov-img♻️]][🖇codecov] [![Coveralls][🏘coveralls-img]][🏘coveralls] [![Security Policy][🚎sec-pol-img]][🚎sec-pol] [![CodeQL][🖐codeQL-img]][🖐codeQL] [![Code Coverage][🧮cov-wf-img]][🧮cov-wf] |
|
|
68
|
+
| 6️⃣ | resources | [![Get help on Codementor][🖇codementor-img]][🖇codementor] [![Chat][🏘chat-img]][🏘chat] [![Blog][🚎blog-img]][🚎blog] [![Wiki][🖐wiki-img]][🖐wiki] |
|
|
69
|
+
| 7️⃣ | spread 💖 | [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay] [![Sponsor Me][🖇sponsor-img]][🖇sponsor] [![Tweet @ Peter][🏘tweet-img]][🏘tweet] [🌏][aboutme] [👼][angelme] [💻][coderme] |
|
|
70
70
|
|
|
71
71
|
<!--
|
|
72
72
|
The link tokens in the following sections should be kept ordered by the row and badge numbering scheme
|
|
@@ -221,6 +221,49 @@ MyLib::Version.to_h # => { major: 0, minor: 1, patch: 0, pre: "" }
|
|
|
221
221
|
|
|
222
222
|
Your `version.rb` file now abides the Ruby convention of directory / path matching the namespace / class!
|
|
223
223
|
|
|
224
|
+
### Zietwerk
|
|
225
|
+
|
|
226
|
+
The pattern of `version.rb` breaking the ruby convention of directory / path matching the namespace / class
|
|
227
|
+
is so entrenched that the `zeitwerk` library has a special carve-out for it.
|
|
228
|
+
RubyGems using this "bad is actually good" pattern are encouraged to use `Zeitwerk.for_gem`.
|
|
229
|
+
|
|
230
|
+
**Do not do that ^** if you use this gem.
|
|
231
|
+
|
|
232
|
+
#### Simple Zeitwerk Example
|
|
233
|
+
|
|
234
|
+
Create a gem like this (keeping with the `MyLib` theme):
|
|
235
|
+
|
|
236
|
+
```shell
|
|
237
|
+
bundle gem my_lib
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Then following the usage instructions above, you edit your primary namespace file @ `lib/my_lib.rb`,
|
|
241
|
+
but inject the Zeitwerk loader.
|
|
242
|
+
|
|
243
|
+
```ruby
|
|
244
|
+
# frozen_string_literal: true
|
|
245
|
+
|
|
246
|
+
require_relative "my_lib/version"
|
|
247
|
+
|
|
248
|
+
module MyLib
|
|
249
|
+
class Error < StandardError; end
|
|
250
|
+
# Your code goes here...
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
loader = Zeitwerk::Loader.new
|
|
254
|
+
loader.tag = File.basename(__FILE__, ".rb")
|
|
255
|
+
loader.push_dir("lib/my_lib", namespace: MyLib)
|
|
256
|
+
loader.setup # ready!
|
|
257
|
+
loader.eager_load(force: true) # optional!
|
|
258
|
+
|
|
259
|
+
MyLib::Version.class_eval do
|
|
260
|
+
extend VersionGem::Basic
|
|
261
|
+
end
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
#### Complex Zeitwerk Example
|
|
265
|
+
|
|
266
|
+
|
|
224
267
|
#### Query Ruby Version (as of version 1.2.0)
|
|
225
268
|
|
|
226
269
|
In Continuous Integration environments for libraries that run against many versions of Ruby,
|
|
@@ -230,7 +273,7 @@ a significant amount of boilerplate code across each project.
|
|
|
230
273
|
Thus `VersionGem::Ruby` was born. It has the two optimized methods I always need:
|
|
231
274
|
|
|
232
275
|
```ruby
|
|
233
|
-
engine =
|
|
276
|
+
engine = "ruby"
|
|
234
277
|
version = "2.7.7"
|
|
235
278
|
gte_minimum_version?(version, engine) # Is the current version of Ruby greater than or equal to some minimum?
|
|
236
279
|
|
|
@@ -257,29 +300,29 @@ The enhancement from this gem is only available at runtime.
|
|
|
257
300
|
|
|
258
301
|
In `spec_helper.rb`:
|
|
259
302
|
```ruby
|
|
260
|
-
require
|
|
303
|
+
require "version_gem/rspec"
|
|
261
304
|
```
|
|
262
305
|
|
|
263
306
|
Then you can write a test like:
|
|
264
307
|
|
|
265
308
|
```ruby
|
|
266
|
-
RSpec.describe
|
|
267
|
-
it_behaves_like
|
|
309
|
+
RSpec.describe(MyLib::Version) do
|
|
310
|
+
it_behaves_like "a Version module", described_class
|
|
268
311
|
end
|
|
269
312
|
|
|
270
313
|
# Or, if you want to write your own, here is the a la carte menu:
|
|
271
|
-
RSpec.describe
|
|
314
|
+
RSpec.describe(MyLib::Version) do
|
|
272
315
|
it "is a Version module" do
|
|
273
316
|
expect(described_class).is_a?(Module)
|
|
274
|
-
expect(described_class).to
|
|
275
|
-
expect(described_class).to
|
|
276
|
-
expect(described_class.to_s).to
|
|
277
|
-
expect(described_class).to
|
|
278
|
-
expect(described_class).to
|
|
279
|
-
expect(described_class).to
|
|
280
|
-
expect(described_class).to
|
|
281
|
-
expect(described_class.to_h.keys).to
|
|
282
|
-
expect(described_class.to_a).to
|
|
317
|
+
expect(described_class).to(have_version_constant)
|
|
318
|
+
expect(described_class).to(have_version_as_string)
|
|
319
|
+
expect(described_class.to_s).to(be_a(String))
|
|
320
|
+
expect(described_class).to(have_major_as_integer)
|
|
321
|
+
expect(described_class).to(have_minor_as_integer)
|
|
322
|
+
expect(described_class).to(have_patch_as_integer)
|
|
323
|
+
expect(described_class).to(have_pre_as_nil_or_string)
|
|
324
|
+
expect(described_class.to_h.keys).to(match_array(%i[major minor patch pre]))
|
|
325
|
+
expect(described_class.to_a).to(be_a(Array))
|
|
283
326
|
end
|
|
284
327
|
end
|
|
285
328
|
```
|
|
@@ -325,57 +368,39 @@ the [Pessimistic Version Constraint][pvc] with two digits of precision.
|
|
|
325
368
|
For example:
|
|
326
369
|
|
|
327
370
|
```ruby
|
|
328
|
-
spec.add_dependency
|
|
371
|
+
spec.add_dependency("version_gem", "~> 1.1")
|
|
329
372
|
```
|
|
330
373
|
|
|
331
374
|
## Security
|
|
332
375
|
|
|
333
376
|
See [SECURITY.md](https://gitlab.com/oauth-xx/version_gem/-/blob/main/SECURITY.md).
|
|
334
377
|
|
|
378
|
+
[aboutme]: https://about.me/peter.boling
|
|
379
|
+
[actions]: https://github.com/oauth-xx/version_gem/actions
|
|
380
|
+
[angelme]: https://angel.co/peter-boling
|
|
381
|
+
[blogpage]: http://www.railsbling.com/tags/version_gem/
|
|
382
|
+
[codecov_coverage]: https://codecov.io/gh/oauth-xx/version_gem
|
|
383
|
+
[code_triage]: https://www.codetriage.com/oauth-xx/version_gem
|
|
384
|
+
[chat]: https://gitter.im/oauth-xx/version_gem?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
|
385
|
+
[climate_coverage]: https://codeclimate.com/github/oauth-xx/version_gem/test_coverage
|
|
386
|
+
[climate_maintainability]: https://codeclimate.com/github/oauth-xx/version_gem/maintainability
|
|
335
387
|
[copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
|
336
|
-
|
|
337
388
|
[conduct]: https://gitlab.com/oauth-xx/version_gem/-/blob/main/CODE_OF_CONDUCT.md
|
|
338
|
-
|
|
339
389
|
[contributing]: https://gitlab.com/oauth-xx/version_gem/-/blob/main/CONTRIBUTING.md
|
|
340
|
-
|
|
341
|
-
[
|
|
342
|
-
|
|
343
|
-
[
|
|
344
|
-
|
|
390
|
+
[devto]: https://dev.to/galtzo
|
|
391
|
+
[documentation]: https://rubydoc.info/github/oauth-xx/version_gem/main
|
|
392
|
+
[followme]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow
|
|
393
|
+
[gh_sponsors]: https://github.com/sponsors/pboling
|
|
394
|
+
[issues]: https://github.com/oauth-xx/version_gem/issues
|
|
395
|
+
[liberapay_donate]: https://liberapay.com/pboling/donate
|
|
396
|
+
[license]: LICENSE.txt
|
|
345
397
|
[license-ref]: https://opensource.org/licenses/MIT
|
|
346
|
-
|
|
398
|
+
[license-img]: https://img.shields.io/badge/License-MIT-green.svg
|
|
399
|
+
[peterboling]: http://www.peterboling.com
|
|
347
400
|
[pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
|
|
348
|
-
|
|
349
|
-
[aboutme]: https://about.me/peter.boling
|
|
350
|
-
|
|
351
|
-
[angelme]: https://angel.co/peter-boling
|
|
352
|
-
|
|
353
|
-
[coderme]:http://coderwall.com/pboling
|
|
354
|
-
|
|
355
|
-
[followme-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow
|
|
356
|
-
|
|
357
|
-
[tweetme]: http://twitter.com/galtzo
|
|
358
|
-
|
|
359
|
-
[source]: https://gitlab.com/oauth-xx/version_gem/
|
|
360
|
-
|
|
361
|
-
[actions]: https://github.com/oauth-xx/version_gem/actions
|
|
362
|
-
|
|
363
|
-
[issues]: https://gitlab.com/oauth-xx/version_gem/-/issues
|
|
364
|
-
|
|
365
|
-
[climate_maintainability]: https://codeclimate.com/github/pboling/version_gem/maintainability
|
|
366
|
-
|
|
367
|
-
[climate_coverage]: https://codeclimate.com/github/pboling/version_gem/test_coverage
|
|
368
|
-
|
|
369
|
-
[codecov_coverage]: https://codecov.io/gh/pboling/version_gem
|
|
370
|
-
|
|
371
|
-
[code_triage]: https://www.codetriage.com/pboling/version_gem
|
|
372
|
-
|
|
373
|
-
[blogpage]: http://www.railsbling.com/tags/version_gem/
|
|
374
|
-
|
|
401
|
+
[railsbling]: http://www.railsbling.com
|
|
375
402
|
[rubygems]: https://rubygems.org/gems/version_gem
|
|
376
|
-
|
|
377
|
-
[
|
|
378
|
-
|
|
379
|
-
[
|
|
380
|
-
|
|
381
|
-
[gh_sponsors]: https://github.com/sponsors/pboling
|
|
403
|
+
[security]: https://gitlab.com/oauth-xx/version_gem/-/blob/main/SECURITY.md
|
|
404
|
+
[semver]: http://semver.org/
|
|
405
|
+
[source]: https://gitlab.com/oauth-xx/version_gem
|
|
406
|
+
[tweetme]: http://twitter.com/galtzo
|
data/lib/version_gem/api.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
module VersionGem
|
|
2
|
+
# Public API of this library
|
|
2
3
|
module Api
|
|
3
4
|
# The version number as a string
|
|
4
5
|
#
|
|
@@ -43,7 +44,7 @@ module VersionGem
|
|
|
43
44
|
major: major,
|
|
44
45
|
minor: minor,
|
|
45
46
|
patch: patch,
|
|
46
|
-
pre: pre
|
|
47
|
+
pre: pre,
|
|
47
48
|
}
|
|
48
49
|
end
|
|
49
50
|
|
|
@@ -60,7 +61,7 @@ module VersionGem
|
|
|
60
61
|
#
|
|
61
62
|
# @return [Array<String>]
|
|
62
63
|
def _to_a
|
|
63
|
-
@_to_a = self::VERSION.split(
|
|
64
|
+
@_to_a = self::VERSION.split(".")
|
|
64
65
|
end
|
|
65
66
|
end
|
|
66
67
|
end
|
data/lib/version_gem/basic.rb
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
4
|
-
require_relative
|
|
3
|
+
require_relative "error"
|
|
4
|
+
require_relative "api"
|
|
5
5
|
|
|
6
6
|
module VersionGem
|
|
7
7
|
# This is a very *basic* version parser. Others could be built based on this pattern!
|
|
8
8
|
module Basic
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
class << self
|
|
10
|
+
def extended(base)
|
|
11
|
+
raise Error, "VERSION must be defined before 'extend #{name}'" unless defined?(base::VERSION)
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
base.extend(Api)
|
|
14
|
+
end
|
|
13
15
|
end
|
|
14
16
|
end
|
|
15
17
|
end
|
data/lib/version_gem/rspec.rb
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
RSpec::Matchers.define
|
|
3
|
+
RSpec::Matchers.define(:have_version_constant) do
|
|
4
4
|
match do |version_mod|
|
|
5
5
|
version_mod.const_defined?(:VERSION, false)
|
|
6
6
|
end
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
RSpec::Matchers.define
|
|
9
|
+
RSpec::Matchers.define(:have_version_as_string) do
|
|
10
10
|
match do |version_mod|
|
|
11
11
|
!version_mod::VERSION.nil? && version_mod::VERSION.is_a?(String)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
RSpec::Matchers.define
|
|
15
|
+
RSpec::Matchers.define(:have_major_as_integer) do
|
|
16
16
|
match do |version_mod|
|
|
17
17
|
version_mod.major.is_a?(Integer)
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
RSpec::Matchers.define
|
|
21
|
+
RSpec::Matchers.define(:have_minor_as_integer) do
|
|
22
22
|
match do |version_mod|
|
|
23
23
|
version_mod.minor.is_a?(Integer)
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
RSpec::Matchers.define
|
|
27
|
+
RSpec::Matchers.define(:have_patch_as_integer) do
|
|
28
28
|
match do |version_mod|
|
|
29
29
|
version_mod.patch.is_a?(Integer)
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
RSpec::Matchers.define
|
|
33
|
+
RSpec::Matchers.define(:have_pre_as_nil_or_string) do
|
|
34
34
|
match do |version_mod|
|
|
35
35
|
version_mod.pre.nil? || version_mod.pre.is_a?(String)
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
RSpec.shared_examples_for
|
|
40
|
-
it
|
|
41
|
-
aggregate_failures
|
|
39
|
+
RSpec.shared_examples_for("a Version module") do |version_mod|
|
|
40
|
+
it "is introspectable" do
|
|
41
|
+
aggregate_failures "introspectable api" do
|
|
42
42
|
expect(version_mod).is_a?(Module)
|
|
43
|
-
expect(version_mod).to
|
|
44
|
-
expect(version_mod).to
|
|
45
|
-
expect(version_mod.to_s).to
|
|
46
|
-
expect(version_mod).to
|
|
47
|
-
expect(version_mod).to
|
|
48
|
-
expect(version_mod).to
|
|
49
|
-
expect(version_mod).to
|
|
50
|
-
expect(version_mod.to_h.keys).to
|
|
51
|
-
expect(version_mod.to_a).to
|
|
43
|
+
expect(version_mod).to(have_version_constant)
|
|
44
|
+
expect(version_mod).to(have_version_as_string)
|
|
45
|
+
expect(version_mod.to_s).to(be_a(String))
|
|
46
|
+
expect(version_mod).to(have_major_as_integer)
|
|
47
|
+
expect(version_mod).to(have_minor_as_integer)
|
|
48
|
+
expect(version_mod).to(have_patch_as_integer)
|
|
49
|
+
expect(version_mod).to(have_pre_as_nil_or_string)
|
|
50
|
+
expect(version_mod.to_h.keys).to(match_array(%i[major minor patch pre]))
|
|
51
|
+
expect(version_mod.to_a).to(be_a(Array))
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
end
|
data/lib/version_gem/ruby.rb
CHANGED
|
@@ -3,12 +3,12 @@ module VersionGem
|
|
|
3
3
|
module Ruby
|
|
4
4
|
RUBY_VER = ::Gem::Version.new(RUBY_VERSION)
|
|
5
5
|
|
|
6
|
-
def gte_minimum_version?(version, engine =
|
|
6
|
+
def gte_minimum_version?(version, engine = "ruby")
|
|
7
7
|
RUBY_VER >= ::Gem::Version.new(version) && ::RUBY_ENGINE == engine
|
|
8
8
|
end
|
|
9
9
|
module_function :gte_minimum_version?
|
|
10
10
|
|
|
11
|
-
def actual_minor_version?(major, minor, engine =
|
|
11
|
+
def actual_minor_version?(major, minor, engine = "ruby")
|
|
12
12
|
major.to_i == RUBY_VER.segments[0] &&
|
|
13
13
|
minor.to_i == RUBY_VER.segments[1] &&
|
|
14
14
|
::RUBY_ENGINE == engine
|
data/lib/version_gem/version.rb
CHANGED
data/lib/version_gem.rb
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: version_gem
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter Boling
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain:
|
|
11
11
|
- |
|
|
@@ -36,112 +36,64 @@ cert_chain:
|
|
|
36
36
|
gwGrEXGQGDZ0NIgBcmvMOqlXjkGQwQvugKycJ024z89+fz2332vdZIKTrSxJrXGk
|
|
37
37
|
4/bR9A==
|
|
38
38
|
-----END CERTIFICATE-----
|
|
39
|
-
date: 2023-
|
|
39
|
+
date: 2023-06-05 00:00:00.000000000 Z
|
|
40
40
|
dependencies:
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rspec
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- - "
|
|
45
|
+
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
47
|
+
version: '3.12'
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
|
-
- - "
|
|
52
|
+
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
54
|
+
version: '3.12'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: rspec-block_is_expected
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- - "
|
|
59
|
+
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0'
|
|
61
|
+
version: '1.0'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
|
-
- - "
|
|
66
|
+
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0'
|
|
68
|
+
version: '1.0'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: rake
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
|
-
- - "
|
|
73
|
+
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0'
|
|
75
|
+
version: '13.0'
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
|
-
- - "
|
|
80
|
+
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '0'
|
|
82
|
+
version: '13.0'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: pry
|
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
|
86
|
-
requirements:
|
|
87
|
-
- - ">="
|
|
88
|
-
- !ruby/object:Gem::Version
|
|
89
|
-
version: '0'
|
|
90
|
-
type: :development
|
|
91
|
-
prerelease: false
|
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
-
requirements:
|
|
94
|
-
- - ">="
|
|
95
|
-
- !ruby/object:Gem::Version
|
|
96
|
-
version: '0'
|
|
97
|
-
- !ruby/object:Gem::Dependency
|
|
98
|
-
name: rubocop-lts
|
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
|
100
86
|
requirements:
|
|
101
87
|
- - "~>"
|
|
102
88
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '
|
|
104
|
-
- - ">="
|
|
105
|
-
- !ruby/object:Gem::Version
|
|
106
|
-
version: 8.0.2
|
|
89
|
+
version: '0.14'
|
|
107
90
|
type: :development
|
|
108
91
|
prerelease: false
|
|
109
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
110
93
|
requirements:
|
|
111
94
|
- - "~>"
|
|
112
95
|
- !ruby/object:Gem::Version
|
|
113
|
-
version: '
|
|
114
|
-
- - ">="
|
|
115
|
-
- !ruby/object:Gem::Version
|
|
116
|
-
version: 8.0.2
|
|
117
|
-
- !ruby/object:Gem::Dependency
|
|
118
|
-
name: rubocop-rspec
|
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
|
120
|
-
requirements:
|
|
121
|
-
- - ">="
|
|
122
|
-
- !ruby/object:Gem::Version
|
|
123
|
-
version: '0'
|
|
124
|
-
type: :development
|
|
125
|
-
prerelease: false
|
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
127
|
-
requirements:
|
|
128
|
-
- - ">="
|
|
129
|
-
- !ruby/object:Gem::Version
|
|
130
|
-
version: '0'
|
|
131
|
-
- !ruby/object:Gem::Dependency
|
|
132
|
-
name: rubocop-performance
|
|
133
|
-
requirement: !ruby/object:Gem::Requirement
|
|
134
|
-
requirements:
|
|
135
|
-
- - ">="
|
|
136
|
-
- !ruby/object:Gem::Version
|
|
137
|
-
version: '0'
|
|
138
|
-
type: :development
|
|
139
|
-
prerelease: false
|
|
140
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
141
|
-
requirements:
|
|
142
|
-
- - ">="
|
|
143
|
-
- !ruby/object:Gem::Version
|
|
144
|
-
version: '0'
|
|
96
|
+
version: '0.14'
|
|
145
97
|
description: Versions are good. Versions are cool. Versions will win.
|
|
146
98
|
email:
|
|
147
99
|
- peter.boling@gmail.com
|
|
@@ -168,15 +120,15 @@ licenses:
|
|
|
168
120
|
- MIT
|
|
169
121
|
metadata:
|
|
170
122
|
homepage_uri: https://gitlab.com/oauth-xx/version_gem
|
|
171
|
-
source_code_uri: https://gitlab.com/oauth-xx/version_gem/-/tree/v1.1.
|
|
172
|
-
changelog_uri: https://gitlab.com/oauth-xx/version_gem/-/blob/v1.1.
|
|
123
|
+
source_code_uri: https://gitlab.com/oauth-xx/version_gem/-/tree/v1.1.3
|
|
124
|
+
changelog_uri: https://gitlab.com/oauth-xx/version_gem/-/blob/v1.1.3/CHANGELOG.md
|
|
173
125
|
bug_tracker_uri: https://gitlab.com/oauth-xx/version_gem/-/issues
|
|
174
|
-
documentation_uri: https://www.rubydoc.info/gems/version_gem/1.1.
|
|
126
|
+
documentation_uri: https://www.rubydoc.info/gems/version_gem/1.1.3
|
|
175
127
|
wiki_uri: https://gitlab.com/oauth-xx/version_gem/-/wiki
|
|
176
128
|
mailing_list_uri: https://groups.google.com/g/oauth-ruby
|
|
177
129
|
funding_uri: https://liberapay.com/pboling
|
|
178
130
|
rubygems_mfa_required: 'true'
|
|
179
|
-
post_install_message:
|
|
131
|
+
post_install_message:
|
|
180
132
|
rdoc_options: []
|
|
181
133
|
require_paths:
|
|
182
134
|
- lib
|
|
@@ -191,8 +143,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
191
143
|
- !ruby/object:Gem::Version
|
|
192
144
|
version: '0'
|
|
193
145
|
requirements: []
|
|
194
|
-
rubygems_version: 3.4.
|
|
195
|
-
signing_key:
|
|
146
|
+
rubygems_version: 3.4.10
|
|
147
|
+
signing_key:
|
|
196
148
|
specification_version: 4
|
|
197
149
|
summary: Enhance your VERSION! Sugar for Version modules.
|
|
198
150
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|