baza.rb 0.14.3 → 0.15.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1acb9dcb930e9c2841c7539677b8b72ffc0fc027298c966461fcb6c695d8c97
4
- data.tar.gz: 98f85b7b8ec04310d464713020a346c70d3373c6ddfb15c380e59524afc6aa49
3
+ metadata.gz: 4723ea9fe01e74c827c3e8e2f5531d22016e4b80a616bcd9da6f0c5c2ead1b97
4
+ data.tar.gz: e0f61fcac606b88c09ff1e38223d2d2e96a85eafca1563e2965327948662cddd
5
5
  SHA512:
6
- metadata.gz: a8ec276866b3ec4b5f33ab0b2c9b45169ebcd3e994f33d28778e23dd0da94cb3f000265cef3b2ad653460c64b4cda670cc6c57b75d08af5630a40f4e1da7b3d8
7
- data.tar.gz: 47b362a5d1da21f98c2477bdb29b28b771f614d1b12e8034660cf96d073fff4a9ba67ffc3089e8d1c45a3d2377980c858a8c6721c25fb37b033d4ae087a593bc
6
+ metadata.gz: 409d6505f045704847bbb85e4bfa1320f3971f16fab512d30bde7dfbbeef27f448d58d6b84f6fdce0211aa58c407b766e3b0a2535a0051e90b8df52dd54270f1
7
+ data.tar.gz: 304605659a8bcc8a03e65d53971fb46cdd407c2a542d8fa4d3c31ca9b8bd46faad39c8d0ff300ce189ee72a29b6ecce633243483fc5880d47aa20a1eaefad271
data/Gemfile CHANGED
@@ -8,7 +8,7 @@ gemspec
8
8
 
9
9
  gem 'activesupport', '~>8.0', require: false
10
10
  gem 'base64', '~>0.3', require: false
11
- gem 'diff-lcs', '1.6.2', require: false # GPL
11
+ gem 'diff-lcs', '1.6.2', require: false
12
12
  gem 'factbase', '~>0.16', require: false
13
13
  gem 'minitest', '~>6.0', require: false
14
14
  gem 'minitest-reporters', '~>1.7', require: false
@@ -17,15 +17,16 @@ gem 'online', '~>0.1', require: false
17
17
  gem 'os', '~>1.1', require: false
18
18
  gem 'pact', '~>1.65', require: false
19
19
  gem 'pact-ffi', '0.4.28.0', require: false
20
- gem 'psych', '5.3.1', require: false # GPL
20
+ gem 'psych', '5.3.1', require: false
21
21
  gem 'puma', '~>7.0', require: false
22
22
  gem 'qbash', '~>0.4', require: false
23
23
  gem 'rack', '~>3.1', require: false
24
24
  gem 'rackup', '~>2.2', require: false
25
25
  gem 'rake', '~>13.2', require: false
26
26
  gem 'random-port', '~>0.7', require: false
27
- gem 'rdoc', '7.1.0', require: false # GPL
27
+ gem 'rdoc', '7.1.0', require: false
28
28
  gem 'rubocop', '~>1.73', require: false
29
+ gem 'rubocop-elegant', '~>0.5', require: false
29
30
  gem 'rubocop-minitest', '~>0.38', require: false
30
31
  gem 'rubocop-performance', '~>1.23', require: false
31
32
  gem 'rubocop-rake', '~>0.7', require: false
@@ -35,4 +36,4 @@ gem 'sinatra', '~>4.1', require: false
35
36
  gem 'wait_for', '~>0.1', require: false
36
37
  gem 'webmock', '~>3.24', require: false
37
38
  gem 'webrick', '~>1.9', require: false
38
- gem 'yard', '0.9.38', require: false # GPL
39
+ gem 'yard', '0.9.44', require: false
data/Gemfile.lock CHANGED
@@ -2,13 +2,10 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  baza.rb (0.0.0)
5
- backtrace (~> 0.4)
5
+ base64 (~> 0.3)
6
6
  elapsed (~> 0.2)
