stack-service-base 0.0.49 → 0.0.54

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: a6b285b710302e85e938513f51f933cf37adbe1e78279769a28c7fa275edd8fe
4
- data.tar.gz: fe0890eaa584d18df5227bf25de1869209d7e6e3a9812bb496ba3225cd0e7624
3
+ metadata.gz: 5c91577049bc11a0fb3b6f0a5cddbdd945361929eb6e85fdfbc7bf532dadf044
4
+ data.tar.gz: 5cb04550ca88b9f9849e3c0610f315d31045420a8cca30cf739aa645202c4936
5
5
  SHA512:
6
- metadata.gz: 49adbd3f6367dd580671c0d6c1203881cc884b1cc88f070fd7bec2fa940306d793105e3a38ce84d045f20e0e02f50db2934369166fba6660a6dd159f94a5f39c
7
- data.tar.gz: 9d16bb2ff085a5de781a4d2a1efc07213c8ff0ea7ca5385af226cabb2366ed8b854db757e0903f0cad99c6d067d924455b24627e0f33b807230e8a5dba079e7b
6
+ metadata.gz: 8aed457818ecc51d2a1adcdc5aeaa9dea9bcdbf9e590f78b7f4f124d83631382ea6cafbf8bcae403ed11bb3adaa4d6808aae3dd46d816f20170a80d07c68586c
7
+ data.tar.gz: 30d0ef0a921e02eb4545d49fa4438caf48aaf985d81132bb4826fa94dfebcc960b2acf442dd66b3bb47886d12921457a7b5c7e500077ec7cda50ae02f281c649
@@ -1,6 +1,6 @@
1
1
  FROM ruby:3.3.0-alpine3.19 AS base
2
- RUN apk add bash docker-cli-buildx git
3
- RUN gem install build-labels:0.0.56 dry-stack:0.1.16
2
+ RUN apk add --update bash docker-cli-buildx docker-cli-compose git
3
+ RUN gem install build-labels:0.0.68 dry-stack:0.1.16
4
4
 
5
5
  FROM base AS runner
6
6
  WORKDIR /build
