specguard-ruby 0.3.31 → 0.3.32

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: 14818808e8ef3b696b1b3834ea590734fa398f5fabbef1c5646d03699e844d99
4
- data.tar.gz: ccce2e2cf09f6b3401284c0f7f3f343185c86fa2d48bc43ca7bbd9e48575910e
3
+ metadata.gz: 4e2f8dd966880d2075d3989184c5f9df89d702445edcdf88583c0b8976021a46
4
+ data.tar.gz: 4e5d985eda3fb38fc4832412585f6f389a5d9429c915bc9797d02d349576a713
5
5
  SHA512:
6
- metadata.gz: a7612a5d841ecf6d7b1f675bfe362a5141948c1e227a89d7d90e449c9f3b802b650894e7cd3862bb37a897dcbc77ae6e0d627caa1b3cbde3275b54ebd41beb54
7
- data.tar.gz: d78f0bea385d4a9ca63d1581648350c76662f7540b0c105dda6a0ebb15c7b3be1be98e7d2ca8f29b5536fac597a4ed155cb5b96f8ff8575e79bfde7292ff0034
6
+ metadata.gz: dfc1753a08f2e9c713c61ed12ac18b557f5e32fbaa3577735383ac6adea9bf237ff6374baf6fe276e6735c0e2da38344574c2ab6b02de1a8f42fe41c3fc51aa9
7
+ data.tar.gz: eca2722d9dcfa6117c21ee589b2b2afdfa422c9983a49d66ee80974574e33f8163f10c2ccab65345badef6dec01d94ad25b436980d5d87beb81b224c3c2c6d1b
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SpecGuard
4
+ module Client
5
+ # The two clauses that finish a delivery-failure warning line, shared by
6
+ # the RSpec formatter and the Minitest reporter.
7
+ #
8
+ # Both clients print the same sentence after their own prefix and status
9
+ # clause: where the run ended up, and (when it was saved) the command that
10
+ # gets it back. They used to carry two inline copies kept equal
11
+ # "word-for-word" by hand, and the pair had already been co-edited in
12
+ # separate commits (SPGD-1139, SPGD-1413). One definition here means a
13
+ # wording change cannot reach one client and miss the other.
14
+ #
15
+ # What stays in each client: the prefix, the warning budget (`@warned`),
16
+ # and the `append` that decides whether `error` is nil. Those differ by
17
+ # design; only the clause text is shared.
18
+ module DeliveryWarning
19
+ module_function
20
+
21
+ # Report, not promise. Composed after the write so it can tell the
22
+ # operator which of the two things actually happened. `error` is the
23
+ # client's `append` answer: `nil` means the queue took the run (the
24
+ # success arm, {#replay_clause}); anything else means both sinks are
25
+ # gone and the run really is lost (SPGD-1413).
26
+ def sink_clause(path, error)
27
+ return replay_clause(path) if error.nil?
28
+
29
+ "The replay queue #{path} could not be written either " \
30
+ "(#{error.class}: #{error.message}), so this run's telemetry was lost."
31
+ end
32
+
33
+ # The success arm (SPGD-1139): where the run sits AND the command that
34
+ # gets it back, fix-the-delivery first and replay after — the order the
35
+ # ingest CLI's own doctrine describes. The lost-run arm deliberately
36
+ # names no command: with no queue written there is nothing to replay.
37
+ def replay_clause(path)
38
+ "Falling back to #{path}; the test run is unaffected. " \
39
+ "Once the delivery is fixed, replay this run with: bundle exec specguard-ingest #{path}"
40
+ end
41
+ end
42
+ end
43
+ end
@@ -739,8 +739,7 @@ module SpecGuard
739
739
  raise UsageError, "no endpoint is configured (set SPECGUARD_ENDPOINT)" if blank?(configuration.endpoint)
740
740
  raise UsageError, "no API key is configured (set SPECGUARD_API_KEY)" if blank?(configuration.api_key)
741
741
 