7
- faraday (~> 2.13)
8
- faraday-http-cache (~> 2.5)
9
- faraday-multipart (~> 1.1)
10
- faraday-retry (~> 2.3)
11
7
  iri (~> 0.11)
8
+ logger (~> 1.6)
12
9
  loog (~> 0.6)
13
10
  retries (~> 0.0)
14
11
  tago (~> 0.2)
@@ -17,7 +14,7 @@ PATH
17
14
  GEM
18
15
  remote: https://rubygems.org/
19
16
  specs:
20
- activesupport (8.1.2)
17
+ activesupport (8.1.3)
21
18
  base64
22
19
  bigdecimal
23
20
  concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -30,16 +27,16 @@ GEM
30
27
  securerandom (>= 0.3)
31
28
  tzinfo (~> 2.0, >= 2.0.5)
32
29
  uri (>= 0.13.1)
33
- addressable (2.8.8)
30
+ addressable (2.9.0)
34
31
  public_suffix (>= 2.0.2, < 8.0)
35
- ansi (1.5.0)
32
+ ansi (1.6.0)
36
33
  ast (2.4.3)
37
34
  awesome_print (1.9.2)
38
35
  backtrace (0.4.1)
39
36
  base64 (0.3.0)
40
- bigdecimal (4.0.1)
37
+ bigdecimal (4.1.2)
41
38
  builder (3.3.0)
42
- concurrent-ruby (1.3.6)
39
+ concurrent-ruby (1.3.7)
43
40
  connection_pool (3.0.2)
44
41
  crack (1.0.1)
45
42
  bigdecimal
@@ -53,12 +50,13 @@ GEM
53
50
  loog (~> 0.6)
54
51
  tago (~> 0.1)
55
52
  ellipsized (0.3.0)
56
- erb (6.0.1)
57
- ethon (0.15.0)
53
+ erb (6.0.4)
54
+ ethon (0.18.0)
58
55
  ffi (>= 1.15.0)
56
+ logger
59
57
  expgen (0.1.1)
60
58
  parslet
61
- factbase (0.19.4)
59
+ factbase (0.19.16)
62
60
  backtrace (~> 0.4)
63
61
  decoor (~> 0.1)
64
62
  ellipsized (~> 0.3)
@@ -69,66 +67,50 @@ GEM
69
67
  others (~> 0.1)
70
68
  tago (~> 0.1)
71
69
  yaml (~> 0.3)
72
- faraday (2.14.0)
73
- faraday-net_http (>= 2.0, < 3.5)
74
- json
75
- logger
76
- faraday-http-cache (2.6.1)
77
- faraday (>= 0.8)
78
- faraday-multipart (1.2.0)
79
- multipart-post (~> 2.0)
80
- faraday-net_http (3.4.2)
81
- net-http (~> 0.5)
82
- faraday-retry (2.4.0)
83
- faraday (~> 2.0)
84
- ffi (1.17.3-arm64-darwin)
85
- ffi (1.17.3-x86_64-darwin)
86
- ffi (1.17.3-x86_64-linux-gnu)
87
- ffi (1.17.3-x86_64-linux-musl)
70
+ ffi (1.17.4-arm64-darwin)
71
+ ffi (1.17.4-x86_64-darwin)
72
+ ffi (1.17.4-x86_64-linux-gnu)
73
+ ffi (1.17.4-x86_64-linux-musl)
88
74
  find_a_port (1.0.1)
89
75
  hashdiff (1.2.1)
90
- i18n (1.14.8)
76
+ i18n (1.15.2)
91
77
  concurrent-ruby (~> 1.0)
92
78
  iri (0.11.8)
93
- json (2.18.1)
79
+ json (2.21.1)
94
80
  jsonpath (1.1.5)
95
81
  multi_json
96
- language_server-protocol (3.17.0.5)
82
+ language_server-protocol (3.17.0.6)
97
83
  lint_roller (1.1.0)