@@ -10,5 +10,7 @@ CMD ["bash", "-c", "-x", "\
10
10
  env && cd /build/docker && \
11
11
  build-labels -n -c docker-compose.yml gitlab set_version to_dockerfiles to_compose | tee bake.yml && \
12
12
  export OTEL_RESOURCE_ATTRIBUTES=service.name=docker-builder,pipeline.id=${CI_PIPELINE_ID},project.name=${CI_PROJECT_NAME} && \
13
- grep \"services: {}\" bake.yml || REGISTRY_HOST=$CI_REGISTRY_HOST docker buildx bake -f bake.yml $([ -z \"$CI_SKIP_PUSH\" ] && echo \"--push\") \
13
+ export REGISTRY_HOST=$CI_REGISTRY_HOST && \
14
+ grep \"services: {}\" bake.yml || docker buildx bake -f bake.yml $([ -z \"$CI_SKIP_PUSH\" ] && echo \"--push\") && \
15
+ ([ \"$CI_BUILD_TARGET\" = \"tests\" ] && (docker-compose -f bake.yml down && docker-compose -f bake.yml up --force-recreate ) || true) \
14
16
  "]
@@ -0,0 +1,2 @@
1
+
2
+ Refer to ~.codex/shared/AGENTS.md for the actual instructions.
@@ -1 +1,3 @@
1
1
  REGISTRY_HOST=127.0.0.1
2
+ CI_COMMIT_BRANCH=local
3
+ COMPOSE_PROJECT_NAME=${service_name}
@@ -19,7 +19,8 @@ RUN rake -T | grep 'rake build' && rake build || echo 'no build task'
19
19
 
20
20
  # used in .gitlab-ci.yml Tests.
21
21
  FROM base AS tests
22
- RUN bundle exec rspec
22
+ # COPY . . required test fixtures
23
+ CMD bundle exec rspec
23
24
 
24
25
  FROM ruby:3.4.4-slim-bookworm AS deploy
25
26
  RUN apt update && apt install --fix-missing -y bash curl libssl-dev bash curl wget libpq-dev libyaml-0-2\
@@ -20,6 +20,8 @@ group :test do
20
20
  gem 'rspec-benchmark'
21
21
  gem 'rspec_junit_formatter'
22
22
  gem 'async-rspec'
23
+ gem "rspec-snapshot"
24
+ gem 'testcontainers'
23
25
 
24
26
  gem 'simplecov'
25
27
  # gem 'simplecov-cobertura'
@@ -9,11 +9,12 @@ GEM
9
9
  traces (~> 0.18)
10
10
  async-container (0.27.7)
11
11
  async (~> 2.22)
12
- async-container-supervisor (0.7.0)
12
+ async-container-supervisor (0.8.0)
13
13
  async-service
14
14
  io-endpoint
15
15
  memory (~> 0.7)
16
16
  memory-leak (~> 0.5)
17
+ process-metrics
17
18
  async-http (0.92.1)
18
19
  async (>= 2.10.2)
19
20
  async-pool (~> 0.11)
@@ -37,6 +38,7 @@ GEM
37
38
  async
38
39
  async-container (~> 0.16)
39
40
  string-format (~> 0.2)
41
+ awesome_print (1.9.2)
40
42
  bake (0.24.1)
41
43
  bigdecimal
42
44
  samovar (~> 2.1)
@@ -50,13 +52,18 @@ GEM
50
52
  fiber-annotation
51
53
  fiber-local (~> 1.1)
52
54
  json
53
- date (3.4.1)
55
+ date (3.5.0)
54
56
  debug (1.11.0)
55
57
  irb (~> 1.10)
56
58
  reline (>= 0.3.8)
57
59
  diff-lcs (1.6.2)
58
60
  docile (1.4.1)
59
- erb (5.1.1)
61
+ docker-api (2.4.0)
62
+ excon (>= 0.64.0)
63
+ multi_json
64
+ erb (5.1.3)
65
+ excon (1.3.0)
66
+ logger
60
67
  falcon (0.52.4)
61
68
  async
62
69
  async-container (~> 0.20)
@@ -84,7 +91,7 @@ GEM
84
91
  io-endpoint (0.15.2)
85
92
  io-event (1.14.0)
86
93
  io-stream (0.11.0)
87
- irb (1.15.2)
94
+ irb (1.15.3)
88
95
  pp (>= 0.6.0)
89
96
  rdoc (>= 4.0.0)
90
97
  reline (>= 0.4.2)
@@ -92,13 +99,14 @@ GEM
92
99
  localhost (1.6.0)
93
100
  logger (1.7.0)
94
101
  mapping (1.1.3)
95
- memory (0.7.1)
102
+ memory (0.11.1)
96
103
  bake (~> 0.15)
97
104
  console
98
105
  msgpack
99
106
  memory-leak (0.7.0)
100
107
  metrics (0.15.0)
101
108
  msgpack (1.8.0)
109
+ multi_json (1.17.0)
102
110
  mustermann (3.0.4)
103
111
  ruby2_keywords (~> 0.0.1)
104
112
  nats-pure (2.5.0)
@@ -107,7 +115,7 @@ GEM
107
115
  json
108
116
  securerandom
109
117
  uri
110
- openssl (3.3.1)
118
+ openssl (3.3.2)
111
119
  opentelemetry-api (1.7.0)
112
120
  opentelemetry-common (0.23.0)
113
121
  opentelemetry-api (~> 1.0)
@@ -205,7 +213,7 @@ GEM
205
213
  opentelemetry-instrumentation-base (~> 0.25)
206
214
  opentelemetry-instrumentation-grape (0.5.0)
207
215
  opentelemetry-instrumentation-rack (~> 0.29)
208
- opentelemetry-instrumentation-graphql (0.31.1)
216
+ opentelemetry-instrumentation-graphql (0.31.2)
209
217
  opentelemetry-instrumentation-base (~> 0.25)
210
218
  opentelemetry-instrumentation-grpc (0.4.1)
211
219
  opentelemetry-instrumentation-base (~> 0.25)
@@ -284,6 +292,10 @@ GEM
284
292
  pp (0.6.3)
285
293
  prettyprint
286
294
  prettyprint (0.2.0)
295
+ process-metrics (0.6.0)
296
+ console (~> 1.8)
297
+ json (~> 2)
298
+ samovar (~> 2.1)
287
299
  prometheus-client (4.2.5)
288
300
  base64
289
301
  protocol-hpack (1.5.1)
@@ -301,7 +313,7 @@ GEM
301
313
  psych (5.2.6)
302
314
  date
303
315
  stringio
304
- rack (3.1.18)
316
+ rack (3.1.19)
305
317
  rack-protection (4.2.1)
306
318
  base64 (>= 0.1.0)
307
319
  logger (>= 1.6.0)
@@ -313,8 +325,8 @@ GEM
313
325
  rack (>= 1.3)
314
326
  rackup (2.2.1)
315
327
  rack (>= 3)
316
- rake (13.3.0)
317
- rdoc (6.15.0)
328
+ rake (13.3.1)
329
+ rdoc (6.15.1)
318
330
  erb
319
331
  psych (>= 4.0.0)
320
332
  tsort
@@ -338,9 +350,12 @@ GEM
338
350
  rspec (~> 3.0)
339
351
  rspec-memory (1.0.4)
340
352
  rspec (~> 3.0)
341
- rspec-mocks (3.13.6)
353
+ rspec-mocks (3.13.7)
342
354
  diff-lcs (>= 1.2.0, < 2.0)
343
355
  rspec-support (~> 3.13.0)
356
+ rspec-snapshot (2.0.3)
357
+ awesome_print (> 1.0.0)
358
+ rspec (> 3.0.0)
344
359
  rspec-support (3.13.6)
345
360
  rspec_junit_formatter (0.6.0)
346
361
  rspec-core (>= 2, < 4, != 2.12.0)
@@ -351,7 +366,7 @@ GEM
351
366
  sassc (2.4.0)
352
367
  ffi (~> 1.9)
353
368
  securerandom (0.4.1)
354
- sequel (5.97.0)
369
+ sequel (5.98.0)
355
370
  bigdecimal
356
371
  simplecov (0.22.0)
357
372
  docile (~> 1.1)
@@ -370,7 +385,7 @@ GEM
370
385
  temple (~> 0.10.0)
371
386
  tilt (>= 2.1.0)
372
387
  sqlite3 (2.7.4-x86_64-linux-gnu)
373
- stack-service-base (0.0.47)
388
+ stack-service-base (0.0.49)
374
389
  async
375
390
  debug
376
391
  nats-pure
@@ -383,10 +398,14 @@ GEM
383
398
  string-format (0.2.0)
384
399
  stringio (3.1.7)
385
400
  temple (0.10.4)
401
+ testcontainers (0.2.0)
402
+ testcontainers-core (= 0.2.0)
403
+ testcontainers-core (0.2.0)
404
+ docker-api (~> 2.2)
386
405
  tilt (2.6.1)
387
406
  traces (0.18.2)
388
407
  tsort (0.2.0)
389
- uri (1.0.4)
408
+ uri (1.1.0)
390
409
  websocket (1.2.11)
391
410
  yard (0.9.37)
392
411
 
@@ -403,6 +422,7 @@ DEPENDENCIES
403
422
  rackup (~> 2.2.1)
404
423
  rspec
405
424
  rspec-benchmark
425
+ rspec-snapshot
406
426
  rspec_junit_formatter
407
427
  sassc
408
428
  sequel
@@ -411,6 +431,7 @@ DEPENDENCIES
411
431
  slim
412
432
  sqlite3
413
433
  stack-service-base
434
+ testcontainers
414
435
  yard
415
436
 
416
437
  BUNDLED WITH
@@ -4,10 +4,10 @@ require 'stack-service-base'
4
4
 
5
5
  StackServiceBase.rack_setup self
6
6
 
7
- DB = Sequel.connect ENV.fetch('DB_URL')
7
+ DB ||= Sequel.connect ENV.fetch('DB_URL')
8
8
 
9
9
  # require Models ...
10
- # require_relative 'models/...'
10
+ # Dir["#{__dir__}/models/*"].each { require_relative _1 }
11
11
 
12
12
  get '/', &-> { slim :index }
13
13
 
@@ -1,28 +1,58 @@
1
1
  # frozen_string_literal: true
2
2
  $VERBOSE = nil
3
3
 
4
+ require 'stack-service-base/logging'
4
5
  require 'rspec-benchmark'
5
6
  require 'rack/test'
6
7
  require 'async/rspec'
7
8
  require 'rack/builder'
8
-
9
+ require "rspec/snapshot"
10
+ require 'testcontainers'
9
11
  require 'simplecov'
10
12
  SimpleCov.start
11
13
 
12
- ENV['DB_URL'] = 'sqlite::memory:'
13
- $app = Rack::Builder.parse_file(File.expand_path 'config.ru')
14
+ #ENV['DB_URL'] = 'sqlite::memory:'
14
15
 
15
16
  module Rack::Test::JHelpers
16
- def app = $app
17
+ def app = RSpec.configuration.app
17
18
  end
18
19
 
19
20
  RSpec.configure do |config|
20
21
  config.include Rack::Test::Methods
21
22
  config.include Rack::Test::JHelpers
22
23
  config.include RSpec::Benchmark::Matchers
24
+ config.include RSpec::Snapshot
23
25
  config.include_context Async::RSpec::Reactor
26
+ config.add_setting :pg_container
27
+ config.add_setting :app
24
28
 
25
29
  config.before(:each) do
26
30
  header 'Host', 'localhost'
27
31
  end
28
- end
32
+
33
+ config.before(:suite) do
34
+ db_url = ENV['TEST_DB_URL']
35
+ if db_url.nil?
36
+ pg_container = Testcontainers::DockerContainer
37
+ .new("postgis/postgis:16-3.4")
38
+ .with_exposed_port(5432)
39
+ .with_env("POSTGRES_USER", "test")
40
+ .with_env("POSTGRES_PASSWORD", "test")
41
+ .with_env("POSTGRES_DB", "app_test")
42
+ pg_container.logger = LOGGER
43
+ pg_container.add_wait_for(:logs, /database system is ready to accept connections/)
44
+ RSpec.configuration.pg_container = pg_container
45
+ pg_container.start
46
+ db_url = "postgres://test:test@#{pg_container.host}:#{pg_container.first_mapped_port}/app_test"
47
+ end
48
+ ENV['DB_URL'] = db_url
49
+ ENV['APP_ENV'] = "test"
50
+ RSpec.configuration.app = Rack::Builder.parse_file(File.expand_path('config.ru'))
51
+ end
52
+
53
+ config.after(:suite) do
54
+ return unless RSpec.configuration.pg_container
55
+ RSpec.configuration.pg_container.stop
56
+ RSpec.configuration.pg_container.delete
57
+ end
58
+ end
@@ -12,4 +12,4 @@ html
12
12
  color: #282828
13
13
  font-family: "Courier New", monospace
14
14
  body
15
- = yield
15
+ == yield
@@ -1,3 +1,3 @@
1
1
  module StackServiceBase
2
- VERSION = '0.0.49'
2
+ VERSION = '0.0.54'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stack-service-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.49
4
+ version: 0.0.54
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom B
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-29 00:00:00.000000000 Z
11
+ date: 2025-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -247,6 +247,7 @@ files:
247
247
  - lib/stack-service-base/project_template/gitlab/.gitlab-ci.yml
248
248
  - lib/stack-service-base/project_template/gitlab/docker/docker-compose.yml
249
249
  - lib/stack-service-base/project_template/home/.gitignore
250
+ - lib/stack-service-base/project_template/home/AGENTS.md
250
251
  - lib/stack-service-base/project_template/home/docker/.env
251
252
  - lib/stack-service-base/project_template/home/docker/ruby/Dockerfile
252
253
  - lib/stack-service-base/project_template/home/src/.rspec