version_gem 1.0.2 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2743c035006592c0f69c6aadd90a0b92f6117e7dff255e904caaa49c188505c
4
- data.tar.gz: 954c7f45ccfa74232e9e87d9f772aef5fad889283bdde78c9aa4321b49149b41
3
+ metadata.gz: 617f64c21f615e873f17b3774d4cc1e156d10f276c670f7f84308b2fd0853d75
4
+ data.tar.gz: '082c40a241be990945f0f4c9939419b5aa49c632bc1ff77e2ab9459736855519'
5
5
  SHA512:
6
- metadata.gz: a7abd21eb351d7f7654583ce7c07df67f95b6f930c5ad308f7b4167f2955b441b9533a73329fc8c487f1692d654c8144cb9fd98faa637c4cb0a6fa30d08312e3
7
- data.tar.gz: 73b702bfa29ddd6595bfe434acbb6612c7cbaa3ed40d2bb507fd9f25a69bfd6607383436267fe60406d58762ba3dfa6eb381f4ddca85fe210e6e7cade6314867
6
+ metadata.gz: 396d61f301aac49502dcef070dcbca71343b9e1532062e8b5c90b2dfbb1d2bd63d714ea8261c76bcbb2048c49de2810742cfba8235b048b7c958dc567f57da66
7
+ data.tar.gz: 2f8a9fabf0e1388528fc25ee8e6372c9347413acb3ad31726a831b768c49df2da5f493de4f290039d4afb4248855e1a963967abd835151271db11f3193124df0
checksums.yaml.gz.sig ADDED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- # Changelog
1
+ # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@@ -6,29 +6,50 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
  ### Added
9
-
10
9
  ### Changed
11
-
12
10
  ### Fixed
13
-
14
11
  ### Removed
15
12
 
16
- ## [1.0.2] - 2022-06-23
13
+ ## [1.1.1] - 2022-09-19 ([tag][1.1.1t])
14
+ ### Added
15
+ - Alternatives section to README.md (@pboling)
16
+ - Signing cert for gem releases (@pboling)
17
+ - Mailing List and other metadata URIs (@pboling)
18
+ - Checksums for released gems (@pboling)
19
+ ### Changed
20
+ - SECURITY.md policy (@pboling)
21
+ - Version methods are now memoized (||=) on initial call for performance (@pboling)
22
+ - Gem releases are now cryptographically signed (@pboling)
23
+
24
+ ## [1.1.0] - 2022-06-24 ([tag][1.1.0t])
25
+ ### Fixed
26
+ - to_a uses same type casting as major, minor, patch, and pre (@pboling)
17
27
  ### Added
18
- - Delay loading of library code until after code coverage tool is loaded
28
+ - RSpec Matchers and Shared Example (@pboling)
19
29
 
20
- ## [1.0.1] - 2022-06-23
30
+ ## [1.0.2] - 2022-06-23 ([tag][1.0.2t])
21
31
  ### Added
22
- - CI Build improvements
23
- - Code coverage reporting
24
- - Documentation improvements
25
- - Badges!
32
+ - Delay loading of library code until after code coverage tool is loaded (@pboling)
26
33
 
27
- ## [1.0.0] - 2022-06-21
34
+ ## [1.0.1] - 2022-06-23 ([tag][1.0.1t])
28
35
  ### Added
29
- - Initial release, with basic version parsing API
36
+ - CI Build improvements (@pboling)
37
+ - Code coverage reporting (@pboling)
38
+ - Documentation improvements (@pboling)
39
+ - Badges! (@pboling)
30
40
 