98
84
  logger (1.7.0)
99
- loog (0.7.2)
85
+ loog (0.8.0)
100
86
  ellipsized
101
87
  logger (~> 1.0)
102
- minitest (6.0.1)
88
+ minitest (6.0.6)
89
+ drb (~> 2.0)
103
90
  prism (~> 1.5)
104
- minitest-reporters (1.7.1)
91
+ minitest-reporters (1.8.0)
105
92
  ansi
106
93
  builder
107
- minitest (>= 5.0)
94
+ minitest (>= 5.0, < 7)
108
95
  ruby-progressbar
109
- multi_json (1.19.1)
110
- multipart-post (2.4.1)
111
- mustermann (3.0.4)
112
- ruby2_keywords (~> 0.0.1)
113
- net-http (0.9.1)
114
- uri (>= 0.11.1)
96
+ multi_json (1.21.1)
97
+ mustermann (3.1.1)
115
98
  nio4r (2.7.5)
116
- nokogiri (1.19.0-arm64-darwin)
99
+ nokogiri (1.19.4-arm64-darwin)
117
100
  racc (~> 1.4)
118
- nokogiri (1.19.0-x86_64-darwin)
101
+ nokogiri (1.19.4-x86_64-darwin)
119
102
  racc (~> 1.4)
120
- nokogiri (1.19.0-x86_64-linux-gnu)
103
+ nokogiri (1.19.4-x86_64-linux-gnu)
121
104
  racc (~> 1.4)
122
- nokogiri (1.19.0-x86_64-linux-musl)
105
+ nokogiri (1.19.4-x86_64-linux-musl)
123
106
  racc (~> 1.4)
124
107
  online (0.3.0)
125
108
  openssl (>= 3)
126
109
  timeout (~> 0.4)
127
- openssl (4.0.0)
110
+ openssl (4.0.2)
128
111
  os (1.1.4)
129
112
  others (0.1.1)
130
- pact (1.67.3)
131
- jsonpath (~> 1.0)
113
+ pact (1.67.5)
132
114
  pact-mock_service (~> 3.0, >= 3.3.1)
133
115
  pact-support (~> 1.21, >= 1.21.2)
134
116
  rack
@@ -136,7 +118,6 @@ GEM
136
118
  rack-test (>= 0.6.3, < 3.0.0)
137
119
  rainbow (~> 3.1)
138
120
  rspec (~> 3.0)
139
- string_pattern (~> 2.0)
140
121
  thor (>= 0.20, < 2.0)
141
122
  webrick (~> 1.8)
142
123
  zeitwerk (~> 2.3)
@@ -165,8 +146,8 @@ GEM
165
146
  jsonpath (~> 1.0)
166
147
  rainbow (~> 3.1.1)
167
148
  string_pattern (~> 2.0)
168
- parallel (1.27.0)
169
- parser (3.3.10.1)
149
+ parallel (2.1.0)
150
+ parser (3.3.11.1)
170
151
  ast (~> 2.4.1)
171
152
  racc
172
153
  parslet (2.0.0)
@@ -174,23 +155,23 @@ GEM
174
155
  psych (5.3.1)
175
156
  date
176
157
  stringio
177
- public_suffix (7.0.2)
178
- puma (7.2.0)
158
+ public_suffix (7.0.5)
159
+ puma (7.2.1)
179
160
  nio4r (~> 2.0)
180
- qbash (0.7.2)
161
+ qbash (0.8.4)
181
162
  backtrace (> 0)
182
163
  elapsed (> 0)
183
164
  loog (> 0)
184
165
  tago (> 0)
185
166
  racc (1.8.1)
186
- rack (3.2.4)
167
+ rack (3.2.6)
187
168
  rack-protection (4.2.1)
188
169
  base64 (>= 0.1.0)
189
170
  logger (>= 1.6.0)
190
171
  rack (>= 3.0.0, < 4)
