stone_checksums 1.0.3 → 1.0.4

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.
data/SECURITY.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  | Version | Supported |
6
6
  |----------|-----------|
7
- | 1.latest | ✅ |
7
+ | 1.0.latest | ✅ |
8
8
 
9
9
  ## Security contact information
10
10
 
data/certs/pboling.pem ADDED
@@ -0,0 +1,27 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIEgDCCAuigAwIBAgIBATANBgkqhkiG9w0BAQsFADBDMRUwEwYDVQQDDAxwZXRl
3
+ ci5ib2xpbmcxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkW
4
+ A2NvbTAeFw0yNTA1MDQxNTMzMDlaFw00NTA0MjkxNTMzMDlaMEMxFTATBgNVBAMM
5
+ DHBldGVyLmJvbGluZzEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPy
6
+ LGQBGRYDY29tMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAruUoo0WA
7
+ uoNuq6puKWYeRYiZekz/nsDeK5x/0IEirzcCEvaHr3Bmz7rjo1I6On3gGKmiZs61
8
+ LRmQ3oxy77ydmkGTXBjruJB+pQEn7UfLSgQ0xa1/X3kdBZt6RmabFlBxnHkoaGY5
9
+ mZuZ5+Z7walmv6sFD9ajhzj+oIgwWfnEHkXYTR8I6VLN7MRRKGMPoZ/yvOmxb2DN
10
+ coEEHWKO9CvgYpW7asIihl/9GMpKiRkcYPm9dGQzZc6uTwom1COfW0+ZOFrDVBuV
11
+ FMQRPswZcY4Wlq0uEBLPU7hxnCL9nKK6Y9IhdDcz1mY6HZ91WImNslOSI0S8hRpj
12
+ yGOWxQIhBT3fqCBlRIqFQBudrnD9jSNpSGsFvbEijd5ns7Z9ZMehXkXDycpGAUj1
13
+ to/5cuTWWw1JqUWrKJYoifnVhtE1o1DZ+LkPtWxHtz5kjDG/zR3MG0Ula0UOavlD
14
+ qbnbcXPBnwXtTFeZ3C+yrWpE4pGnl3yGkZj9SMTlo9qnTMiPmuWKQDatAgMBAAGj
15
+ fzB9MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQE8uWvNbPVNRXZ
16
+ HlgPbc2PCzC4bjAhBgNVHREEGjAYgRZwZXRlci5ib2xpbmdAZ21haWwuY29tMCEG
17
+ A1UdEgQaMBiBFnBldGVyLmJvbGluZ0BnbWFpbC5jb20wDQYJKoZIhvcNAQELBQAD
18
+ ggGBAJbnUwfJQFPkBgH9cL7hoBfRtmWiCvdqdjeTmi04u8zVNCUox0A4gT982DE9
19
+ wmuN12LpdajxZONqbXuzZvc+nb0StFwmFYZG6iDwaf4BPywm2e/Vmq0YG45vZXGR
20
+ L8yMDSK1cQXjmA+ZBKOHKWavxP6Vp7lWvjAhz8RFwqF9GuNIdhv9NpnCAWcMZtpm
21
+ GUPyIWw/Cw/2wZp74QzZj6Npx+LdXoLTF1HMSJXZ7/pkxLCsB8m4EFVdb/IrW/0k
22
+ kNSfjtAfBHO8nLGuqQZVH9IBD1i9K6aSs7pT6TW8itXUIlkIUI2tg5YzW6OFfPzq
23
+ QekSkX3lZfY+HTSp/o+YvKkqWLUV7PQ7xh1ZYDtocpaHwgxe/j3bBqHE+CUPH2vA
24
+ 0V/FwdTRWcwsjVoOJTrYcff8pBZ8r2MvtAc54xfnnhGFzeRHfcltobgFxkAXdE6p
25
+ DVjBtqT23eugOqQ73umLcYDZkc36vnqGxUBSsXrzY9pzV5gGr2I8YUxMqf6ATrZt
26
+ L9nRqA==
27
+ -----END CERTIFICATE-----
data/lib/gem_checksums.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  # Std lib
4
4
  require "digest/sha2"
5
5
  require "fileutils"
6
+ require "rubygems/package"
6
7
 
7
8
  # external gems
8
9
  require "version_gem"