31
- [Unreleased]: https://github.com/pboling/version_gem/compare/v1.0.2...HEAD
32
- [1.0.2]: https://github.com/pboling/version_gem/compare/v1.0.1...v1.0.2
33
- [1.0.1]: https://github.com/pboling/version_gem/compare/v1.0.0...v1.0.1
34
- [1.0.0]: https://github.com/pboling/version_gem/compare/a3055964517c159bf214712940982034b75264be...v1.0.0
41
+ ## [1.0.0] - 2022-06-21 ([tag][1.0.0t])
42
+ ### Added
43
+ - Initial release, with basic version parsing API (@pboling)
44
+
45
+ [Unreleased]: https://gitlab.com/oauth-xx/version_gem/-/compare/v1.1.1...HEAD
46
+ [1.1.1]: https://gitlab.com/oauth-xx/version_gem/-/compare/v1.1.0...v1.1.1
47
+ [1.1.1t]: https://gitlab.com/oauth-xx/oauth2/-/tags/v1.1.1
48
+ [1.1.0]: https://gitlab.com/oauth-xx/version_gem/-/compare/v1.0.2...v1.1.0
49
+ [1.1.0t]: https://gitlab.com/oauth-xx/oauth2/-/tags/v1.1.0
50
+ [1.0.2]: https://gitlab.com/oauth-xx/version_gem/-/compare/v1.0.1...v1.0.2
51
+ [1.0.2t]: https://gitlab.com/oauth-xx/oauth2/-/tags/v1.0.2
52
+ [1.0.1]: https://gitlab.com/oauth-xx/version_gem/-/compare/v1.0.0...v1.0.1
53
+ [1.0.1t]: https://gitlab.com/oauth-xx/oauth2/-/tags/v1.0.1
54
+ [1.0.0]: https://gitlab.com/oauth-xx/version_gem/-/compare/a3055964517c159bf214712940982034b75264be...v1.0.0
55
+ [1.0.0t]: https://gitlab.com/oauth-xx/oauth2/-/tags/v1.0.0
data/README.md CHANGED
@@ -1,6 +1,21 @@
1
1
  # VersionGem
2
2
 