191
- rack-proxy (0.7.7)
172
+ rack-proxy (0.8.3)
192
173
  rack
193
- rack-session (2.1.1)
174
+ rack-session (2.1.2)
194
175
  base64 (>= 0.1.0)
195
176
  rack (>= 3.0.0)
196
177
  rack-test (2.2.0)
@@ -198,14 +179,14 @@ GEM
198
179
  rackup (2.3.1)
199
180
  rack (>= 3)
200
181
  rainbow (3.1.1)
201
- rake (13.3.1)
202
- random-port (0.7.6)
182
+ rake (13.4.2)
183
+ random-port (0.8.2)
203
184
  tago (~> 0.0)
204
185
  rdoc (7.1.0)
205
186
  erb
206
187
  psych (>= 4.0.0)
207
188
  tsort
208
- regexp_parser (2.11.3)
189
+ regexp_parser (2.12.0)
209
190
  retries (0.0.5)
210
191
  rexml (3.4.4)
211
192
  rspec (3.13.2)
@@ -217,25 +198,28 @@ GEM
217
198
  rspec-expectations (3.13.5)
218
199
  diff-lcs (>= 1.2.0, < 2.0)
219
200
  rspec-support (~> 3.13.0)
220
- rspec-mocks (3.13.7)
201
+ rspec-mocks (3.13.8)
221
202
  diff-lcs (>= 1.2.0, < 2.0)
222
203
  rspec-support (~> 3.13.0)
223
204
  rspec-support (3.13.7)
224
- rubocop (1.84.1)
205
+ rubocop (1.88.2)
225
206
  json (~> 2.3)
226
207
  language_server-protocol (~> 3.17.0.2)
227
208
  lint_roller (~> 1.1.0)
228
- parallel (~> 1.10)
209
+ parallel (>= 1.10)
229
210
  parser (>= 3.3.0.2)
230
211
  rainbow (>= 2.2.2, < 4.0)
231
212
  regexp_parser (>= 2.9.3, < 3.0)
232
213
  rubocop-ast (>= 1.49.0, < 2.0)
233
214
  ruby-progressbar (~> 1.7)
234
215
  unicode-display_width (>= 2.4.0, < 4.0)
235
- rubocop-ast (1.49.0)
216
+ rubocop-ast (1.50.0)
236
217
  parser (>= 3.3.7.2)
237
218
  prism (~> 1.7)
238
- rubocop-minitest (0.38.2)
219
+ rubocop-elegant (0.7.1)
220
+ lint_roller (~> 1.1)
221
+ rubocop (~> 1.75)
222
+ rubocop-minitest (0.39.1)
239
223
  lint_roller (~> 1.1)
240
224
  rubocop (>= 1.75.0, < 2.0)
241
225
  rubocop-ast (>= 1.38.0, < 2.0)
@@ -247,13 +231,12 @@ GEM
247
231
  lint_roller (~> 1.1)
248
232
  rubocop (>= 1.72.1)
249
233
  ruby-progressbar (1.13.0)
250
- ruby2_keywords (0.0.5)
251
234
  securerandom (0.4.1)
252
235
  simplecov (0.22.0)
253
236
  docile (~> 1.1)
254
237
  simplecov-html (~> 0.11)
255
238
  simplecov_json_formatter (~> 0.1)
256
- simplecov-cobertura (3.1.0)
239
+ simplecov-cobertura (3.2.0)
257
240
  rexml
258
241
  simplecov (~> 0.19)
259
242
  simplecov-html (0.13.2)
@@ -265,16 +248,16 @@ GEM
265
248
  rack-protection (= 4.2.1)
266
249
  rack-session (>= 2.0.0, < 3)
267
250
  tilt (~> 2.0)
268
- string_pattern (2.3.0)
251
+ string_pattern (2.4.0)
269
252
  regexp_parser (~> 2.5, >= 2.5.0)
270
253
  stringio (3.2.0)
