eventhub-processor2 1.15.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6f4547c597edae29cf4ddc6030441b4562fc55a804c782ddb7bc9c34311f02d
4
- data.tar.gz: 13ad75f665e628c48668dfa3ce1a36ac672ff092d15eb77a876d5c2bfc339b84
3
+ metadata.gz: 78506dd98d394a48e12d31f9e3548bda5ef44674e4e964bf783a3b0374ee100d
4
+ data.tar.gz: 24f228ec36df83139a4b44d8ac80e51dc60639422f74ebe3713a5eddc7c05c74
5
5
  SHA512:
6
- metadata.gz: 2a851976fe229400a7e4559b654dbcce531bce4572d8a9aaea5eb59e1fd8f7ed572d990b60f9dba85c13e734e6e8e79ab82a62113342d89a2a7177bf0653c897
7
- data.tar.gz: 908681fe866d3cd9e33058fbc77d896eb7a99e706e95ffcb28ece82a7a60bc1ccf119480a73c9059d6d9c6f9ef9650c4512a6a159a09b7c79f37a6bd0eccf127
6
+ metadata.gz: 9b631a080f4e71f3739f2c8ebdc75ea50173493518f623ec0e394bdf42a10c524fadc123c6ad0e4a42b71d5b7cae625d0c58850f47ccbdb7e78eb411870aaa90
7
+ data.tar.gz: c3809dc7e46f87ce03e3ca44c2fb3caec3213d70b85d1e565bdf945f3a5b32b752c85281524a21197e30eb55bb7bd7fe6bfce423f0c0e564da65c30c7d3daefc
@@ -7,3 +7,11 @@ updates:
7
7
  day: "saturday"
8
8
  time: "04:00"
9
9
  timezone: "Europe/Zurich"
10
+
11
+ - package-ecosystem: "github-actions"
12
+ directory: "/"
13
+ schedule:
14
+ interval: "weekly"
15
+ day: "saturday"
16
+ time: "04:00"
17
+ timezone: "Europe/Zurich"
@@ -10,7 +10,7 @@ on:
10
10
  - "*"
11
11
 
12
12
  schedule:
13
- - cron: 0 2 * * *
13
+ - cron: 0 2 * * 1,3,5,6
14
14
 
15
15
  # Allows you to run this workflow manually from the Actions tab
16
16
  workflow_dispatch:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog of EventHub::Processor2
2
2
 
3
+ ## 1.17.0 / 2022-12-21
4
+
5
+ * Ability to load and merge more config file based on a name or a pattern
6
+ * Update dependencies
7
+
8
+ ## 1.16.0 / 2022-12-18
9
+
10
+ * Updated gem dependencies
11
+ * Improve access on undefined @logger instance
12
+
3
13
  ## 1.15.0 / 2022-10-28
4
14
 
5
15
  * Updated gem dependencies
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eventhub-processor2 (1.15.0)
5
- bunny (~> 2.19)
4
+ eventhub-processor2 (1.17.0)
5
+ bunny (~> 2.20)
6
6
  celluloid (~> 0.18)
7
7
  eventhub-components (~> 0.2)
8
8
  uuidtools (~> 2.1)
@@ -12,7 +12,7 @@ GEM
12
12
  specs:
13
13
  amq-protocol (2.3.2)
14
14
  ast (2.4.2)
15
- bunny (2.19.0)
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)
@@ -21,17 +21,18 @@ GEM
21
21
  docile (1.4.0)
22
22
  eventhub-components (0.3.1)
23
23
  logstash-logger (~> 0.26)
24
- json (2.6.2)
24
+ json (2.6.3)
25
+ language_server-protocol (3.17.0.2)
25
26
  logstash-event (1.2.02)
26
27
  logstash-logger (0.26.1)
27
28
  logstash-event (~> 1.2)
28
29
  parallel (1.22.1)
29
- parser (3.1.2.1)
30
+ parser (3.1.3.0)
30
31
  ast (~> 2.4.1)
31
32
  rainbow (3.1.1)
32
33
  rake (13.0.6)
33
- rbtree (0.4.5)
34
- regexp_parser (2.6.0)
34
+ rbtree (0.4.6)
35
+ regexp_parser (2.6.1)
35
36
  rexml (3.2.5)
36
37
  rspec (3.12.0)
37
38
  rspec-core (~> 3.12.0)
@@ -39,26 +40,26 @@ GEM
39
40
  rspec-mocks (~> 3.12.0)
40
41
  rspec-core (3.12.0)
41
42
  rspec-support (~> 3.12.0)
42
- rspec-expectations (3.12.0)
43
+ rspec-expectations (3.12.1)
43
44
  diff-lcs (>= 1.2.0, < 2.0)
44
45
  rspec-support (~> 3.12.0)
45
- rspec-mocks (3.12.0)
46
+ rspec-mocks (3.12.1)
46
47
  diff-lcs (>= 1.2.0, < 2.0)