742
- transport = Transport.new(endpoint: configuration.endpoint, api_key: configuration.api_key,
743
- timeout: configuration.timeout, repository_id: configuration.repository_id)
742
+ transport = Transport.from_configuration(configuration)
744
743
  # Asked once, here, so a malformed `SPECGUARD_ENDPOINT` is one exit 2
745
744
  # rather than N identical `:failed` lines. `Transport#deliver` would
746
745
  # otherwise swallow the same `ArgumentError` once per line and report a
@@ -293,6 +293,21 @@ module SpecGuard
293
293
  end
294
294
  end
295
295
 
296
+ # Builds a transport from a {Configuration}, projecting the four settings
297
+ # every ingest writer forwards (endpoint, api_key, timeout, repository_id)
298
+ # so a new keyword is threaded in one place rather than in each writer.
299
+ #
300
+ # @param configuration [Configuration, #endpoint, #api_key, #timeout, #repository_id]
301
+ # @return [Transport]
302
+ def self.from_configuration(configuration)
303
+ new(
304
+ endpoint: configuration.endpoint,
305
+ api_key: configuration.api_key,
306
+ timeout: configuration.timeout,
307
+ repository_id: configuration.repository_id
308
+ )
309
+ end
310
+
296
311
  # @param endpoint [String, nil] the installation's base URL. Any trailing
297
312
  # slashes are dropped; a path prefix is preserved, so an installation
298
313
  # behind `https://tools.example.com/specguard` works.
@@ -9,6 +9,7 @@ require "fileutils"
9
9
  # loads them on a minitest-only consumer's machine.
10
10
  require_relative "../client"
11
11
  require_relative "../client/configuration"
12
+ require_relative "../client/delivery_warning"
12
13
 
13
14
  # The annotation lookup is the third framework-free half: what counts as a
14
15
  # test's annotation is a property of the source line, not of the framework
@@ -244,12 +245,7 @@ module SpecGuard
244
245
 
245
246
  def transport_for
246
247
  require_relative "../client/transport"
247
- SpecGuard::Client::Transport.new(
248
- endpoint: @configuration.endpoint,
249
- api_key: @configuration.api_key,
250
- timeout: @configuration.timeout,
251
- repository_id: @configuration.repository_id
252
- )
248
+ SpecGuard::Client::Transport.from_configuration(@configuration)
253
249
  end
254
250
 
255
251
  def row_for(result)
@@ -404,21 +400,10 @@ module SpecGuard
404
400
  end
405
401
 
406
402
  # Report, not promise — see `#fall_back` for why that is the whole of
407
- # this slice, and why the order above it did not move.
403
+ # this slice, and why the order above it did not move. The wording is
404
+ # shared with the RSpec formatter in {Client::DeliveryWarning}.
408
405
  def sink_clause(path, error)
409
- return replay_clause(path) if error.nil?
410
-
411
- "The replay queue #{path} could not be written either " \
412
- "(#{error.class}: #{error.message}), so this run's telemetry was lost."
413
- end
414
-
415
- # The success arm (SPGD-1139): names the configured path (the one
416
- # `#append` just wrote) and the replay command, word-for-word the
417
- # formatter's clause. The lost-run arm names no command — nothing to
418
- # replay.
419
- def replay_clause(path)
420
- "Falling back to #{path}; the test run is unaffected. " \
421
- "Once the delivery is fixed, replay this run with: bundle exec specguard-ingest #{path}"
406
+ SpecGuard::Client::DeliveryWarning.sink_clause(path, error)
422
407
  end
423
408
 
424
409
  # Once per process, like the formatter's `warn_once`: fifty failing
@@ -48,6 +48,7 @@ require "fileutils"
48
48
  require_relative "../rspec"
49
49
  require_relative "../client/configuration"
50
50
  require_relative "../client/transport"
51
+ require_relative "../client/delivery_warning"
51
52
  # Brings the linter's discovery chain with it (Scanner, Finding, Schema). That