271
254
  tago (0.7.0)
272
255
  thor (1.5.0)
273
- tilt (2.7.0)
274
- timeout (0.6.0)
256
+ tilt (2.8.0)
257
+ timeout (0.6.1)
275
258
  tsort (0.2.0)
276
- typhoeus (1.5.0)
277
- ethon (>= 0.9.0, < 0.16.0)
259
+ typhoeus (1.6.0)
260
+ ethon (>= 0.18.0)
278
261
  tzinfo (2.0.6)
279
262
  concurrent-ruby (~> 1.0)
280
263
  unicode-display_width (3.2.0)
@@ -282,14 +265,14 @@ GEM
282
265
  unicode-emoji (4.2.0)
283
266
  uri (1.1.1)
284
267
  wait_for (0.1.1)
285
- webmock (3.26.1)
268
+ webmock (3.26.2)
286
269
  addressable (>= 2.8.0)
287
270
  crack (>= 0.3.2)
288
271
  hashdiff (>= 0.4.0, < 2.0.0)
289
272
  webrick (1.9.2)
290
273
  yaml (0.4.0)
291
- yard (0.9.38)
292
- zeitwerk (2.7.4)
274
+ yard (0.9.44)
275
+ zeitwerk (2.8.2)
293
276
 
294
277
  PLATFORMS
295
278
  arm64-darwin
@@ -319,6 +302,7 @@ DEPENDENCIES
319
302
  random-port (~> 0.7)
320
303
  rdoc (= 7.1.0)
321
304
  rubocop (~> 1.73)
305
+ rubocop-elegant (~> 0.5)
322
306
  rubocop-minitest (~> 0.38)
323
307
  rubocop-performance (~> 1.23)
324
308
  rubocop-rake (~> 0.7)
@@ -328,7 +312,7 @@ DEPENDENCIES
328
312
  wait_for (~> 0.1)
329
313
  webmock (~> 3.24)
330
314
  webrick (~> 1.9)
331
- yard (= 0.9.38)
315
+ yard (= 0.9.44)
332
316
 
333
317
  BUNDLED WITH
334
318
  2.6.8
