eventhub-processor2 1.16.0 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2739edbb95a3f9601733c2bde861c8e3503521614fe40f2a0610d4a25c00e92
4
- data.tar.gz: fe134c8b0a783a72bce0cf9c8cad969ee6c924d0de2a531306d6c78390aa2a40
3
+ metadata.gz: f49a2553cee453b3b36d486fe4bbdc45dc7d7dedc7a6c2eaf7697961290e0762
4
+ data.tar.gz: b69f9e536f9290beb54ad50c5396638dae35fda7ad97da78ffa5bc7d020691d7
5
5
  SHA512:
6
- metadata.gz: fcd107c5823805cf7031c0609d3a8ca2a1dd53e48886477c8ebd3640ad4b59c2b094b8268307510d90d3149e05d7b9b9755dcce1841b5a79dac319c05544b482
7
- data.tar.gz: 2af45eadf2bd6491a6ad2bc59f519ce2045cab9753848b2f45a5f94f3e9848eae7234d9ecd82faae4adcac66e1aa7e2d591633c970c7ed0a66d60fb7e815824d
6
+ metadata.gz: fd309c8fc8b8e7d55783b4c44d61e271270de0a5d15c66648e8bc23ad4860ac6ac7f554b0d338ca4c586b78114c4a89ee10fb91442536087d52607e5a3d3d009
7
+ data.tar.gz: 5dfcae4c381eba2933a85c6bb1cb61f1b467fab06e253b07071fcd240f8f5a57f1886efc3c3fd9f915b09e4d88e3651e1e8e81c4aab9f83a3b883224ff169bdd
@@ -35,7 +35,7 @@ jobs:
35
35
  ruby-version: ${{ matrix.ruby }}
36
36
  bundler: latest
37
37
  bundler-cache: true
38
- cache-version: 3
38
+ cache-version: 4
39
39
 
40
40
  - name: Setup RabbitMQ
41
41
  run: |
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.2.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog of EventHub::Processor2
2
2
 
3
+ ## 1.18.0 / 2023-01-30
4
+
5
+ * Update dependencies
6
+
7
+ ## 1.17.0 / 2022-12-21
8
+
9
+ * Ability to load and merge more config file based on a name or a pattern
10
+ * Update dependencies
11
+
3
12
  ## 1.16.0 / 2022-12-18
4
13
 
5
14
  * Updated gem dependencies
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eventhub-processor2 (1.16.0)
4
+ eventhub-processor2 (1.18.0)
5
5
  bunny (~> 2.20)
6
6
  celluloid (~> 0.18)
7
7
  eventhub-components (~> 0.2)
@@ -12,7 +12,7 @@ GEM
12
12
  specs:
13
13
  amq-protocol (2.3.2)
14
14
  ast (2.4.2)
15
- bunny (2.20.0)
15
+ bunny (2.20.3)
16
16
  amq-protocol (~> 2.3, >= 2.3.1)
17
17
  sorted_set (~> 1, >= 1.0.2)
18
18
  celluloid (0.18.0)
@@ -27,12 +27,12 @@ GEM
27
27
  logstash-logger (0.26.1)
28
28
  logstash-event (~> 1.2)
29
29
  parallel (1.22.1)
30
- parser (3.1.3.0)
30
+ parser (3.2.0.0)
31
31
  ast (~> 2.4.1)
32
32
  rainbow (3.1.1)
33
33
  rake (13.0.6)
34
34
  rbtree (0.4.6)
35
- regexp_parser (2.6.1)
35
+ regexp_parser (2.6.2)
36
36
  rexml (3.2.5)
37
37
  rspec (3.12.0)
38
38
  rspec-core (~> 3.12.0)
@@ -40,31 +40,31 @@ GEM
40
40
  rspec-mocks (~> 3.12.0)
41
41
  rspec-core (3.12.0)
42
42
  rspec-support (~> 3.12.0)
43
- rspec-expectations (3.12.1)
43
+ rspec-expectations (3.12.2)
44
44
  diff-lcs (>= 1.2.0, < 2.0)
45
45
  rspec-support (~> 3.12.0)
46
- rspec-mocks (3.12.1)
46
+ rspec-mocks (3.12.3)
47
47
  diff-lcs (>= 1.2.0, < 2.0)
48
48
  rspec-support (~> 3.12.0)
49
49
  rspec-support (3.12.0)
50
- rubocop (1.39.0)
50
+ rubocop (1.42.0)
51
51
  json (~> 2.3)
52
52
  parallel (~> 1.10)
53
53
  parser (>= 3.1.2.1)
54
54
  rainbow (>= 2.2.2, < 4.0)
55
55
  regexp_parser (>= 1.8, < 3.0)
56
56
  rexml (>= 3.2.5, < 4.0)
57
- rubocop-ast (>= 1.23.0, < 2.0)
57
+ rubocop-ast (>= 1.24.1, < 2.0)
58
58
  ruby-progressbar (~> 1.7)
59
59
  unicode-display_width (>= 1.4.0, < 3.0)
60
- rubocop-ast (1.24.0)
60
+ rubocop-ast (1.24.1)
61
61
  parser (>= 3.1.1.0)
62
- rubocop-performance (1.15.1)
62
+ rubocop-performance (1.15.2)
63
63
  rubocop (>= 1.7.0, < 2.0)
