version_gem 1.1.4 → 1.1.8
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 +83 -5
- data/CODE_OF_CONDUCT.md +80 -29
- data/CONTRIBUTING.md +101 -49
- data/LICENSE.txt +1 -1
- data/README.md +443 -214
- data/SECURITY.md +12 -4
- data/lib/version_gem/api.rb +2 -0
- data/lib/version_gem/basic.rb +0 -0
- data/lib/version_gem/epoch.rb +70 -0
- data/lib/version_gem/error.rb +3 -0
- data/lib/version_gem/rspec.rb +25 -0
- data/lib/version_gem/ruby.rb +7 -2
- data/lib/version_gem/version.rb +3 -1
- data/lib/version_gem.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +49 -38
- metadata.gz.sig +0 -0
data/SECURITY.md
CHANGED
@@ -6,8 +6,16 @@
|
|
6
6
|
|----------|-----------|
|
7
7
|
| 1.latest | ✅ |
|
8
8
|
|
9
|
-
##
|
9
|
+
## Security contact information
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
To report a security vulnerability, please use the
|
12
|
+
[Tidelift security contact](https://tidelift.com/security).
|
13
|
+
Tidelift will coordinate the fix and disclosure.
|
14
|
+
|
15
|
+
## Additional Support
|
16
|
+
|
17
|
+
If you are interested in support for versions older than the latest release,
|
18
|
+
please consider sponsoring the project / maintainer @ https://liberapay.com/pboling/donate,
|
19
|
+
or find other sponsorship links in the [README].
|
20
|
+
|
21
|
+
[README]: README.md
|
data/lib/version_gem/api.rb
CHANGED
data/lib/version_gem/basic.rb
CHANGED
File without changes
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "error"
|
4
|
+
require_relative "api"
|
5
|
+
|
6
|
+
module VersionGem
|
7
|
+
# Support for Epoch Semantic Versioning
|
8
|
+
# See: https://antfu.me/posts/epoch-semver
|
9
|
+
module Epoch
|
10
|
+
EPOCH_SIZE = 1_000
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def extended(base)
|
14
|
+
raise Error, "VERSION must be defined before 'extend #{name}'" unless defined?(base::VERSION)
|
15
|
+
|
16
|
+
base.extend(Api)
|
17
|
+
base.extend(OverloadApiForEpoch)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Tweak the basic API so it will support Epoch Semantic Versioning
|
22
|
+
module OverloadApiForEpoch
|
23
|
+
# *** OVERLOAD METHODS FROM API ***
|
24
|
+
#
|
25
|
+
# The epoch version
|
26
|
+
#
|
27
|
+
# @return [Integer]
|
28
|
+
def epoch
|
29
|
+
@epoch ||= _major / EPOCH_SIZE
|
30
|
+
end
|
31
|
+
|
32
|
+
# The major version
|
33
|
+
#
|
34
|
+
# @return [Integer]
|
35
|
+
def major
|
36
|
+
@major ||= _major % EPOCH_SIZE
|
37
|
+
end
|
38
|
+
|
39
|
+
# The version number as a hash
|
40
|
+
#
|
41
|
+
# @return [Hash]
|
42
|
+
def to_h
|
43
|
+
@to_h ||= {
|
44
|
+
epoch: epoch,
|
45
|
+
major: major,
|
46
|
+
minor: minor,
|
47
|
+
patch: patch,
|
48
|
+
pre: pre,
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
# NOTE: This is not the same as _to_a, which returns an array of strings
|
53
|
+
#
|
54
|
+
# The version number as an array of cast values
|
55
|
+
# where epoch and major are derived from a single string:
|
56
|
+
# EPOCH * 1000 + MAJOR
|
57
|
+
#
|
58
|
+
# @return [Array<[Integer, String, NilClass]>]
|
59
|
+
def to_a
|
60
|
+
@to_a ||= [epoch, major, minor, patch, pre]
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def _major
|
66
|
+
@_major ||= _to_a[0].to_i
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/version_gem/error.rb
CHANGED
data/lib/version_gem/rspec.rb
CHANGED
@@ -12,6 +12,12 @@ RSpec::Matchers.define(:have_version_as_string) do
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
RSpec::Matchers.define(:have_epoch_as_integer) do
|
16
|
+
match do |version_mod|
|
17
|
+
version_mod.epoch.is_a?(Integer)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
15
21
|
RSpec::Matchers.define(:have_major_as_integer) do
|
16
22
|
match do |version_mod|
|
17
23
|
version_mod.major.is_a?(Integer)
|
@@ -52,3 +58,22 @@ RSpec.shared_examples_for("a Version module") do |version_mod|
|
|
52
58
|
end
|
53
59
|
end
|
54
60
|
end
|
61
|
+
|
62
|
+
# This one is more Epoch ;)
|
63
|
+
RSpec.shared_examples_for("an Epoch Version module") do |version_mod|
|
64
|
+
it "is introspectable" do
|
65
|
+
aggregate_failures "introspectable api" do
|
66
|
+
expect(version_mod).is_a?(Module)
|
67
|
+
expect(version_mod).to(have_version_constant)
|
68
|
+
expect(version_mod).to(have_version_as_string)
|
69
|
+
expect(version_mod.to_s).to(be_a(String))
|
70
|
+
expect(version_mod).to(have_epoch_as_integer)
|
71
|
+
expect(version_mod).to(have_major_as_integer)
|
72
|
+
expect(version_mod).to(have_minor_as_integer)
|
73
|
+
expect(version_mod).to(have_patch_as_integer)
|
74
|
+
expect(version_mod).to(have_pre_as_nil_or_string)
|
75
|
+
expect(version_mod.to_h.keys).to(match_array(%i[epoch major minor patch pre]))
|
76
|
+
expect(version_mod.to_a).to(be_a(Array))
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/lib/version_gem/ruby.rb
CHANGED
@@ -1,16 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module VersionGem
|
2
4
|
# Helpers for library CI integration against many different versions of Ruby
|
3
5
|
module Ruby
|
4
6
|
RUBY_VER = ::Gem::Version.new(RUBY_VERSION)
|
5
7
|
|
8
|
+
# Check if the current Ruby version is greater than or equal to the given version
|
6
9
|
def gte_minimum_version?(version, engine = "ruby")
|
7
10
|
RUBY_VER >= ::Gem::Version.new(version) && ::RUBY_ENGINE == engine
|
8
11
|
end
|
9
12
|
module_function :gte_minimum_version?
|
10
13
|
|
14
|
+
# Check if the current Ruby version (MAJOR.MINOR) is equal to the given version
|
11
15
|
def actual_minor_version?(major, minor, engine = "ruby")
|
12
|
-
|
13
|
-
|
16
|
+
segs = RUBY_VER.segments
|
17
|
+
major.to_i == segs[0] &&
|
18
|
+
minor.to_i == segs[1] &&
|
14
19
|
::RUBY_ENGINE == engine
|
15
20
|
end
|
16
21
|
module_function :actual_minor_version?
|
data/lib/version_gem/version.rb
CHANGED
@@ -2,11 +2,13 @@
|
|
2
2
|
|
3
3
|
module VersionGem
|
4
4
|
module Version
|
5
|
-
VERSION = "1.1.
|
5
|
+
VERSION = "1.1.8"
|
6
6
|
# This would work in this gem, but not in external libraries,
|
7
7
|
# because version files are loaded in Gemspecs before bundler
|
8
8
|
# has a chance to load dependencies.
|
9
9
|
# Instead, see lib/version_gem.rb for a solution that will work everywhere
|
10
10
|
# extend VersionGem::Basic
|
11
|
+
# or
|
12
|
+
# extend VersionGem::Epoch
|
11
13
|
end
|
12
14
|
end
|
data/lib/version_gem.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,42 +1,41 @@
|
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Boling
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain:
|
11
10
|
- |
|
12
11
|
-----BEGIN CERTIFICATE-----
|
13
12
|
MIIEgDCCAuigAwIBAgIBATANBgkqhkiG9w0BAQsFADBDMRUwEwYDVQQDDAxwZXRl
|
14
13
|
ci5ib2xpbmcxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ix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28
27
|
A1UdEgQaMBiBFnBldGVyLmJvbGluZ0BnbWFpbC5jb20wDQYJKoZIhvcNAQELBQAD
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
28
|
+
ggGBAJbnUwfJQFPkBgH9cL7hoBfRtmWiCvdqdjeTmi04u8zVNCUox0A4gT982DE9
|
29
|
+
wmuN12LpdajxZONqbXuzZvc+nb0StFwmFYZG6iDwaf4BPywm2e/Vmq0YG45vZXGR
|
30
|
+
L8yMDSK1cQXjmA+ZBKOHKWavxP6Vp7lWvjAhz8RFwqF9GuNIdhv9NpnCAWcMZtpm
|
31
|
+
GUPyIWw/Cw/2wZp74QzZj6Npx+LdXoLTF1HMSJXZ7/pkxLCsB8m4EFVdb/IrW/0k
|
32
|
+
kNSfjtAfBHO8nLGuqQZVH9IBD1i9K6aSs7pT6TW8itXUIlkIUI2tg5YzW6OFfPzq
|
33
|
+
QekSkX3lZfY+HTSp/o+YvKkqWLUV7PQ7xh1ZYDtocpaHwgxe/j3bBqHE+CUPH2vA
|
34
|
+
0V/FwdTRWcwsjVoOJTrYcff8pBZ8r2MvtAc54xfnnhGFzeRHfcltobgFxkAXdE6p
|
35
|
+
DVjBtqT23eugOqQ73umLcYDZkc36vnqGxUBSsXrzY9pzV5gGr2I8YUxMqf6ATrZt
|
36
|
+
L9nRqA==
|
38
37
|
-----END CERTIFICATE-----
|
39
|
-
date:
|
38
|
+
date: 2025-05-06 00:00:00.000000000 Z
|
40
39
|
dependencies:
|
41
40
|
- !ruby/object:Gem::Dependency
|
42
41
|
name: rspec
|
@@ -44,14 +43,14 @@ dependencies:
|
|
44
43
|
requirements:
|
45
44
|
- - "~>"
|
46
45
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
46
|
+
version: '3.13'
|
48
47
|
type: :development
|
49
48
|
prerelease: false
|
50
49
|
version_requirements: !ruby/object:Gem::Requirement
|
51
50
|
requirements:
|
52
51
|
- - "~>"
|
53
52
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
53
|
+
version: '3.13'
|
55
54
|
- !ruby/object:Gem::Dependency
|
56
55
|
name: rspec-block_is_expected
|
57
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,26 +80,32 @@ dependencies:
|
|
81
80
|
- !ruby/object:Gem::Version
|
82
81
|
version: '13.0'
|
83
82
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
83
|
+
name: stone_checksums
|
85
84
|
requirement: !ruby/object:Gem::Requirement
|
86
85
|
requirements:
|
87
86
|
- - "~>"
|
88
87
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0
|
88
|
+
version: '1.0'
|
90
89
|
type: :development
|
91
90
|
prerelease: false
|
92
91
|
version_requirements: !ruby/object:Gem::Requirement
|
93
92
|
requirements:
|
94
93
|
- - "~>"
|
95
94
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0
|
95
|
+
version: '1.0'
|
97
96
|
description: Versions are good. Versions are cool. Versions will win.
|
98
97
|
email:
|
99
98
|
- peter.boling@gmail.com
|
100
99
|
- oauth-ruby@googlegroups.com
|
101
100
|
executables: []
|
102
101
|
extensions: []
|
103
|
-
extra_rdoc_files:
|
102
|
+
extra_rdoc_files:
|
103
|
+
- CHANGELOG.md
|
104
|
+
- CODE_OF_CONDUCT.md
|
105
|
+
- CONTRIBUTING.md
|
106
|
+
- LICENSE.txt
|
107
|
+
- README.md
|
108
|
+
- SECURITY.md
|
104
109
|
files:
|
105
110
|
- CHANGELOG.md
|
106
111
|
- CODE_OF_CONDUCT.md
|
@@ -111,6 +116,7 @@ files:
|
|
111
116
|
- lib/version_gem.rb
|
112
117
|
- lib/version_gem/api.rb
|
113
118
|
- lib/version_gem/basic.rb
|
119
|
+
- lib/version_gem/epoch.rb
|
114
120
|
- lib/version_gem/error.rb
|
115
121
|
- lib/version_gem/rspec.rb
|
116
122
|
- lib/version_gem/ruby.rb
|
@@ -119,17 +125,23 @@ homepage: https://gitlab.com/oauth-xx/version_gem
|
|
119
125
|
licenses:
|
120
126
|
- MIT
|
121
127
|
metadata:
|
122
|
-
homepage_uri: https://
|
123
|
-
source_code_uri: https://gitlab.com/oauth-xx/version_gem/-/tree/v1.1.
|
124
|
-
changelog_uri: https://gitlab.com/oauth-xx/version_gem/-/blob/v1.1.
|
128
|
+
homepage_uri: https://railsbling.com/tags/version_gem/
|
129
|
+
source_code_uri: https://gitlab.com/oauth-xx/version_gem/-/tree/v1.1.8
|
130
|
+
changelog_uri: https://gitlab.com/oauth-xx/version_gem/-/blob/v1.1.8/CHANGELOG.md
|
125
131
|
bug_tracker_uri: https://gitlab.com/oauth-xx/version_gem/-/issues
|
126
|
-
documentation_uri: https://www.rubydoc.info/gems/version_gem/1.1.
|
132
|
+
documentation_uri: https://www.rubydoc.info/gems/version_gem/1.1.8
|
127
133
|
wiki_uri: https://gitlab.com/oauth-xx/version_gem/-/wiki
|
128
134
|
mailing_list_uri: https://groups.google.com/g/oauth-ruby
|
129
135
|
funding_uri: https://liberapay.com/pboling
|
130
136
|
rubygems_mfa_required: 'true'
|
131
|
-
|
132
|
-
|
137
|
+
rdoc_options:
|
138
|
+
- "--title"
|
139
|
+
- version_gem - Enhance your VERSION! Sugar for Version modules.
|
140
|
+
- "--main"
|
141
|
+
- README.md
|
142
|
+
- "--line-numbers"
|
143
|
+
- "--inline-source"
|
144
|
+
- "--quiet"
|
133
145
|
require_paths:
|
134
146
|
- lib
|
135
147
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -143,8 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
155
|
- !ruby/object:Gem::Version
|
144
156
|
version: '0'
|
145
157
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
147
|
-
signing_key:
|
158
|
+
rubygems_version: 3.6.8
|
148
159
|
specification_version: 4
|
149
160
|
summary: Enhance your VERSION! Sugar for Version modules.
|
150
161
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|