47
48
  rspec-support (~> 3.12.0)
48
49
  rspec-support (3.12.0)
49
- rubocop (1.35.1)
50
+ rubocop (1.40.0)
50
51
  json (~> 2.3)
51
52
  parallel (~> 1.10)
52
53
  parser (>= 3.1.2.1)
53
54
  rainbow (>= 2.2.2, < 4.0)
54
55
  regexp_parser (>= 1.8, < 3.0)
55
56
  rexml (>= 3.2.5, < 4.0)
56
- rubocop-ast (>= 1.20.1, < 2.0)
57
+ rubocop-ast (>= 1.23.0, < 2.0)
57
58
  ruby-progressbar (~> 1.7)
58
59
  unicode-display_width (>= 1.4.0, < 3.0)
59
- rubocop-ast (1.23.0)
60
+ rubocop-ast (1.24.0)
60
61
  parser (>= 3.1.1.0)
61
- rubocop-performance (1.14.3)
62
+ rubocop-performance (1.15.1)
62
63
  rubocop (>= 1.7.0, < 2.0)
63
64
  rubocop-ast (>= 0.4.0)
64
65
  ruby-progressbar (1.11.0)
@@ -72,9 +73,10 @@ GEM
72
73
  sorted_set (1.0.3)
73
74
  rbtree
74
75
  set (~> 1.0)
75
- standard (1.16.1)
76
- rubocop (= 1.35.1)
77
- rubocop-performance (= 1.14.3)
76
+ standard (1.20.0)
77
+ language_server-protocol (~> 3.17.0.2)
78
+ rubocop (= 1.40.0)
79
+ rubocop-performance (= 1.15.1)
78
80
  timers (4.3.5)
79
81
  unicode-display_width (2.3.0)
80
82
  uuidtools (2.2.0)
@@ -91,7 +93,7 @@ DEPENDENCIES
91
93
  rake (~> 13.0)
92
94
  rspec (~> 3.11)
93
95
  simplecov (~> 0.21)
94
- standard (~> 1.16)
96
+ standard (~> 1.20)
95
97
 
96
98
  BUNDLED WITH
97
- 2.3.19
99
+ 2.3.26
data/README.md CHANGED
@@ -19,6 +19,7 @@ Processor2 is using Bunny http://rubybunny.info a feature complete RabbitMQ Clie
19
19
 
20
20
  Currently supported and tested ruby versions are:
21
21
 
22
+ - 3.2
22
23
  - 3.1
23
24
  - 3.0
24
25
  - 2.7
@@ -180,6 +181,46 @@ Processor2 symbolizes keys and sub-keys from configuration files automatically.
180
181
  database['name']['subname'] # => "value"
181
182
  ```
182
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
+
183
224
  ## Development
184
225
 
185
226
  ```
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ["lib"]
24
24
 
25
25
  spec.add_dependency "celluloid", "~> 0.18"
26
- spec.add_dependency "bunny", "~> 2.19"
26
+ spec.add_dependency "bunny", "~> 2.20"
27
27
  spec.add_dependency "eventhub-components", "~> 0.2"
28
28
  spec.add_dependency "uuidtools", "~> 2.1"
29
29
 
@@ -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.16"
34
+ spec.add_development_dependency "standard", "~> 1.20"
35
35
  end
@@ -79,12 +79,30 @@ 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)
85
103
  return if data.nil?
86
104
  merger = proc do |_, v1, v2|
87
- v1.is_a?(Hash) && v2.is_a?(Hash) ? v1.merge(v2, &merger) : v2
105
+ (v1.is_a?(Hash) && v2.is_a?(Hash)) ? v1.merge(v2, &merger) : v2
88
106
  end
89
107
  target.merge! data, &merger
90
108
  end
@@ -1,7 +1,7 @@
1
1
  # EventHub module
2
2
  module EventHub
3
3
  def self.logger
4
- unless @logger
4
+ unless defined?(@logger)
5
5
  @logger = ::EventHub::Components::MultiLogger.new
6
6
  @logger.add_device(Logger.new($stdout))
7
7
  @logger.add_device(
@@ -1,3 +1,3 @@
1
1
  module EventHub
2
- VERSION = "1.15.0".freeze
2
+ VERSION = "1.17.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.15.0
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-10-28 00:00:00.000000000 Z
11
+ date: 2022-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.19'
33
+ version: '2.20'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.19'
40
+ version: '2.20'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: eventhub-components
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '1.16'
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.16'
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
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  - !ruby/object:Gem::Version
207
207
  version: '0'
208
208
  requirements: []
209
- rubygems_version: 3.3.7
209
+ rubygems_version: 3.3.26
210
210
  signing_key:
211
211
  specification_version: 4
212
212
  summary: Next generation gem to build ruby based eventhub processor