rimless 1.1.1 → 1.3.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 +4 -4
- data/.github/workflows/documentation.yml +39 -0
- data/.github/workflows/test.yml +63 -0
- data/.rspec +2 -2
- data/.rubocop.yml +16 -2
- data/.simplecov +12 -0
- data/Appraisals +2 -22
- data/CHANGELOG.md +12 -0
- data/Dockerfile +2 -3
- data/Envfile +0 -3
- data/Guardfile +44 -0
- data/LICENSE +1 -1
- data/Makefile +25 -15
- data/README.md +11 -4
- data/Rakefile +13 -65
- data/doc/kafka-playground/.gitignore +2 -0
- data/doc/kafka-playground/Dockerfile +41 -0
- data/doc/kafka-playground/Gemfile +8 -0
- data/doc/kafka-playground/Gemfile.lock +155 -0
- data/doc/kafka-playground/Makefile +209 -0
- data/doc/kafka-playground/README.md +185 -0
- data/doc/kafka-playground/bin/consume-topic +7 -0
- data/doc/kafka-playground/bin/create-topic +42 -0
- data/doc/kafka-playground/bin/delete-topic +22 -0
- data/doc/kafka-playground/bin/list-topics +3 -0
- data/doc/kafka-playground/bin/produce-event +64 -0
- data/doc/kafka-playground/config/avro_schemas/.gitignore +1 -0
- data/doc/kafka-playground/config/avro_schemas/playground_app/item_v1.avsc.erb +36 -0
- data/doc/kafka-playground/config/avro_schemas/playground_app/payment_v1.avsc.erb +59 -0
- data/doc/kafka-playground/config/avro_schemas/playground_app/payment_v1_event.avsc.erb +18 -0
- data/doc/kafka-playground/config/docker/shell/.bash_profile +3 -0
- data/doc/kafka-playground/config/docker/shell/.bashrc +231 -0
- data/doc/kafka-playground/config/docker/shell/.config/kcat.conf +3 -0
- data/doc/kafka-playground/config/docker/shell/.gemrc +2 -0
- data/doc/kafka-playground/config/docker/shell/.inputrc +17 -0
- data/doc/kafka-playground/config/environment.rb +69 -0
- data/doc/kafka-playground/doc/assets/project.svg +68 -0
- data/doc/kafka-playground/docker-compose.yml +83 -0
- data/doc/kafka-playground/examples/rimless-produce +48 -0
- data/gemfiles/rails_5.2.gemfile +2 -2
- data/lib/rimless/configuration_handling.rb +11 -1
- data/lib/rimless/consumer.rb +4 -2
- data/lib/rimless/dependencies.rb +3 -0
- data/lib/rimless/kafka_helpers.rb +2 -0
- data/lib/rimless/karafka/avro_deserializer.rb +3 -3
- data/lib/rimless/rspec/helpers.rb +11 -0
- data/lib/rimless/rspec/matchers.rb +24 -9
- data/lib/rimless/rspec.rb +1 -1
- data/lib/rimless/tasks/consumer.rake +3 -0
- data/lib/rimless/tasks/generator.rake +3 -0
- data/lib/rimless/tasks/stats.rake +5 -2
- data/lib/rimless/version.rb +18 -1
- data/lib/rimless.rb +0 -1
- data/rimless.gemspec +43 -29
- metadata +121 -71
- data/.travis.yml +0 -35
- data/gemfiles/rails_4.2.gemfile +0 -8
- data/gemfiles/rails_5.0.gemfile +0 -8
- data/gemfiles/rails_5.1.gemfile +0 -8
- data/gemfiles/rails_6.0.gemfile +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d94b5db1c219992a8e7f2470a33c5c260065d19ad9c678fdbe7c34d8d7eac5ef
|
|
4
|
+
data.tar.gz: 208ec10f307dc7b777b656cdeb0c5e959cbc1cc33206fe62cc7655e59823b1cd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 999b3384beea7efb59e9a78a12b721d15f5333ae0ed8f8dc2d5462301a179430083c6947507ca05308370257d6a822ff8b7787db08fc353e609bf00d6d0a068b
|
|
7
|
+
data.tar.gz: 26f9863a2d2252007027d4f3229f1c1883e0156cb12d56941fde1f203b4eb7057a7f5fb5ce5a8a76d810f923e7940a71ac198b82ec70c2c9599abbc2d5cee838
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Build Documentation
|
|
2
|
+
on:
|
|
3
|
+
repository_dispatch:
|
|
4
|
+
types: [documentation]
|
|
5
|
+
|
|
6
|
+
concurrency:
|
|
7
|
+
group: 'docs'
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
docs:
|
|
11
|
+
name: Build gem documentation
|
|
12
|
+
runs-on: ubuntu-22.04
|
|
13
|
+
timeout-minutes: 5
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v3
|
|
16
|
+
|
|
17
|
+
- name: Install the correct Ruby version
|
|
18
|
+
uses: ruby/setup-ruby@v1
|
|
19
|
+
with:
|
|
20
|
+
ruby-version: 2.5
|
|
21
|
+
bundler-cache: true
|
|
22
|
+
rubygems: '3.3.26'
|
|
23
|
+
|
|
24
|
+
- name: Prepare the virtual environment
|
|
25
|
+
uses: hausgold/actions/ci@master
|
|
26
|
+
with:
|
|
27
|
+
clone_token: '${{ secrets.CLONE_TOKEN }}'
|
|
28
|
+
settings: '${{ github.repository }}'
|
|
29
|
+
target: ci/gem-test
|
|
30
|
+
|
|
31
|
+
- name: Build gem documentation
|
|
32
|
+
run: make docs
|
|
33
|
+
|
|
34
|
+
- name: Upload the code coverage report
|
|
35
|
+
run: coverage
|
|
36
|
+
|
|
37
|
+
- name: Add this job to the commit status
|
|
38
|
+
run: commit-status '${{ job.status }}'
|
|
39
|
+
if: always()
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- '**'
|
|
6
|
+
schedule:
|
|
7
|
+
- cron: '0 0 * * MON'
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: '${{ github.ref }}'
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
test:
|
|
15
|
+
name: 'Test the gem (Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }})'
|
|
16
|
+
runs-on: ubuntu-22.04
|
|
17
|
+
timeout-minutes: 5
|
|
18
|
+
strategy:
|
|
19
|
+
fail-fast: false
|
|
20
|
+
matrix:
|
|
21
|
+
ruby: ['2.5', '2.7']
|
|
22
|
+
rails: ['5.2']
|
|
23
|
+
env:
|
|
24
|
+
BUNDLE_GEMFILE: 'gemfiles/rails_${{ matrix.rails }}.gemfile'
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v3
|
|
27
|
+
|
|
28
|
+
- name: Install the correct Ruby version
|
|
29
|
+
uses: ruby/setup-ruby@v1
|
|
30
|
+
with:
|
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
|
32
|
+
bundler-cache: true
|
|
33
|
+
rubygems: '3.3.26'
|
|
34
|
+
|
|
35
|
+
- name: Prepare the virtual environment
|
|
36
|
+
uses: hausgold/actions/ci@master
|
|
37
|
+
with:
|
|
38
|
+
clone_token: '${{ secrets.CLONE_TOKEN }}'
|
|
39
|
+
settings: '${{ github.repository }}'
|
|
40
|
+
target: ci/gem-test
|
|
41
|
+
|
|
42
|
+
- name: Run the gem tests
|
|
43
|
+
run: make test
|
|
44
|
+
|
|
45
|
+
- name: Upload the code coverage report
|
|
46
|
+
run: coverage
|
|
47
|
+
|
|
48
|
+
trigger-docs:
|
|
49
|
+
name: Trigger the documentation upload
|
|
50
|
+
runs-on: ubuntu-22.04
|
|
51
|
+
timeout-minutes: 2
|
|
52
|
+
needs: test
|
|
53
|
+
if: github.ref == 'refs/heads/master'
|
|
54
|
+
steps:
|
|
55
|
+
- name: Prepare the virtual environment
|
|
56
|
+
uses: hausgold/actions/ci@master
|
|
57
|
+
with:
|
|
58
|
+
clone_token: '${{ secrets.CLONE_TOKEN }}'
|
|
59
|
+
settings: '${{ github.repository }}'
|
|
60
|
+
target: ci/noop
|
|
61
|
+
|
|
62
|
+
- name: Trigger the documentation upload
|
|
63
|
+
run: workflow documentation
|
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
require:
|
|
1
|
+
require:
|
|
2
|
+
- rubocop-rspec
|
|
3
|
+
- rubocop-rails
|
|
2
4
|
|
|
3
5
|
Rails:
|
|
4
6
|
Enabled: true
|
|
5
7
|
|
|
6
|
-
Documentation:
|
|
8
|
+
Style/Documentation:
|
|
7
9
|
Enabled: true
|
|
8
10
|
|
|
9
11
|
AllCops:
|
|
12
|
+
NewCops: enable
|
|
13
|
+
SuggestExtensions: false
|
|
10
14
|
DisplayCopNames: true
|
|
11
15
|
TargetRubyVersion: 2.5
|
|
16
|
+
TargetRailsVersion: 5.2
|
|
12
17
|
Exclude:
|
|
13
18
|
- bin/**/*
|
|
14
19
|
- vendor/**/*
|
|
15
20
|
- build/**/*
|
|
16
21
|
- gemfiles/**/*
|
|
22
|
+
- doc/kafka-playground/**/*
|
|
17
23
|
|
|
18
24
|
Metrics/BlockLength:
|
|
19
25
|
Exclude:
|
|
@@ -23,6 +29,14 @@ Metrics/BlockLength:
|
|
|
23
29
|
- '**/*.rake'
|
|
24
30
|
- doc/**/*.rb
|
|
25
31
|
|
|
32
|
+
# MFA is not yet enabled for our gems yet.
|
|
33
|
+
Gemspec/RequireMFA:
|
|
34
|
+
Enabled: false
|
|
35
|
+
|
|
36
|
+
# We stay with the original Ruby Style Guide recommendation.
|
|
37
|
+
Layout/LineLength:
|
|
38
|
+
Max: 80
|
|
39
|
+
|
|
26
40
|
# Document all the things.
|
|
27
41
|
Style/DocumentationMethod:
|
|
28
42
|
Enabled: true
|
data/.simplecov
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'simplecov-html'
|
|
4
|
+
require 'simplecov_json_formatter'
|
|
5
|
+
|
|
6
|
+
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
|
|
7
|
+
[
|
|
8
|
+
SimpleCov::Formatter::HTMLFormatter,
|
|
9
|
+
SimpleCov::Formatter::JSONFormatter
|
|
10
|
+
]
|
|
11
|
+
)
|
|
12
|
+
|
|
1
13
|
SimpleCov.start 'test_frameworks' do
|
|
2
14
|
add_filter '/vendor/bundle/'
|
|
3
15
|
end
|
data/Appraisals
CHANGED
|
@@ -1,26 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
appraise 'rails-4.2' do
|
|
4
|
-
gem 'activesupport', '~> 4.2.11'
|
|
5
|
-
gem 'railties', '~> 4.2.11'
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
appraise 'rails-5.0' do
|
|
9
|
-
gem 'activesupport', '~> 5.0.7'
|
|
10
|
-
gem 'railties', '~> 5.0.7'
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
appraise 'rails-5.1' do
|
|
14
|
-
gem 'activesupport', '~> 5.1.6'
|
|
15
|
-
gem 'railties', '~> 5.1.6'
|
|
16
|
-
end
|
|
17
|
-
|
|
18
3
|
appraise 'rails-5.2' do
|
|
19
|
-
gem 'activesupport', '~> 5.2.
|
|
20
|
-
gem 'railties', '~> 5.2.
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
appraise 'rails-6.0' do
|
|
24
|
-
gem 'activesupport', '~> 6.0.0'
|
|
25
|
-
gem 'railties', '~> 6.0.0'
|
|
4
|
+
gem 'activesupport', '~> 5.2.0'
|
|
5
|
+
gem 'railties', '~> 5.2.0'
|
|
26
6
|
end
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
### 1.3.0
|
|
2
|
+
|
|
3
|
+
* Bundler >= 2.3 is from now on required as minimal version (#19)
|
|
4
|
+
* Dropped support for Ruby < 2.5 (#19)
|
|
5
|
+
* Dropped support for Rails < 5.2 (#19)
|
|
6
|
+
* Updated all development/runtime gems to their latest
|
|
7
|
+
Ruby 2.5 compatible version (#19)
|
|
8
|
+
|
|
9
|
+
### 1.2.0
|
|
10
|
+
|
|
11
|
+
* Added a `capture_kafka_messages` helper for RSpec (#12)
|
|
12
|
+
|
|
1
13
|
### 1.1.1
|
|
2
14
|
|
|
3
15
|
* Corrected the GNU Make release target
|
data/Dockerfile
CHANGED
|
@@ -2,7 +2,7 @@ FROM hausgold/ruby:2.5
|
|
|
2
2
|
MAINTAINER Hermann Mayer <hermann.mayer@hausgold.de>
|
|
3
3
|
|
|
4
4
|
# Update system gem
|
|
5
|
-
RUN gem update --system
|
|
5
|
+
RUN gem update --system '3.3.26'
|
|
6
6
|
|
|
7
7
|
# Install system packages and the latest bundler
|
|
8
8
|
RUN apt-get update -yqqq && \
|
|
@@ -11,8 +11,7 @@ RUN apt-get update -yqqq && \
|
|
|
11
11
|
ca-certificates \
|
|
12
12
|
bash-completion inotify-tools && \
|
|
13
13
|
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && /usr/sbin/locale-gen && \
|
|
14
|
-
gem install bundler -v '~> 2.0' --no-document --no-prerelease
|
|
15
|
-
gem install bundler -v '~> 1.0' --no-document --no-prerelease
|
|
14
|
+
gem install bundler -v '~> 2.3.0' --no-document --no-prerelease
|
|
16
15
|
|
|
17
16
|
# Add new web user
|
|
18
17
|
RUN mkdir /app && \
|
data/Envfile
CHANGED
data/Guardfile
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# A sample Guardfile
|
|
4
|
+
# More info at https://github.com/guard/guard#readme
|
|
5
|
+
|
|
6
|
+
## Uncomment and set this to only include directories you want to watch
|
|
7
|
+
(directories %w[lib spec]).select do |d|
|
|
8
|
+
if Dir.exist?(d)
|
|
9
|
+
d
|
|
10
|
+
else
|
|
11
|
+
UI.warning("Directory #{d} does not exist")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
## Note: if you are using the `directories` clause above and you are not
|
|
16
|
+
## watching the project directory ('.'), then you will want to move
|
|
17
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
|
18
|
+
#
|
|
19
|
+
# $ mkdir config
|
|
20
|
+
# $ mv Guardfile config/
|
|
21
|
+
# $ ln -s config/Guardfile .
|
|
22
|
+
#
|
|
23
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
|
24
|
+
|
|
25
|
+
# NOTE: The cmd option is now required due to the increasing number of ways
|
|
26
|
+
# rspec may be run, below are examples of the most common uses.
|
|
27
|
+
# * bundler: 'bundle exec rspec'
|
|
28
|
+
# * bundler binstubs: 'bin/rspec'
|
|
29
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
|
30
|
+
# installed the spring binstubs per the docs)
|
|
31
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
|
32
|
+
# * 'just' rspec: 'rspec'
|
|
33
|
+
|
|
34
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
|
35
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
|
36
|
+
watch(%r{^lib/rimless.rb}) { 'spec' }
|
|
37
|
+
watch(%r{^spec/.+_spec\.rb$})
|
|
38
|
+
watch(%r{^lib/rimless/([^\\]+)\.rb$}) do |m|
|
|
39
|
+
"spec/rimless/#{m[1]}_spec.rb"
|
|
40
|
+
end
|
|
41
|
+
watch(%r{^lib/rimless/([^\\]+)/(.*)\.rb$}) do |m|
|
|
42
|
+
"spec/rimless/#{m[1]}/#{m[2]}_spec.rb"
|
|
43
|
+
end
|
|
44
|
+
end
|
data/LICENSE
CHANGED
data/Makefile
CHANGED
|
@@ -9,6 +9,7 @@ SHELL := bash
|
|
|
9
9
|
# Environment switches
|
|
10
10
|
MAKE_ENV ?= docker
|
|
11
11
|
COMPOSE_RUN_SHELL_FLAGS ?= --rm
|
|
12
|
+
BASH_RUN_SHELL_FLAGS ?=
|
|
12
13
|
|
|
13
14
|
# Directories
|
|
14
15
|
VENDOR_DIR ?= vendor/bundle
|
|
@@ -29,8 +30,9 @@ XARGS ?= xargs
|
|
|
29
30
|
APPRAISAL ?= appraisal
|
|
30
31
|
BUNDLE ?= bundle
|
|
31
32
|
GEM ?= gem
|
|
33
|
+
GUARD ?= guard
|
|
32
34
|
RAKE ?= rake
|
|
33
|
-
|
|
35
|
+
RSPEC ?= rspec
|
|
34
36
|
RUBOCOP ?= rubocop
|
|
35
37
|
YARD ?= yard
|
|
36
38
|
|
|
@@ -46,7 +48,8 @@ define run-shell
|
|
|
46
48
|
$(COMPOSE) run $(COMPOSE_RUN_SHELL_FLAGS) \
|
|
47
49
|
-e LANG=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e LC_ALL=en_US.UTF-8 \
|
|
48
50
|
-e HOME=/home/web -e BUNDLE_APP_CONFIG=/app/.bundle \
|
|
49
|
-
-u `$(ID) -u` test
|
|
51
|
+
-u `$(ID) -u` test \
|
|
52
|
+
bash $(BASH_RUN_SHELL_FLAGS) -c 'sleep 0.1; echo; $(1)'
|
|
50
53
|
endef
|
|
51
54
|
else ifeq ($(MAKE_ENV),baremetal)
|
|
52
55
|
define run-shell
|
|
@@ -63,6 +66,7 @@ all:
|
|
|
63
66
|
#
|
|
64
67
|
# test Run the whole test suite
|
|
65
68
|
# test-style Test the code styles
|
|
69
|
+
# watch Watch for code changes and rerun the test suite
|
|
66
70
|
#
|
|
67
71
|
# docs Generate the Ruby documentation of the library
|
|
68
72
|
# stats Print the code statistics (library and test suite)
|
|
@@ -72,31 +76,37 @@ all:
|
|
|
72
76
|
# shell Run an interactive shell on the container
|
|
73
77
|
# shell-irb Run an interactive IRB shell on the container
|
|
74
78
|
|
|
79
|
+
.interactive:
|
|
80
|
+
@$(eval BASH_RUN_SHELL_FLAGS = --login)
|
|
81
|
+
|
|
75
82
|
install:
|
|
76
83
|
# Install the dependencies
|
|
77
84
|
@$(MKDIR) -p $(VENDOR_DIR)
|
|
78
85
|
@$(call run-shell,$(BUNDLE) check || $(BUNDLE) install --path $(VENDOR_DIR))
|
|
79
|
-
@$(call run-shell,GEM_HOME=vendor/bundle/ruby/$${RUBY_MAJOR}.0 \
|
|
80
|
-
$(GEM) install bundler -v "~> 1.0")
|
|
81
86
|
@$(call run-shell,$(BUNDLE) exec $(APPRAISAL) install)
|
|
82
87
|
|
|
83
|
-
update:
|
|
88
|
+
update:
|
|
84
89
|
# Install the dependencies
|
|
85
90
|
@$(MKDIR) -p $(VENDOR_DIR)
|
|
91
|
+
@$(call run-shell,$(BUNDLE) update)
|
|
86
92
|
@$(call run-shell,$(BUNDLE) exec $(APPRAISAL) update)
|
|
87
93
|
|
|
94
|
+
watch: install .interactive
|
|
95
|
+
# Watch for code changes and rerun the test suite
|
|
96
|
+
@$(call run-shell,$(BUNDLE) exec $(GUARD))
|
|
97
|
+
|
|
88
98
|
test: \
|
|
89
99
|
test-specs \
|
|
90
100
|
test-style
|
|
91
101
|
|
|
92
102
|
test-specs:
|
|
93
103
|
# Run the whole test suite
|
|
94
|
-
@$(call run-shell,$(BUNDLE) exec $(RAKE))
|
|
104
|
+
@$(call run-shell,$(BUNDLE) exec $(RAKE) stats spec)
|
|
95
105
|
|
|
96
106
|
$(TEST_GEMFILES): GEMFILE=$(@:test-%=%)
|
|
97
107
|
$(TEST_GEMFILES):
|
|
98
108
|
# Run the whole test suite ($(GEMFILE))
|
|
99
|
-
@$(call run-shell,$(BUNDLE) exec $(APPRAISAL) $(GEMFILE) $(
|
|
109
|
+
@$(call run-shell,$(BUNDLE) exec $(APPRAISAL) $(GEMFILE) $(RSPEC))
|
|
100
110
|
|
|
101
111
|
test-style: \
|
|
102
112
|
test-style-ruby
|
|
@@ -111,8 +121,8 @@ clean:
|
|
|
111
121
|
@$(RM) -rf $(VENDOR_DIR)/Gemfile.lock
|
|
112
122
|
@$(RM) -rf $(GEMFILES_DIR)/vendor
|
|
113
123
|
@$(RM) -rf $(GEMFILES_DIR)/*.lock
|
|
114
|
-
@$(RM) -rf pkg
|
|
115
|
-
|
|
124
|
+
@$(RM) -rf .bundle .yardoc coverage pkg Gemfile.lock doc/api \
|
|
125
|
+
.rspec_status
|
|
116
126
|
|
|
117
127
|
clean-containers:
|
|
118
128
|
# Clean running containers
|
|
@@ -123,31 +133,31 @@ endif
|
|
|
123
133
|
clean-images:
|
|
124
134
|
# Clean build images
|
|
125
135
|
ifeq ($(MAKE_ENV),docker)
|
|
126
|
-
@-$(DOCKER) images | $(GREP)
|
|
136
|
+
@-$(DOCKER) images | $(GREP) $(shell basename "`pwd`") \
|
|
127
137
|
| $(AWK) '{ print $$3 }' \
|
|
128
138
|
| $(XARGS) -rn1 $(DOCKER) rmi -f
|
|
129
139
|
endif
|
|
130
140
|
|
|
131
141
|
distclean: clean clean-containers clean-images
|
|
132
142
|
|
|
133
|
-
shell:
|
|
143
|
+
shell:
|
|
134
144
|
# Run an interactive shell on the container
|
|
135
145
|
@$(call run-shell,$(BASH) -i)
|
|
136
146
|
|
|
137
|
-
shell-irb:
|
|
147
|
+
shell-irb:
|
|
138
148
|
# Run an interactive IRB shell on the container
|
|
139
149
|
@$(call run-shell,bin/console)
|
|
140
150
|
|
|
141
|
-
docs:
|
|
151
|
+
docs:
|
|
142
152
|
# Build the API documentation
|
|
143
153
|
@$(call run-shell,$(BUNDLE) exec $(YARD) -q && \
|
|
144
154
|
$(BUNDLE) exec $(YARD) stats --list-undoc --compact)
|
|
145
155
|
|
|
146
|
-
notes:
|
|
156
|
+
notes:
|
|
147
157
|
# Print the code statistics (library and test suite)
|
|
148
158
|
@$(call run-shell,$(BUNDLE) exec $(RAKE) notes)
|
|
149
159
|
|
|
150
|
-
stats:
|
|
160
|
+
stats:
|
|
151
161
|
# Print all the notes from the code
|
|
152
162
|
@$(call run-shell,$(BUNDLE) exec $(RAKE) stats)
|
|
153
163
|
|
data/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
-
[](https://github.com/hausgold/rimless/actions/workflows/test.yml)
|
|
4
4
|
[](https://badge.fury.io/rb/rimless)
|
|
5
|
-
[](https://knowledge.hausgold.de/coverage)
|
|
6
|
+
[](https://knowledge.hausgold.de/coverage)
|
|
7
|
+
[](https://www.rubydoc.info/gems/rimless)
|
|
8
8
|
|
|
9
9
|
This project is dedicated to ship a ready to use [Apache
|
|
10
10
|
Kafka](https://kafka.apache.org/) / [Confluent Schema
|
|
@@ -575,6 +575,13 @@ describe 'message producer job' do
|
|
|
575
575
|
.with(key: user.id, topic: 'test.identity-api.users').twice
|
|
576
576
|
.with_data(firstname: 'John', lastname: 'Doe').twice
|
|
577
577
|
end
|
|
578
|
+
|
|
579
|
+
it 'allows to capture messages to check them in detail' do
|
|
580
|
+
(capture_kafka_messages { action }).tap do |messages|
|
|
581
|
+
expect(messages.first[:data]).to \
|
|
582
|
+
match(a_hash_including('entity' => a_hash_including('items' => items)))
|
|
583
|
+
end
|
|
584
|
+
end
|
|
578
585
|
end
|
|
579
586
|
```
|
|
580
587
|
|
data/Rakefile
CHANGED
|
@@ -2,75 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
require 'bundler/gem_tasks'
|
|
4
4
|
require 'rspec/core/rake_task'
|
|
5
|
-
require '
|
|
6
|
-
require 'pp'
|
|
5
|
+
require 'countless/rake_tasks'
|
|
7
6
|
|
|
8
7
|
RSpec::Core::RakeTask.new(:spec)
|
|
9
8
|
|
|
10
9
|
task default: :spec
|
|
11
10
|
|
|
12
|
-
# Load some railties tasks
|
|
13
|
-
load 'rails/tasks/statistics.rake'
|
|
14
|
-
load 'rails/tasks/annotations.rake'
|
|
15
|
-
|
|
16
|
-
# Clear the default statistics directory constant
|
|
17
|
-
#
|
|
18
|
-
# rubocop:disable Style/MutableConstant because we define it
|
|
19
|
-
Object.send(:remove_const, :STATS_DIRECTORIES)
|
|
20
|
-
::STATS_DIRECTORIES = []
|
|
21
|
-
# rubocop:enable Style/MutableConstant
|
|
22
|
-
|
|
23
|
-
# Monkey patch the Rails +CodeStatistics+ class to support configurable
|
|
24
|
-
# patterns per path. This is reuqired to support top-level only file matches.
|
|
25
|
-
class CodeStatistics
|
|
26
|
-
DEFAULT_PATTERN = /^(?!\.).*?\.(rb|js|coffee|rake)$/.freeze
|
|
27
|
-
|
|
28
|
-
# Pass the possible +pattern+ argument down to the
|
|
29
|
-
# +calculate_directory_statistics+ method call.
|
|
30
|
-
def calculate_statistics
|
|
31
|
-
Hash[@pairs.map do |pair|
|
|
32
|
-
[pair.first, calculate_directory_statistics(*pair[1..-1])]
|
|
33
|
-
end]
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# Match the pattern against the individual file name and the relative file
|
|
37
|
-
# path. This allows top-level only matches.
|
|
38
|
-
def calculate_directory_statistics(directory, pattern = DEFAULT_PATTERN)
|
|
39
|
-
stats = CodeStatisticsCalculator.new
|
|
40
|
-
|
|
41
|
-
Dir.foreach(directory) do |file_name|
|
|
42
|
-
path = "#{directory}/#{file_name}"
|
|
43
|
-
|
|
44
|
-
if File.directory?(path) && (/^\./ !~ file_name)
|
|
45
|
-
stats.add(calculate_directory_statistics(path, pattern))
|
|
46
|
-
elsif file_name =~ pattern || path =~ pattern
|
|
47
|
-
stats.add_by_file_path(path)
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
stats
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
11
|
# Configure all code statistics directories
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
# Setup annotations
|
|
71
|
-
ENV['SOURCE_ANNOTATION_DIRECTORIES'] = 'spec,doc'
|
|
72
|
-
|
|
73
|
-
desc 'Enumerate all annotations'
|
|
74
|
-
task :notes do
|
|
75
|
-
SourceAnnotationExtractor.enumerate '@?OPTIMIZE|@?FIXME|@?TODO', tag: true
|
|
12
|
+
Countless.configure do |config|
|
|
13
|
+
config.stats_base_directories = [
|
|
14
|
+
{ name: 'Top-levels', dir: 'lib',
|
|
15
|
+
pattern: %r{/lib(/rimless)?/[^/]+\.rb$} },
|
|
16
|
+
{ name: 'Top-levels specs', test: true, dir: 'spec',
|
|
17
|
+
pattern: %r{/spec(/rimless)?/[^/]+_spec\.rb$} },
|
|
18
|
+
{ name: 'RSpec matchers', pattern: 'lib/rimless/rspec/**/*.rb' },
|
|
19
|
+
{ name: 'RSpec matchers specs', test: true,
|
|
20
|
+
pattern: 'spec/rimless/rspec/**/*_spec.rb' },
|
|
21
|
+
{ name: 'Rake Tasks', pattern: 'lib/rimless/tasks/**/*' },
|
|
22
|
+
{ name: 'Karafka Extensions', pattern: 'lib/rimless/karafka/**/*.rb' }
|
|
23
|
+
]
|
|
76
24
|
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
FROM hausgold/ruby:2.5
|
|
2
|
+
MAINTAINER Hermann Mayer <hermann.mayer@hausgold.de>
|
|
3
|
+
|
|
4
|
+
# Update system gem
|
|
5
|
+
RUN gem update --system
|
|
6
|
+
|
|
7
|
+
# Add backports repository
|
|
8
|
+
RUN echo 'deb http://ftp.debian.org/debian buster-backports main' \
|
|
9
|
+
>> /etc/apt/sources.list
|
|
10
|
+
|
|
11
|
+
# Install nodejs 16
|
|
12
|
+
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
|
|
13
|
+
|
|
14
|
+
# Install system packages and the ruby bundless
|
|
15
|
+
RUN apt-get update -yqqq && \
|
|
16
|
+
apt-get install -y \
|
|
17
|
+
build-essential nodejs locales sudo vim \
|
|
18
|
+
ca-certificates jq curl cmake \
|
|
19
|
+
bash-completion inotify-tools && \
|
|
20
|
+
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && /usr/sbin/locale-gen && \
|
|
21
|
+
gem install bundler --no-document --no-prerelease
|
|
22
|
+
|
|
23
|
+
# Install kcat (formerly known as kafkacat)
|
|
24
|
+
RUN curl -sL https://github.com/edenhill/kcat/archive/refs/tags/1.7.0.tar.gz \
|
|
25
|
+
| tar xfvz - -C /tmp && cd /tmp/kcat-* && ./bootstrap.sh && \
|
|
26
|
+
mv kcat /usr/local/bin && cd / && rm -rf /tmp/kcat-*
|
|
27
|
+
|
|
28
|
+
# Add new app user
|
|
29
|
+
RUN mkdir /app && \
|
|
30
|
+
adduser app --home /home/app --shell /bin/bash \
|
|
31
|
+
--disabled-password --gecos ""
|
|
32
|
+
ADD config/docker/shell/ /home/app/
|
|
33
|
+
RUN chown app:app -R /app /home/app /usr/local/bundle && \
|
|
34
|
+
mkdir -p /home/app/.ssh && \
|
|
35
|
+
sudo -HEu app bash -c 'bundle config set system "true"'
|
|
36
|
+
|
|
37
|
+
# Set the root password and grant root access to app
|
|
38
|
+
RUN echo 'root:root' | chpasswd
|
|
39
|
+
RUN echo 'app ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
|
40
|
+
|
|
41
|
+
WORKDIR /app
|