64
64
  rubocop-ast (>= 0.4.0)
65
65
  ruby-progressbar (1.11.0)
66
66
  set (1.0.3)
67
- simplecov (0.21.2)
67
+ simplecov (0.22.0)
68
68
  docile (~> 1.1)
69
69
  simplecov-html (~> 0.11)
70
70
  simplecov_json_formatter (~> 0.1)
@@ -73,12 +73,12 @@ GEM
73
73
  sorted_set (1.0.3)
74
74
  rbtree
75
75
  set (~> 1.0)
76
- standard (1.19.1)
76
+ standard (1.22.1)
77
77
  language_server-protocol (~> 3.17.0.2)
78
- rubocop (= 1.39.0)
79
- rubocop-performance (= 1.15.1)
78
+ rubocop (= 1.42.0)
79
+ rubocop-performance (= 1.15.2)
80
80
  timers (4.3.5)
81
- unicode-display_width (2.3.0)
81
+ unicode-display_width (2.4.2)
82
82
  uuidtools (2.2.0)
83
83
 
84
84
  PLATFORMS
@@ -93,7 +93,7 @@ DEPENDENCIES
93
93
  rake (~> 13.0)
94
94
  rspec (~> 3.11)
95
95
  simplecov (~> 0.21)
96
- standard (~> 1.17)
96
+ standard (~> 1.20)
97
97
 
98
98
  BUNDLED WITH
99
99
  2.3.26
data/README.md CHANGED
@@ -181,6 +181,46 @@ Processor2 symbolizes keys and sub-keys from configuration files automatically.
181
181
  database['name']['subname'] # => "value"
182
182
  ```
183
183
 
184
+ Version 1.17 and newer allows you to load and merge more configuration files programmatically. It is expected that load! is called once (implicit during class initialization) and then load_more! zero, one, or multiple times. All additional files loaded with load_more! are hash deep merged into one configuration structure. Exceptions while loading of files will be catched and shown as warnings.
185
+ ```ruby
186
+ # specify a file
187
+ EventHub::Configuration.load_more!(pattern: "config/another_config.json")
188
+
189
+ # specify glob patterns to load multiple files
190
+ EventHub::Configuration.load_more!(pattern: "config/processes/**/*.json")
191
+ EventHub::Configuration.load_more!(pattern: "config/templates/**/*.json")
192
+ ```
193
+ If you have conflicting hashes, the previous settings will be overwritten.
194
+
195
+ 1st file loaded
196
+ ```json
197
+ {
198
+ "test": {
199
+ "a": "a_value",
200
+ "b": "b_value"
201
+ }
202
+ }
203
+ ```
204
+ 2nd file loaded
205
+ ```json
206
+ {
207
+ "test": {
208
+ "b": "another_value"
209
+ }
210
+ }
211
+ ```
212
+
213
+ Final configuration result
214
+ ```json
215
+ {
216
+ "test": {
217
+ "a": "a_value",
218
+ "b": "another_value"
219
+ }
220
+ }
221
+
222
+ ```
223
+
184
224
  ## Development
185
225
 
186
226
  ```
@@ -31,5 +31,5 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency "rake", "~> 13.0"
32
32
  spec.add_development_dependency "rspec", "~> 3.11"
33
33
  spec.add_development_dependency "simplecov", "~> 0.21"
34
- spec.add_development_dependency "standard", "~> 1.17"
34
+ spec.add_development_dependency "standard", "~> 1.20"
35
35
  end
@@ -79,6 +79,24 @@ module EventHub
79
79
  deep_merge!(@config_data, new_data)
80
80
  end
81
81
 
82
+ # load and merge more configuration files
83
+ def load_more!(args = {})
84
+ return unless args[:pattern]
85
+
86
+ Dir.glob(args[:pattern]).each do |name|
87
+ next if File.directory?(name)
88
+
89
+ begin
90
+ EventHub.logger.info("About to load file [#{name}]...")
91
+ new_data = JSON.parse(File.read(name), symbolize_names: true)
92
+ new_data = new_data[@environment.to_sym]
93
+ deep_merge!(@config_data, new_data)
94
+ rescue => e
95
+ EventHub.logger.warn("Exception while loading file [#{name}]: #{e}")
96
+ end
97
+ end
98
+ end
99
+
82
100
  # Deep merging of hashes
83
101
  # deep_merge by Stefan Rusterholz, see http://www.ruby-forum.com/topic/142809
84
102
  def deep_merge!(target, data)
@@ -1,3 +1,3 @@
1
1
  module EventHub
2
- VERSION = "1.16.0".freeze
2
+ VERSION = "1.18.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventhub-processor2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steiner, Thomas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-19 00:00:00.000000000 Z
11
+ date: 2023-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '1.17'
131
+ version: '1.20'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '1.17'
138
+ version: '1.20'
139
139
  description: Next generation gem to build ruby based eventhub processor
140
140
  email:
141
141
  - thomas.steiner@ikey.ch
@@ -148,6 +148,7 @@ files:
148
148
  - ".github/workflows/ci.yml"
149
149
  - ".gitignore"
150
150
  - ".rspec"
151
+ - ".tool-versions"
151
152
  - CHANGELOG.md
152
153
  - Gemfile
153
154
  - Gemfile.lock