data/README.md CHANGED
@@ -19,7 +19,7 @@ Read
19
19
  [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
20
20
  Make sure your build is green before you contribute
21
21
  your pull request. You will need to have
22
- [Ruby](https://www.ruby-lang.org/en/) 3.2+ and
22
+ [Ruby](https://www.ruby-lang.org/en/) 3.3+ and
23
23
  [Bundler](https://bundler.io/) installed. Then:
24
24
 
25
25
  ```bash
data/Rakefile CHANGED
@@ -5,9 +5,9 @@
5
5
 
6
6
  require 'os'
7
7
  require 'qbash'
8
- require 'rubygems'
9
8
  require 'rake'
10
9
  require 'rake/clean'
10
+ require 'rubygems'
11
11
  require 'shellwords'
12
12
 
13
13
  def name
@@ -34,10 +34,7 @@ desc 'Run them via Ruby, one by one'
34
34
  task :picks do
35
35
  next if OS.windows?
36
36
  Dir['lib/**/*.rb'].each do |f|
37
- qbash(
38
- "bundle exec ruby #{Shellwords.escape(f)} -- --offline",
39
- stdout: $stdout, env: { 'RACK_ENV' => 'picks' }
40
- )
37
+ qbash("bundle exec ruby #{Shellwords.escape(f)} -- --offline", stdout: $stdout, env: { 'RACK_ENV' => 'picks' })
41
38
  end
42
39
  end
43
40
 
data/baza.rb.gemspec CHANGED
@@ -7,8 +7,8 @@ require 'English'
7
7
  require_relative 'lib/baza-rb/version'
8
8
 
9
9
  Gem::Specification.new do |s|
10
- s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
11
- s.required_ruby_version = '>=3.0'
10
+ s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to?(:required_rubygems_version=)
11
+ s.required_ruby_version = '>=3.3'
12
12
  s.name = 'baza.rb'
13
13
  s.version = BazaRb::VERSION
14
14
  s.license = 'MIT'
@@ -23,16 +23,13 @@ Gem::Specification.new do |s|
23
23
  s.files = `git ls-files | grep -v -E '^(test/|\\.|renovate)'`.split($RS)
24
24
  s.rdoc_options = ['--charset=UTF-8']
25
25
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
26
- s.add_dependency 'backtrace', '~>0.4'
27
- s.add_dependency 'elapsed', '~>0.2'
28
- s.add_dependency 'faraday', '~>2.13'
29
- s.add_dependency 'faraday-http-cache', '~>2.5'
30
- s.add_dependency 'faraday-multipart', '~>1.1'
31
- s.add_dependency 'faraday-retry', '~>2.3'
32
- s.add_dependency 'iri', '~>0.11'
33
- s.add_dependency 'loog', '~>0.6'
34
- s.add_dependency 'retries', '~>0.0'
35
- s.add_dependency 'tago', '~>0.2'
36
- s.add_dependency 'typhoeus', '~>1.4'
26
+ s.add_dependency('base64', '~>0.3')
27
+ s.add_dependency('elapsed', '~>0.2')
28
+ s.add_dependency('iri', '~>0.11')
29
+ s.add_dependency('logger', '~>1.6')
30
+ s.add_dependency('loog', '~>0.6')
31
+ s.add_dependency('retries', '~>0.0')
32
+ s.add_dependency('tago', '~>0.2')
33
+ s.add_dependency('typhoeus', '~>1.4')
37
34
  s.metadata['rubygems_mfa_required'] = 'true'
38
35
  end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ # SPDX-FileCopyrightText: Copyright (c) 2024-2026 Zerocracy
4
+ # SPDX-License-Identifier: MIT
5
+
6
+ require 'stringio'
7
+ require 'zlib'
8
+
9
+ # Compression helpers for BazaRb.
10
+ #
11
+ # Provides gzip compression and decompression for request bodies
12
+ # and response data.
13
+ #
14
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
15
+ # Copyright:: Copyright (c) 2024-2026 Yegor Bugayenko
16
+ # License:: MIT
17
+ class BazaRb
18
+ # Compression helpers.
19
+ module Compress
20
+ LIMIT_UNCOMPRESSED = 10_485_760
21
+
22
+ # Decompress gzipped data.
23
+ #
24
+ # @param [String] data The gzipped data to decompress
25
+ # @return [String] The decompressed data
26
+ # @raise [BadCompression] If the data is not valid gzip
27
+ def unzip(data)
28
+ unzipped = StringIO.new
29
+ Zlib::GzipReader.new(StringIO.new(data)).each(4096) do |chunk|
30
+ unzipped.write(chunk)
31
+ next unless unzipped.length > LIMIT_UNCOMPRESSED
32
+ raise(BadCompression, "Uncompressed size #{unzipped.length} exceeds limit #{LIMIT_UNCOMPRESSED}")
33
+ end
34
+ unzipped.string
35
+ rescue Zlib::GzipFile::Error => e
36
+ raise(BadCompression, "Failed to unzip #{data.bytesize} bytes: #{e.message}")
37
+ end
38
+
39
+ # Compress request parameters with gzip.
40
+ #
41
+ # @param [Hash] params The request parameters with :body and :headers keys
42
+ # @return [Hash] The modified parameters with compressed body and updated headers
43
+ def zipped(params)
44
+ io = StringIO.new
45
+ gz = Zlib::GzipWriter.new(io)
46
+ gz.write(params.fetch(:body))
47
+ gz.close
48
+ body = io.string
49
+ params.merge(
50
+ body:,
51
+ headers: params.fetch(:headers).merge({ 'Content-Encoding' => 'gzip', 'Content-Length' => body.bytesize })
52
+ )
53
+ end
54
+ end
55
+ end