3
- Give your next library an introspectable `Version` module.
3
+ ## Alternatives
4
+
5
+ This gem has a very niche purpose, which is:
6
+
7
+ 1. providing introspection of a `Version` module based on a `Version::VERSION` constant string,
8
+ 2. while not interfering with `gemspec` parsing where the `VERSION` string is traditionally used.
9
+
10
+ If this isn't **precisely** your use case you may be better off looking at
11
+ [`Versionaire`](https://www.alchemists.io/projects/versionaire), a wonderful, performant, well-maintained,
12
+ gem from the Alchemists.
13
+
14
+ For more discussion about this [see issue #2](https://github.com/pboling/version_gem/issues/2)
15
+
16
+ ## Still here?
17
+
18
+ Give your next library an introspectable `Version` module without breaking your Gemspec.
4
19
 
5
20
  ```ruby
6
21
  MyLib::Version.to_s # => "1.2.3.rc3"
@@ -40,7 +55,7 @@ badge #s:
40
55
  📗
41
56
 
42
57
  appended indicators:
43
- ♻️ - URL needs to be updated from SASS integration. Find / Replace is insufficient.
58
+ ♻️ - URL needs to be updated from SAAS integration. Find / Replace is insufficient.
44
59
  -->
45
60
 
46
61
  | | Project | bundle add version_gem |
@@ -86,8 +101,8 @@ The link tokens in the following sections should be kept ordered by the row and
86
101
  [⛳cclim-maint-img♻️]: https://api.codeclimate.com/v1/badges/b504d61c4ed1d46aec02/maintainability
87
102
  [🖇triage-help]: https://www.codetriage.com/pboling/version_gem
88
103
  [🖇triage-help-img]: https://www.codetriage.com/pboling/version_gem/badges/users.svg
89
- [🏘depfu♻️]: https://depfu.com/github/pboling/version_gem?project_id=34924
90
- [🏘depfu-img♻️]: https://badges.depfu.com/badges/300630ab4b7c2efea20806d13d1ef41f/count.svg
104
+ [🏘depfu♻️]: https://depfu.com/github/pboling/version_gem?project_id=35803
105
+ [🏘depfu-img♻️]: https://badges.depfu.com/badges/5d8943de6cfdf1ee048ad6d907f3e35b/count.svg
91
106
  [🚎contributors]: https://github.com/pboling/version_gem/graphs/contributors
92
107
  [🚎contributors-img]: https://img.shields.io/github/contributors-anon/pboling/version_gem
93
108
  [🖐style-wf]: https://github.com/pboling/version_gem/actions/workflows/style.yml
@@ -219,6 +234,37 @@ This design keeps your `version.rb` file compatible with the way `gemspec` files
219
234
  This means that the introspection is _not_ available within the gemspec.
220
235
  The enhancement from this gem is only available at runtime.
221
236
 
237
+ ### RSpec Matchers
238
+
239
+ In `spec_helper.rb`:
240
+ ```ruby
241
+ require 'version_gem/rspec'
242
+ ```
243
+
244
+ Then you can write a test like:
245
+
246
+ ```ruby
247
+ RSpec.describe MyLib::Version do
248
+ it_behaves_like 'a Version module', described_class
249
+ end
250
+
251
+ # Or, if you want to write your own, here is the a la carte menu:
252
+ RSpec.describe MyLib::Version do
253
+ it "is a Version module" do
254
+ expect(described_class).is_a?(Module)
255
+ expect(described_class).to have_version_constant
256
+ expect(described_class).to have_version_as_string
257
+ expect(described_class.to_s).to be_a(String)
258
+ expect(described_class).to have_major_as_integer
259
+ expect(described_class).to have_minor_as_integer
260
+ expect(described_class).to have_patch_as_integer
261
+ expect(described_class).to have_pre_as_nil_or_string
262
+ expect(described_class.to_h.keys).to match_array(%i[major minor patch pre])
263
+ expect(described_class.to_a).to be_a(Array)
264
+ end
265
+ end
266
+ ```
267
+
222
268
  ## Development
223
269
 
224
270
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -227,8 +273,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
227
273
 
228
274
  ## Contributing
229
275
 
230
- ## Contributing
231
-
232
276
  See [CONTRIBUTING.md][contributing]
233
277
 
234
278
  ## Contributors
@@ -262,7 +306,7 @@ the [Pessimistic Version Constraint][pvc] with two digits of precision.
262
306
  For example:
263
307
 
264
308
  ```ruby
265
- spec.add_dependency "version_gem", "~> 1.0"
309
+ spec.add_dependency "version_gem", "~> 1.1"
266
310
  ```
267
311
 
268
312
  ## Security
@@ -287,10 +331,6 @@ See [SECURITY.md](https://github.com/pboling/version_gem/blob/main/SECURITY.md).
287
331
 
288
332
  [pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
289
333
 
290
- [railsbling]: http://www.railsbling.com
291
-
292
- [peterboling]: http://www.peterboling.com
293
-
294
334
  [aboutme]: https://about.me/peter.boling
295
335
 
296
336
  [angelme]: https://angel.co/peter-boling
data/SECURITY.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  ## Supported Versions
4
4
 
5
- | Version | Supported |
6
- |--------------|-----------|
7
- | 1.0.<latest> | ✅ |
5
+ | Version | Supported |
6
+ |----------|-----------|
7
+ | 1.latest | ✅ |
8
8
 
9
9
  ## Reporting a Vulnerability
10
10
 
@@ -11,35 +11,35 @@ module VersionGem
11
11
  #
12
12
  # @return [Integer]
13
13
  def major
14
- to_a[0].to_i
14
+ @major ||= _to_a[0].to_i
15
15
  end
16
16
 
17
17
  # The minor version
18
18
  #
19
19
  # @return [Integer]
20
20
  def minor
21
- to_a[1].to_i
21
+ @minor ||= _to_a[1].to_i
22
22
  end
23
23
 
24
24
  # The patch version
25
25
  #
26
26
  # @return [Integer]
27
27
  def patch
28
- to_a[2].to_i
28
+ @patch ||= _to_a[2].to_i
29
29
  end
30
30
 
31
31
  # The pre-release version, if any
32
32
  #
33
33
  # @return [String, NilClass]
34
34
  def pre
35
- to_a[3]
35
+ @pre ||= _to_a[3]
36
36
  end
37
37
 
38
38
  # The version number as a hash
39
39
  #
40
40
  # @return [Hash]
41
41
  def to_h
42
- {
42
+ @to_h ||= {
43
43
  major: major,
44
44
  minor: minor,
45
45
  patch: patch,
@@ -47,11 +47,20 @@ module VersionGem
47
47
  }
48
48
  end
49
49
 
50
- # The version number as an array
50
+ # The version number as an array of cast values
51
51
  #
52
- # @return [Array]
52
+ # @return [Array<[Integer, String, NilClass]>]
53
53
  def to_a
54
- self::VERSION.split('.')
54
+ @to_a ||= [major, minor, patch, pre]
55
+ end
56
+
57
+ private
58
+
59
+ # The version number as an array of strings
60
+ #
61
+ # @return [Array<String>]
62
+ def _to_a
63
+ @_to_a = self::VERSION.split('.')
55
64
  end
56
65
  end
57
66
  end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec::Matchers.define :have_version_constant do
4
+ match do |version_mod|
5
+ version_mod.const_defined?(:VERSION, false)
6
+ end
7
+ end
8
+
9
+ RSpec::Matchers.define :have_version_as_string do
10
+ match do |version_mod|
11
+ !version_mod::VERSION.nil? && version_mod::VERSION.is_a?(String)
12
+ end
13
+ end
14
+
15
+ RSpec::Matchers.define :have_major_as_integer do
16
+ match do |version_mod|
17
+ version_mod.major.is_a?(Integer)
18
+ end
19
+ end
20
+
21
+ RSpec::Matchers.define :have_minor_as_integer do
22
+ match do |version_mod|
23
+ version_mod.minor.is_a?(Integer)
24
+ end
25
+ end
26
+
27
+ RSpec::Matchers.define :have_patch_as_integer do
28
+ match do |version_mod|
29
+ version_mod.patch.is_a?(Integer)
30
+ end
31
+ end
32
+
33
+ RSpec::Matchers.define :have_pre_as_nil_or_string do
34
+ match do |version_mod|
35
+ version_mod.pre.nil? || version_mod.pre.is_a?(String)
36
+ end
37
+ end
38
+
39
+ RSpec.shared_examples_for 'a Version module' do |version_mod|
40
+ it 'is introspectable' do
41
+ aggregate_failures 'introspectable api' do
42
+ expect(version_mod).is_a?(Module)
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
+ end
53
+ end
54
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module VersionGem
4
4
  module Version
5
- VERSION = '1.0.2'.freeze
5
+ VERSION = '1.1.1'.freeze
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.
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,14 +1,42 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: version_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
8
- autorequire:
9
- bindir: exe
10
- cert_chain: []
11
- date: 2022-06-23 00:00:00.000000000 Z
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEgDCCAuigAwIBAgIBATANBgkqhkiG9w0BAQsFADBDMRUwEwYDVQQDDAxwZXRl
14
+ ci5ib2xpbmcxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkW
15
+ A2NvbTAeFw0yMjA5MTgyMzEyMzBaFw0yMzA5MTgyMzEyMzBaMEMxFTATBgNVBAMM
16
+ DHBldGVyLmJvbGluZzEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPy
17
+ LGQBGRYDY29tMIIBojANBgkq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q
33
+ LHtXfIpAU8F7ES04syZSslxOluw7VlcSKyRdVIr737J92ZTduppB4PRGSKRgBsWV
34
+ hXTahRE72Kyw53Q7FAuzF3v102WxAAQ7BuMjW+MyCUT75fwPm3W4ELPL8HYkNGE7
35
+ 2oA5CPghFitRnvYS3GNrDG+9bNiRMEskeaBYwZ9UgReBQIwGYVj7LZk3UhiAsn44
36
+ gwGrEXGQGDZ0NIgBcmvMOqlXjkGQwQvugKycJ024z89+fz2332vdZIKTrSxJrXGk
37
+ 4/bR9A==
38
+ -----END CERTIFICATE-----
39
+ date: 2022-09-19 00:00:00.000000000 Z
12
40
  dependencies:
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: rspec
@@ -103,6 +131,7 @@ dependencies:
103
131
  description: Versions are good. Versions are cool. Versions will win.
104
132
  email:
105
133
  - peter.boling@gmail.com
134
+ - oauth-ruby@googlegroups.com
106
135
  executables: []
107
136
  extensions: []
108
137
  extra_rdoc_files: []
@@ -117,20 +146,22 @@ files:
117
146
  - lib/version_gem/api.rb
118
147
  - lib/version_gem/basic.rb
119
148
  - lib/version_gem/error.rb
149
+ - lib/version_gem/rspec.rb
120
150
  - lib/version_gem/version.rb
121
- - sig/version_gem.rbs
122
- homepage: https://github.com/pboling/version_gem
151
+ homepage: https://gitlab.com/oauth-xx/version_gem
123
152
  licenses:
124
153
  - MIT
125
154
  metadata:
126
- homepage_uri: https://github.com/pboling/version_gem
127
- source_code_uri: https://github.com/pboling/version_gem/tree/v1.0.2
128
- changelog_uri: https://github.com/pboling/version_gem/blob/v1.0.2/CHANGELOG.md
129
- bug_tracker_uri: https://github.com/pboling/version_gem/issues
130
- documentation_uri: https://www.rubydoc.info/gems/version_gem/1.0.2
131
- wiki_uri: https://github.com/pboling/version_gem/wiki
155
+ homepage_uri: https://gitlab.com/oauth-xx/version_gem
156
+ source_code_uri: https://gitlab.com/oauth-xx/version_gem/-/tree/v1.1.1
157
+ changelog_uri: https://gitlab.com/oauth-xx/version_gem/-/blob/v1.1.1/CHANGELOG.md
158
+ bug_tracker_uri: https://gitlab.com/oauth-xx/version_gem/-/issues
159
+ documentation_uri: https://www.rubydoc.info/gems/version_gem/1.1.1
160
+ wiki_uri: https://gitlab.com/oauth-xx/version_gem/-/wiki
161
+ mailing_list_uri: https://groups.google.com/g/oauth-ruby
162
+ funding_uri: https://liberapay.com/pboling
132
163
  rubygems_mfa_required: 'true'
133
- post_install_message:
164
+ post_install_message:
134
165
  rdoc_options: []
135
166
  require_paths:
136
167
  - lib
@@ -145,8 +176,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
176
  - !ruby/object:Gem::Version
146
177
  version: '0'
147
178
  requirements: []
148
- rubygems_version: 3.3.16
149
- signing_key:
179
+ rubygems_version: 3.3.20
180
+ signing_key:
150
181
  specification_version: 4
151
182
  summary: Enhance your VERSION! Sugar for Version modules.
152
183
  test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1 @@
1
+ $M�B��|G*��屽EM�.|.�X�0�m�,��{�s�p � ��Œ��d��J��XM)}-�P�� �q;�64��;z���%\�"�x��P�±�d6� I����X5�N�]-���.B�$�F���f*}���S8#�w��\3ũ4�A$���T�WM�>��:Q(�t�]�A�E��P�F�&oX���4�t{�sG�
data/sig/version_gem.rbs DELETED
@@ -1,4 +0,0 @@
1
- module VersionGem
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
- end