52
53
  # direction is safe — `specguard/rspec` does not require `rspec/core`, so the
53
54
  # linter stays loadable without RSpec; it is only the reverse that would break
@@ -1037,12 +1038,7 @@ module SpecGuard
1037
1038
  end
1038
1039
 
1039
1040
  def transport_for(configuration)
1040
- SpecGuard::Client::Transport.new(
1041
- endpoint: configuration.endpoint,
1042
- api_key: configuration.api_key,
1043
- timeout: configuration.timeout,
1044
- repository_id: configuration.repository_id
1045
- )
1041
+ SpecGuard::Client::Transport.from_configuration(configuration)
1046
1042
  end
1047
1043
 
1048
1044
  def blank?(value)
@@ -1201,22 +1197,10 @@ module SpecGuard
1201
1197
 
1202
1198
  # Report, not promise. Composed after the write so it can tell the operator
1203
1199
  # which of the two things actually happened — see {#fall_back} for why that
1204
- # is the whole of this slice, and why the order above it did not move.
1200
+ # is the whole of this slice, and why the order above it did not move. The
1201
+ # wording is shared with the Minitest reporter in {Client::DeliveryWarning}.
1205
1202
  def sink_clause(path, error)
1206
- return replay_clause(path) if error.nil?
1207
-
1208
- "The replay queue #{path} could not be written either " \
1209
- "(#{error.class}: #{error.message}), so this run's telemetry was lost."
1210
- end
1211
-
1212
- # The success arm (SPGD-1139): where the run sits AND the command that gets
1213
- # it back, fix-the-delivery first and replay after — the order the ingest
1214
- # CLI's own doctrine describes. The lost-run arm above deliberately names no
1215
- # command: with no queue written there is nothing to replay. Kept
1216
- # word-for-word identical to the Minitest reporter's clause.
1217
- def replay_clause(path)
1218
- "Falling back to #{path}; the test run is unaffected. " \
1219
- "Once the delivery is fixed, replay this run with: bundle exec specguard-ingest #{path}"
1203
+ SpecGuard::Client::DeliveryWarning.sink_clause(path, error)
1220
1204
  end
1221
1205
 
1222
1206
  def emit_warning(line)
@@ -7,5 +7,5 @@
7
7
  # framework-scoped version constant a lie, so the number moved here and the
8
8
  # rspec module now points at it for back-compat.
9
9
  module SpecGuard
10
- VERSION = "0.3.31"
10
+ VERSION = "0.3.32"
11
11
  end
@@ -58,9 +58,9 @@ if git rev-parse -q --verify "refs/tags/v$NEW_VERSION" >/dev/null || \
58
58
  exit 1
59
59
  fi
60
60
  if command -v curl >/dev/null 2>&1; then
61
- if curl -fsS --max-time 10 "https://rubygems.org/api/v1/versions/specguard-rspec.json" 2>/dev/null \
61
+ if curl -fsS --max-time 10 "https://rubygems.org/api/v1/versions/specguard-ruby.json" 2>/dev/null \
62
62
  | grep -q "\"number\":\"$NEW_VERSION\""; then
63
- echo "Error: specguard-rspec $NEW_VERSION is already published on RubyGems"
63
+ echo "Error: specguard-ruby $NEW_VERSION is already published on RubyGems"
64
64
  exit 1
65
65
  fi
66
66
  fi
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specguard-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.31
4
+ version: 0.3.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - specguard Agent
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-04 00:00:00.000000000 Z
11
+ date: 2026-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -52,6 +52,7 @@ files:
52
52
  - lib/specguard/client/annotation_scanner.rb
53
53
  - lib/specguard/client/cli.rb
54
54
  - lib/specguard/client/configuration.rb
55
+ - lib/specguard/client/delivery_warning.rb
55
56
  - lib/specguard/client/file_selector.rb
56
57
  - lib/specguard/client/finding.rb
57
58
  - lib/specguard/client/ingest_cli.rb