eventhub-processor2 1.16.0 → 1.17.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/CHANGELOG.md +5 -0
- data/Gemfile.lock +6 -6
- data/README.md +40 -0
- data/eventhub-processor2.gemspec +1 -1
- data/lib/eventhub/configuration.rb +18 -0
- data/lib/eventhub/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78506dd98d394a48e12d31f9e3548bda5ef44674e4e964bf783a3b0374ee100d
|
4
|
+
data.tar.gz: 24f228ec36df83139a4b44d8ac80e51dc60639422f74ebe3713a5eddc7c05c74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b631a080f4e71f3739f2c8ebdc75ea50173493518f623ec0e394bdf42a10c524fadc123c6ad0e4a42b71d5b7cae625d0c58850f47ccbdb7e78eb411870aaa90
|
7
|
+
data.tar.gz: c3809dc7e46f87ce03e3ca44c2fb3caec3213d70b85d1e565bdf945f3a5b32b752c85281524a21197e30eb55bb7bd7fe6bfce423f0c0e564da65c30c7d3daefc
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
eventhub-processor2 (1.
|
4
|
+
eventhub-processor2 (1.17.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.
|
15
|
+
bunny (2.20.1)
|
16
16
|
amq-protocol (~> 2.3, >= 2.3.1)
|
17
17
|
sorted_set (~> 1, >= 1.0.2)
|
18
18
|
celluloid (0.18.0)
|
@@ -47,7 +47,7 @@ GEM
|
|
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.
|
50
|
+
rubocop (1.40.0)
|
51
51
|
json (~> 2.3)
|
52
52
|
parallel (~> 1.10)
|
53
53
|
parser (>= 3.1.2.1)
|
@@ -73,9 +73,9 @@ GEM
|
|
73
73
|
sorted_set (1.0.3)
|
74
74
|
rbtree
|
75
75
|
set (~> 1.0)
|
76
|
-
standard (1.
|
76
|
+
standard (1.20.0)
|
77
77
|
language_server-protocol (~> 3.17.0.2)
|
78
|
-
rubocop (= 1.
|
78
|
+
rubocop (= 1.40.0)
|
79
79
|
rubocop-performance (= 1.15.1)
|
80
80
|
timers (4.3.5)
|
81
81
|
unicode-display_width (2.3.0)
|
@@ -93,7 +93,7 @@ DEPENDENCIES
|
|
93
93
|
rake (~> 13.0)
|
94
94
|
rspec (~> 3.11)
|
95
95
|
simplecov (~> 0.21)
|
96
|
-
standard (~> 1.
|
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
|
```
|
data/eventhub-processor2.gemspec
CHANGED
@@ -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.
|
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)
|
data/lib/eventhub/version.rb
CHANGED
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.
|
4
|
+
version: 1.17.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-
|
11
|
+
date: 2022-12-21 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.
|
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.
|
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
|