@@ -93,7 +94,7 @@ In bash shell:
93
94
  # Header: identify the gem and version being run
94
95
  begin
95
96
  puts "[ stone_checksums #{::StoneChecksums::Version::VERSION} ]"
96
- rescue StandardError
97
+ rescue
97
98
  # If for any reason the version constant isn't available, skip header gracefully
98
99
  end
99
100
 
@@ -153,12 +154,14 @@ Tip: set GEM_CHECKSUMS_ASSUME_YES=true to proceed non-interactively (still requi
153
154
  # Sort by newest last
154
155
  # [ "my_gem-2.3.9.gem", "my_gem-2.3.11.pre.alpha.4.gem", "my_gem-2.3.15.gem", ... ]
155
156
  gems.sort_by! { |gem| Gem::Version.new(gem[VERSION_REGEX]) }
156
- gem_pkg = gems.last
157
+ gem_pkg = preferred_project_package(gems) || gems.last
157
158
  gem_path_parts = gem_pkg.split("/")
158
159
  gem_name = gem_path_parts.last
159
- puts "Found: #{gems.length} gems; latest is #{gem_name}"
160
+ puts "Found: #{gems.length} gems; selected #{gem_name}"
160
161
  end
161
162
 
163
+ validate_project_package!(gem_pkg)
164
+
162
165
  pkg_bits = File.read(gem_pkg)
163
166
 
164
167
  # SHA-512 digest is 8 64-bit words
@@ -205,7 +208,7 @@ rm -f #{digest256_32bit_path}
205
208
  RESULTS
206
209
 
207
210
  if git_dry_run_flag
208
- %x{#{git_cmd}}
211
+ `#{git_cmd}`
209
212
  else
210
213
  # `exec` will replace the current process with the git process, and exit.
211
214
  # Within the generate method, Ruby code placed after the `exec` *will not be run*:
@@ -216,6 +219,46 @@ rm -f #{digest256_32bit_path}
216
219
  end
217
220
  end
218
221
  module_function :generate
222
+
223
+ def validate_project_package!(gem_pkg)
224
+ project_spec = current_project_spec
225
+ return unless project_spec
226
+ return unless validate_package_against_project?(gem_pkg, project_spec)
227
+
228
+ package_spec = Gem::Package.new(gem_pkg).spec
229
+ return if package_spec.name == project_spec.name && package_spec.version == project_spec.version
230
+
231
+ raise Error, [
232
+ "Built gem version mismatch for #{gem_pkg}.",
233
+ "Current gemspec resolves to #{project_spec.name} #{project_spec.version}, but selected package is #{package_spec.name} #{package_spec.version}.",
234
+ "Remove stale packages or pass the intended .gem path explicitly before generating checksums."
235
+ ].join("\n")
236
+ rescue Gem::Package::Error => error
237
+ raise Error, "Unable to inspect built gem #{gem_pkg}: #{error.message}"
238
+ end
239
+ module_function :validate_project_package!
240
+
241
+ def current_project_spec
242
+ gemspecs = Dir["*.gemspec"]
243
+ return unless gemspecs.length == 1
244
+
245
+ Gem::Specification.load(gemspecs.first)
246
+ end
247
+ module_function :current_project_spec
248
+
249
+ def preferred_project_package(gems)
250
+ project_spec = current_project_spec
251
+ return unless project_spec
252
+
253
+ expected_name = "#{project_spec.name}-#{project_spec.version}.gem"
254
+ gems.find { |gem| File.basename(gem) == expected_name }
255
+ end
256
+ module_function :preferred_project_package
257
+
258
+ def validate_package_against_project?(gem_pkg, project_spec)
259
+ File.basename(File.expand_path(PACKAGE_DIR)) == "pkg" || File.basename(gem_pkg).start_with?("#{project_spec.name}-")
260
+ end
261
+ module_function :validate_package_against_project?
219
262
  end
220
263
 
221
264
  GemChecksums::Version.class_eval do
@@ -1,11 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Semantic version for the StoneChecksums gem
4
3
  module StoneChecksums
5
- # Version-related constants for StoneChecksums
6
4
  module Version
7
- # Current gem version
8
- # @return [String]
9
- VERSION = "1.0.3"
5
+ VERSION = "1.0.4"
10
6
  end
7
+ VERSION = Version::VERSION # Traditional Constant Location
11
8
  end
@@ -7,6 +7,8 @@
7
7
  #
8
8
  # RubyGems does not allow publishing a gem named `gem_checksums`,
9
9
  # hence the updated namespace and gem name.
10
+ require "version_gem"
11
+
10
12
  require_relative "gem_checksums"
11
13
 
12
14
  # This library's version
@@ -0,0 +1,6 @@
1
+ module StoneChecksums
2
+ module Version
3
+ VERSION: String
4
+ end
5
+ VERSION: String
6
+ end
@@ -1,11 +1,8 @@
1
1
  module StoneChecksums
2
- VERSION: String
3
-
4
2
  class Error < ::GemChecksums::Error
5
3
  end
6
4
 
7
5
  module Version
8
- VERSION: String
9
6
  end
10
7
 
11
8
  def self.install_tasks: () -> void
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stone_checksums
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
- - Peter H. Boling
7
+ - "|7eter l-|. l3oling"
8
8
  bindir: exe
9
9
  cert_chain:
10
10
  - |
@@ -46,7 +46,7 @@ dependencies:
46
46
  version: '1.1'
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 1.1.9
49
+ version: 1.1.13
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
@@ -56,35 +56,41 @@ dependencies:
56
56
  version: '1.1'
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 1.1.9
59
+ version: 1.1.13
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: kettle-dev
62
62
  requirement: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '1.1'
66
+ version: '2.2'
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 2.2.15
67
70
  type: :development
68
71
  prerelease: false
69
72
  version_requirements: !ruby/object:Gem::Requirement
70
73
  requirements:
71
74
  - - "~>"
72
75
  - !ruby/object:Gem::Version
73
- version: '1.1'
76
+ version: '2.2'
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: 2.2.15
74
80
  - !ruby/object:Gem::Dependency
75
81
  name: bundler-audit
76
82
  requirement: !ruby/object:Gem::Requirement
77
83
  requirements:
78
84
  - - "~>"
79
85
  - !ruby/object:Gem::Version
80
- version: 0.9.2
86
+ version: 0.9.3
81
87
  type: :development
82
88
  prerelease: false
83
89
  version_requirements: !ruby/object:Gem::Requirement
84
90
  requirements:
85
91
  - - "~>"
86
92
  - !ruby/object:Gem::Version
87
- version: 0.9.2
93
+ version: 0.9.3
88
94
  - !ruby/object:Gem::Dependency
89
95
  name: rake
90
96
  requirement: !ruby/object:Gem::Requirement
@@ -125,34 +131,60 @@ dependencies:
125
131
  requirements:
126
132
  - - "~>"
127
133
  - !ruby/object:Gem::Version
128
- version: '3.0'
134
+ version: '3.1'
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: 3.1.3
129
138
  type: :development
130
139
  prerelease: false
131
140
  version_requirements: !ruby/object:Gem::Requirement
132
141
  requirements:
133
142
  - - "~>"
134
143
  - !ruby/object:Gem::Version
135
- version: '3.0'
144
+ version: '3.1'
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: 3.1.3
136
148
  - !ruby/object:Gem::Dependency
137
149
  name: kettle-test
138
150
  requirement: !ruby/object:Gem::Requirement
139
151
  requirements:
140
152
  - - "~>"
141
153
  - !ruby/object:Gem::Version
142
- version: '1.0'
154
+ version: '2.0'
143
155
  - - ">="
144
156
  - !ruby/object:Gem::Version
145
- version: 1.0.6
157
+ version: 2.0.6
146
158
  type: :development
147
159
  prerelease: false
148
160
  version_requirements: !ruby/object:Gem::Requirement
149
161
  requirements:
150
162
  - - "~>"
151
163
  - !ruby/object:Gem::Version
152
- version: '1.0'
164
+ version: '2.0'
153
165
  - - ">="
154
166
  - !ruby/object:Gem::Version
155
- version: 1.0.6
167
+ version: 2.0.6
168
+ - !ruby/object:Gem::Dependency
169
+ name: turbo_tests2
170
+ requirement: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - "~>"
173
+ - !ruby/object:Gem::Version
174
+ version: '3.1'
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: 3.1.5
178
+ type: :development
179
+ prerelease: false
180
+ version_requirements: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - "~>"
183
+ - !ruby/object:Gem::Version
184
+ version: '3.1'
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: 3.1.5
156
188
  - !ruby/object:Gem::Dependency
157
189
  name: ruby-progressbar
158
190
  requirement: !ruby/object:Gem::Requirement
@@ -173,20 +205,20 @@ dependencies:
173
205
  requirements:
174
206
  - - "~>"
175
207
  - !ruby/object:Gem::Version
176
- version: '1.0'
208
+ version: '2.0'
177
209
  - - ">="
178
210
  - !ruby/object:Gem::Version
179
- version: 1.0.3
211
+ version: 2.0.3
180
212
  type: :development
181
213
  prerelease: false
182
214
  version_requirements: !ruby/object:Gem::Requirement
183
215
  requirements:
184
216
  - - "~>"
185
217
  - !ruby/object:Gem::Version
186
- version: '1.0'
218
+ version: '2.0'
187
219
  - - ">="
188
220
  - !ruby/object:Gem::Version
189
- version: 1.0.3
221
+ version: 2.0.3
190
222
  description: "\U0001F5FF Generate both SHA256 & SHA512 checksums into the checksums
191
223
  directory, and git commit them.\n gem install stone_checksums\nThen, use the rake
192
224
  task or the script:\n rake build:generate_checksums\n gem_checksums\nControl options
@@ -203,9 +235,8 @@ extra_rdoc_files:
203
235
  - CODE_OF_CONDUCT.md
204
236
  - CONTRIBUTING.md
205
237
  - FUNDING.md
206
- - LICENSE.txt
238
+ - LICENSE.md
207
239
  - README.md
208
- - REEK
209
240
  - RUBOCOP.md
210
241
  - SECURITY.md
211
242
  files:
@@ -214,11 +245,11 @@ files:
214
245
  - CODE_OF_CONDUCT.md
215
246
  - CONTRIBUTING.md
216
247
  - FUNDING.md
217
- - LICENSE.txt
248
+ - LICENSE.md
218
249
  - README.md
219
- - REEK
220
250
  - RUBOCOP.md
221
251
  - SECURITY.md
252
+ - certs/pboling.pem
222
253
  - exe/gem_checksums
223
254
  - lib/gem_checksums.rb
224
255
  - lib/gem_checksums/rakelib/gem_checksums.rake
@@ -228,15 +259,16 @@ files:
228
259
  - lib/stone_checksums/version.rb
229
260
  - sig/gem_checksums.rbs
230
261
  - sig/stone_checksums.rbs
262
+ - sig/stone_checksums/version.rbs
231
263
  homepage: https://github.com/galtzo-floss/stone_checksums
232
264
  licenses:
233
265
  - MIT
234
266
  metadata:
235
- homepage_uri: https://stone-checksums.galtzo.com/
236
- source_code_uri: https://github.com/galtzo-floss/stone_checksums/tree/v1.0.3
237
- changelog_uri: https://github.com/galtzo-floss/stone_checksums/blob/v1.0.3/CHANGELOG.md
267
+ homepage_uri: https://stone-checksums.galtzo.com
268
+ source_code_uri: https://github.com/galtzo-floss/stone_checksums/tree/v1.0.4
269
+ changelog_uri: https://github.com/galtzo-floss/stone_checksums/blob/v1.0.4/CHANGELOG.md
238
270
  bug_tracker_uri: https://github.com/galtzo-floss/stone_checksums/issues
239
- documentation_uri: https://www.rubydoc.info/gems/stone_checksums/1.0.3
271
+ documentation_uri: https://www.rubydoc.info/gems/stone_checksums/1.0.4
240
272
  funding_uri: https://github.com/sponsors/pboling
241
273
  wiki_uri: https://github.com/galtzo-floss/stone_checksums/wiki
242
274
  news_uri: https://www.railsbling.com/tags/stone_checksums
@@ -266,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
266
298
  - !ruby/object:Gem::Version
267
299
  version: '0'
268
300
  requirements: []
269
- rubygems_version: 3.7.2
301
+ rubygems_version: 4.0.10
270
302
  specification_version: 4
271
303
  summary: "\U0001F5FF Generate both SHA256 & SHA512 checksums of RubyGem libraries"
272
304
  test_files: []
metadata.gz.sig CHANGED
Binary file
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2022 - 2025 Peter Boling
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/REEK DELETED
File without changes