eac_tools 0.70.1 → 0.73.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +31 -31
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +3 -3
- data/sub/avm/lib/avm/applications/base.rb +1 -0
- data/sub/avm/lib/avm/registry/applications.rb +7 -0
- data/sub/avm/lib/avm/registry/config_objects.rb +18 -0
- data/sub/avm/lib/avm/registry.rb +3 -2
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm-tools/avm-tools.gemspec +3 -3
- data/sub/avm-tools/lib/avm/tools/runner/applications/list.rb +31 -0
- data/sub/avm-tools/lib/avm/tools/runner/applications.rb +16 -0
- data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
- data/sub/eac_config/eac_config.gemspec +2 -2
- data/sub/eac_config/lib/eac_config/entries.rb +35 -0
- data/sub/eac_config/lib/eac_config/entry_path.rb +27 -0
- data/sub/eac_config/lib/eac_config/envvars_node.rb +6 -0
- data/sub/eac_config/lib/eac_config/node.rb +11 -3
- data/sub/eac_config/lib/eac_config/node_entry.rb +1 -0
- data/sub/eac_config/lib/eac_config/node_uri/instanciate_single.rb +29 -0
- data/sub/eac_config/lib/eac_config/node_uri.rb +15 -8
- data/sub/eac_config/lib/eac_config/version.rb +1 -1
- data/sub/eac_config/lib/eac_config/yaml_file_node/self_entries.rb +72 -0
- data/sub/eac_config/lib/eac_config/yaml_file_node.rb +3 -0
- data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec.rb +62 -26
- data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1.yaml +5 -1
- data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_1.yaml +2 -0
- data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2/storage1_2_1.yaml +2 -0
- data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2.yaml +6 -0
- data/sub/eac_envs-http/eac_envs-http.gemspec +3 -3
- data/sub/eac_envs-http/lib/eac_envs/http/response/body.rb +5 -0
- data/sub/eac_envs-http/lib/eac_envs/http/version.rb +1 -1
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/get.target.yaml +1 -1
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/get_with_auth.target.yaml +1 -1
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/post_array_body.target.yaml +1 -1
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/post_string_body.target.yaml +1 -1
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/put_hash_body.target.yaml +1 -1
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/put_with_file.target.yaml +1 -1
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/root.target.yaml +1 -1
- data/sub/eac_envs-http/spec/spec_helper/request_builder.rb +1 -0
- data/sub/eac_rest/eac_rest.gemspec +2 -2
- data/sub/eac_rest/lib/eac_rest/api.rb +1 -1
- data/sub/eac_rest/lib/eac_rest/version.rb +1 -1
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/get.target.yaml +1 -1
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/get_with_auth.target.yaml +1 -1
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/post_array_body.target.yaml +1 -1
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/post_string_body.target.yaml +1 -1
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/put_hash_body.target.yaml +1 -1
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/put_with_file.target.yaml +1 -1
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/root.target.yaml +1 -1
- data/sub/eac_rest/spec/spec_helper/request_builder.rb +2 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/acts_as_instance_method.rb +34 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb +0 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb +7 -15
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/acts_as_instance_method.rb +10 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/wildcards.rb +26 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/wildcards_spec.rb +27 -0
- metadata +18 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3741d3890696e7b076cffae0313ed3ad82d5fc68fe41ba2ae64d75cd3a1a474e
|
4
|
+
data.tar.gz: 6685e1624bb09bbebfdc04b5d05046cd24106c25c336af3117936ec57aa48947
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69304f63883050fd2811ef4762a96e8a8fee1091ba1cd7cc768f93c70075a27e89fc49c800b89dfa40683e26e02a006a123b8ad72e42ea7813ab816e1d0702ec
|
7
|
+
data.tar.gz: a03de22b8a063b57beaab4d7862e2cdbf84842b429afa6f7fdbfb6d60414f006b0cc8b55c260c41d4309f0c428c4a6ecc868526560ddc299ba53ea885c2ef8c6
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
eac_tools (0.
|
5
|
-
avm (~> 0.
|
4
|
+
eac_tools (0.73.0)
|
5
|
+
avm (~> 0.79)
|
6
6
|
avm-eac_asciidoctor_base0 (~> 0.19)
|
7
7
|
avm-eac_generic_base0 (~> 0.12)
|
8
8
|
avm-eac_latex_base0 (~> 0.3, >= 0.3.1)
|
@@ -17,8 +17,8 @@ PATH
|
|
17
17
|
avm-eac_webapp_base0 (~> 0.18, >= 0.18.1)
|
18
18
|
avm-eac_wordpress_base0 (~> 0.3, >= 0.3.1)
|
19
19
|
avm-git (~> 0.13, >= 0.13.3)
|
20
|
-
avm-tools (~> 0.
|
21
|
-
eac_ruby_utils (~> 0.
|
20
|
+
avm-tools (~> 0.153)
|
21
|
+
eac_ruby_utils (~> 0.119)
|
22
22
|
|
23
23
|
PATH
|
24
24
|
remote: sub/avm-eac_asciidoctor_base0
|
@@ -163,11 +163,11 @@ PATH
|
|
163
163
|
PATH
|
164
164
|
remote: sub/avm-tools
|
165
165
|
specs:
|
166
|
-
avm-tools (0.
|
167
|
-
aranha-parsers (~> 0.
|
168
|
-
avm (~> 0.
|
166
|
+
avm-tools (0.153.0)
|
167
|
+
aranha-parsers (~> 0.21)
|
168
|
+
avm (~> 0.79)
|
169
169
|
avm-eac_ruby_base1 (~> 0.30, >= 0.30.3)
|
170
|
-
avm-eac_ubuntu_base0 (~> 0.
|
170
|
+
avm-eac_ubuntu_base0 (~> 0.5)
|
171
171
|
avm-files (~> 0.6, >= 0.6.2)
|
172
172
|
avm-git (~> 0.13, >= 0.13.3)
|
173
173
|
clipboard (~> 1.3, >= 1.3.6)
|
@@ -181,14 +181,14 @@ PATH
|
|
181
181
|
PATH
|
182
182
|
remote: sub/avm
|
183
183
|
specs:
|
184
|
-
avm (0.
|
185
|
-
aranha-parsers (~> 0.
|
184
|
+
avm (0.79.0)
|
185
|
+
aranha-parsers (~> 0.21)
|
186
186
|
eac_cli (~> 0.35, >= 0.35.1)
|
187
|
-
eac_config (~> 0.
|
187
|
+
eac_config (~> 0.14)
|
188
188
|
eac_docker (~> 0.7)
|
189
189
|
eac_fs (~> 0.16)
|
190
190
|
eac_git (~> 0.14, >= 0.14.1)
|
191
|
-
eac_ruby_utils (~> 0.
|
191
|
+
eac_ruby_utils (~> 0.119)
|
192
192
|
eac_templates (~> 0.5)
|
193
193
|
filesize (~> 0.2)
|
194
194
|
htmlbeautifier (~> 1.4, >= 1.4.2)
|
@@ -205,9 +205,9 @@ PATH
|
|
205
205
|
PATH
|
206
206
|
remote: sub/eac_config
|
207
207
|
specs:
|
208
|
-
eac_config (0.
|
209
|
-
addressable (~> 2.8, >= 2.8.
|
210
|
-
eac_ruby_utils (~> 0.
|
208
|
+
eac_config (0.14.0)
|
209
|
+
addressable (~> 2.8, >= 2.8.4)
|
210
|
+
eac_ruby_utils (~> 0.119)
|
211
211
|
|
212
212
|
PATH
|
213
213
|
remote: sub/eac_docker
|
@@ -219,14 +219,14 @@ PATH
|
|
219
219
|
PATH
|
220
220
|
remote: sub/eac_envs-http
|
221
221
|
specs:
|
222
|
-
eac_envs-http (0.
|
222
|
+
eac_envs-http (0.4.0)
|
223
223
|
eac_fs (~> 0.16)
|
224
|
-
eac_ruby_utils (~> 0.
|
225
|
-
faraday (~> 2.7, >= 2.7.
|
224
|
+
eac_ruby_utils (~> 0.117, >= 0.117.1)
|
225
|
+
faraday (~> 2.7, >= 2.7.6)
|
226
226
|
faraday-follow_redirects (~> 0.3)
|
227
227
|
faraday-gzip (~> 0.1)
|
228
228
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
229
|
-
faraday-retry (~> 2.
|
229
|
+
faraday-retry (~> 2.2)
|
230
230
|
|
231
231
|
PATH
|
232
232
|
remote: sub/eac_fs
|
@@ -246,10 +246,10 @@ PATH
|
|
246
246
|
PATH
|
247
247
|
remote: sub/eac_rest
|
248
248
|
specs:
|
249
|
-
eac_rest (0.9.
|
250
|
-
eac_envs-http (~> 0.
|
249
|
+
eac_rest (0.9.1)
|
250
|
+
eac_envs-http (~> 0.4)
|
251
251
|
eac_fs (~> 0.16)
|
252
|
-
eac_ruby_utils (~> 0.
|
252
|
+
eac_ruby_utils (~> 0.117, >= 0.117.1)
|
253
253
|
|
254
254
|
PATH
|
255
255
|
remote: sub/eac_ruby_base0
|
@@ -263,7 +263,7 @@ PATH
|
|
263
263
|
PATH
|
264
264
|
remote: sub/eac_ruby_utils
|
265
265
|
specs:
|
266
|
-
eac_ruby_utils (0.
|
266
|
+
eac_ruby_utils (0.119.0)
|
267
267
|
activesupport (>= 4, < 7)
|
268
268
|
addressable (~> 2.8, >= 2.8.4)
|
269
269
|
bundler
|
@@ -280,7 +280,7 @@ PATH
|
|
280
280
|
GEM
|
281
281
|
remote: https://rubygems.org/
|
282
282
|
specs:
|
283
|
-
activesupport (6.1.7.
|
283
|
+
activesupport (6.1.7.4)
|
284
284
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
285
285
|
i18n (>= 1.6, < 2)
|
286
286
|
minitest (>= 5.1)
|
@@ -288,10 +288,10 @@ GEM
|
|
288
288
|
zeitwerk (~> 2.3)
|
289
289
|
addressable (2.8.4)
|
290
290
|
public_suffix (>= 2.0.2, < 6.0)
|
291
|
-
aranha-parsers (0.
|
291
|
+
aranha-parsers (0.21.0)
|
292
292
|
activesupport (>= 4.0.0)
|
293
293
|
addressable (~> 2.8, >= 2.8.4)
|
294
|
-
eac_envs-http (~> 0.
|
294
|
+
eac_envs-http (~> 0.4)
|
295
295
|
eac_ruby_utils (~> 0.117, >= 0.117.1)
|
296
296
|
nokogiri (~> 1.15, >= 1.15.2)
|
297
297
|
ofx-parser (~> 1.1)
|
@@ -310,7 +310,7 @@ GEM
|
|
310
310
|
rubocop (~> 0.80.1)
|
311
311
|
rubocop-rails (~> 2.4.2)
|
312
312
|
rubocop-rspec (~> 1.38.1)
|
313
|
-
faraday (2.7.
|
313
|
+
faraday (2.7.7)
|
314
314
|
faraday-net_http (>= 2.0, < 3.1)
|
315
315
|
ruby2_keywords (>= 0.0.4)
|
316
316
|
faraday-follow_redirects (0.3.0)
|
@@ -333,7 +333,7 @@ GEM
|
|
333
333
|
concurrent-ruby (~> 1.0)
|
334
334
|
jaro_winkler (1.5.6)
|
335
335
|
minitar (0.9)
|
336
|
-
minitest (5.18.
|
336
|
+
minitest (5.18.1)
|
337
337
|
multipart-post (2.3.0)
|
338
338
|
net-ssh (4.2.0)
|
339
339
|
nokogiri (1.15.2-x86_64-linux)
|
@@ -348,8 +348,8 @@ GEM
|
|
348
348
|
racc
|
349
349
|
parslet (2.0.0)
|
350
350
|
public_suffix (5.0.1)
|
351
|
-
racc (1.7.
|
352
|
-
rack (3.0.
|
351
|
+
racc (1.7.1)
|
352
|
+
rack (3.0.8)
|
353
353
|
rainbow (3.1.1)
|
354
354
|
rchardet (1.8.0)
|
355
355
|
rexml (3.2.5)
|
@@ -366,7 +366,7 @@ GEM
|
|
366
366
|
rspec-mocks (3.12.5)
|
367
367
|
diff-lcs (>= 1.2.0, < 2.0)
|
368
368
|
rspec-support (~> 3.12.0)
|
369
|
-
rspec-support (3.12.
|
369
|
+
rspec-support (3.12.1)
|
370
370
|
rubocop (0.80.1)
|
371
371
|
jaro_winkler (~> 1.5.1)
|
372
372
|
parallel (~> 1.10)
|
data/lib/eac_tools/version.rb
CHANGED
data/sub/avm/avm.gemspec
CHANGED
@@ -12,13 +12,13 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'aranha-parsers', '~> 0.
|
15
|
+
s.add_dependency 'aranha-parsers', '~> 0.21'
|
16
16
|
s.add_dependency 'eac_cli', '~> 0.35', '>= 0.35.1'
|
17
|
-
s.add_dependency 'eac_config', '~> 0.
|
17
|
+
s.add_dependency 'eac_config', '~> 0.14'
|
18
18
|
s.add_dependency 'eac_docker', '~> 0.7'
|
19
19
|
s.add_dependency 'eac_fs', '~> 0.16'
|
20
20
|
s.add_dependency 'eac_git', '~> 0.14', '>= 0.14.1'
|
21
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
21
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.119'
|
22
22
|
s.add_dependency 'eac_templates', '~> 0.5'
|
23
23
|
s.add_dependency 'filesize', '~> 0.2'
|
24
24
|
s.add_dependency 'htmlbeautifier', '~> 1.4', '>= 1.4.2'
|
@@ -10,6 +10,7 @@ module Avm
|
|
10
10
|
|
11
11
|
# @return [Array<Avm::Applications::Base>]
|
12
12
|
def available
|
13
|
+
load_config
|
13
14
|
detected.values
|
14
15
|
end
|
15
16
|
|
@@ -26,6 +27,12 @@ module Avm
|
|
26
27
|
def detected
|
27
28
|
@detected ||= {}
|
28
29
|
end
|
30
|
+
|
31
|
+
def load_config
|
32
|
+
::Avm::Registry.config_objects.available.each do |id, type|
|
33
|
+
detect(id) if type == ::Avm::Applications::Base::AVM_TYPE
|
34
|
+
end
|
35
|
+
end
|
29
36
|
end
|
30
37
|
end
|
31
38
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/applications/base'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Registry
|
8
|
+
class ConfigObjects
|
9
|
+
def initialize(*args); end
|
10
|
+
|
11
|
+
# @return [Array<Avm::Applications::Base>]
|
12
|
+
def available
|
13
|
+
::EacConfig::Node.context.current.entries('*.avm_type').node_entries
|
14
|
+
.map { |ne| [ne.path.first, ne.value] }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/sub/avm/lib/avm/registry.rb
CHANGED
@@ -7,8 +7,9 @@ module Avm
|
|
7
7
|
module Registry
|
8
8
|
require_sub __FILE__
|
9
9
|
enable_listable
|
10
|
-
lists.add_symbol :category, :applications, :application_stereotypes, :
|
11
|
-
:
|
10
|
+
lists.add_symbol :category, :applications, :application_stereotypes, :config_objects,
|
11
|
+
:file_formats, :instances, :launcher_stereotypes, :runners, :scms,
|
12
|
+
:source_generators, :sources
|
12
13
|
|
13
14
|
class << self
|
14
15
|
enable_simple_cache
|
data/sub/avm/lib/avm/version.rb
CHANGED
@@ -14,10 +14,10 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.bindir = 'exe'
|
15
15
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
16
16
|
|
17
|
-
s.add_dependency 'aranha-parsers', '~> 0.
|
18
|
-
s.add_dependency 'avm', '~> 0.
|
17
|
+
s.add_dependency 'aranha-parsers', '~> 0.21'
|
18
|
+
s.add_dependency 'avm', '~> 0.79'
|
19
19
|
s.add_dependency 'avm-eac_ruby_base1', '~> 0.30', '>= 0.30.3'
|
20
|
-
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.
|
20
|
+
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.5'
|
21
21
|
s.add_dependency 'avm-files', '~> 0.6', '>= 0.6.2'
|
22
22
|
s.add_dependency 'avm-git', '~> 0.13', '>= 0.13.3'
|
23
23
|
s.add_dependency 'clipboard', '~> 1.3', '>= 1.3.6'
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/tools/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Tools
|
7
|
+
class Runner
|
8
|
+
class Applications
|
9
|
+
class List
|
10
|
+
runner_with :help, :output
|
11
|
+
|
12
|
+
def run
|
13
|
+
infov 'Found', applications.count
|
14
|
+
run_output
|
15
|
+
end
|
16
|
+
|
17
|
+
def output_content
|
18
|
+
applications.map { |s| "#{s}\n" }.join
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def applications_uncached
|
24
|
+
::Avm::Registry.applications.available
|
25
|
+
.sort_by { |s| [s.id] }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'addressable', '~> 2.8', '>= 2.8.
|
16
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
15
|
+
s.add_dependency 'addressable', '~> 2.8', '>= 2.8.4'
|
16
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.119'
|
17
17
|
|
18
18
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
19
19
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_config/entry_path'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module EacConfig
|
7
|
+
class Entries
|
8
|
+
require_sub __FILE__
|
9
|
+
enable_simple_cache
|
10
|
+
common_constructor :root_node, :path do
|
11
|
+
self.path = ::EacConfig::EntryPath.assert(path)
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
"#{self.class}[RootNode: #{root_node}, Path: #{path}]"
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
# @return [Array<EacConfig::Entries>]
|
21
|
+
def node_entries_uncached
|
22
|
+
node_entries_from_root + node_entries_from_load_path
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [Array<EacConfig::Entries>]
|
26
|
+
def node_entries_from_load_path_uncached
|
27
|
+
root_node.recursive_loaded_nodes.flat_map { |loaded_node| loaded_node.self_entries(path) }
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [Array<EacConfig::Entries>]
|
31
|
+
def node_entries_from_root_uncached
|
32
|
+
root_node.self_entries(path)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -58,5 +58,32 @@ module EacConfig
|
|
58
58
|
def to_string
|
59
59
|
parts.join(PART_SEPARATOR)
|
60
60
|
end
|
61
|
+
|
62
|
+
# @param part [String]
|
63
|
+
# @return [EacConfig::EntryPath]
|
64
|
+
def with_first(part)
|
65
|
+
new_parts = parts.dup
|
66
|
+
new_parts.unshift(part)
|
67
|
+
self.class.new(new_parts)
|
68
|
+
end
|
69
|
+
|
70
|
+
# @return [EacConfig::EntryPath]
|
71
|
+
def without_first
|
72
|
+
new_parts = parts.dup
|
73
|
+
new_parts.shift
|
74
|
+
self.class.new(new_parts)
|
75
|
+
end
|
76
|
+
|
77
|
+
# @return [EacConfig::EntryPath]
|
78
|
+
def with_last(part)
|
79
|
+
self.class.new(parts + [part])
|
80
|
+
end
|
81
|
+
|
82
|
+
# @return [EacConfig::EntryPath]
|
83
|
+
def without_last
|
84
|
+
new_parts = parts.dup
|
85
|
+
new_parts.pop
|
86
|
+
self.class.new(new_parts)
|
87
|
+
end
|
61
88
|
end
|
62
89
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_config/entries'
|
3
4
|
require 'eac_config/entry'
|
4
5
|
require 'eac_config/entry_path'
|
5
6
|
require 'eac_config/load_path'
|
@@ -20,10 +21,15 @@ module EacConfig
|
|
20
21
|
attr_accessor :write_node
|
21
22
|
|
22
23
|
common_concern do
|
23
|
-
|
24
|
+
acts_as_abstract :self_entries
|
24
25
|
include ::Comparable
|
25
26
|
end
|
26
27
|
|
28
|
+
# @return [Array<EacConfig::Entries>]
|
29
|
+
def entries(path)
|
30
|
+
::EacConfig::Entries.new(self, path)
|
31
|
+
end
|
32
|
+
|
27
33
|
def entry(path)
|
28
34
|
::EacConfig::Entry.new(self, path)
|
29
35
|
end
|
@@ -50,7 +56,7 @@ module EacConfig
|
|
50
56
|
|
51
57
|
# @return [Array<EacConfig::Node>]
|
52
58
|
def self_loaded_nodes
|
53
|
-
load_path.paths.
|
59
|
+
load_path.paths.flat_map { |node_path| load_nodes(node_path) }
|
54
60
|
end
|
55
61
|
|
56
62
|
# @return [Array<EacConfig::Node>]
|
@@ -66,7 +72,9 @@ module EacConfig
|
|
66
72
|
|
67
73
|
private
|
68
74
|
|
69
|
-
|
75
|
+
# @param node_path [String]
|
76
|
+
# @return [Array<EacConfig::Node>]
|
77
|
+
def load_nodes(node_path)
|
70
78
|
::EacConfig::NodeUri.new(node_path, url).instanciate
|
71
79
|
end
|
72
80
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacConfig
|
4
|
+
class NodeUri
|
5
|
+
class InstanciateSingle
|
6
|
+
acts_as_instance_method
|
7
|
+
enable_simple_cache
|
8
|
+
common_constructor :node_uri, :instance_uri
|
9
|
+
|
10
|
+
# @return [Array<Class>]
|
11
|
+
def available_node_classes
|
12
|
+
require 'eac_config/envvars_node'
|
13
|
+
require 'eac_config/yaml_file_node'
|
14
|
+
[::EacConfig::EnvvarsNode, ::EacConfig::YamlFileNode]
|
15
|
+
end
|
16
|
+
|
17
|
+
# @return [EacConfig::Node]
|
18
|
+
def result
|
19
|
+
available_node_classes.lazy.map { |k| k.from_uri(self) }.find(&:present?) ||
|
20
|
+
raise("No class mapped for \"#{to_addressable}\"")
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [Addressable::URI]
|
24
|
+
def to_addressable
|
25
|
+
instance_uri.to_uri
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -5,21 +5,26 @@ module EacConfig
|
|
5
5
|
enable_simple_cache
|
6
6
|
common_constructor :source, :loader_uri, default: [nil]
|
7
7
|
|
8
|
-
|
9
|
-
require 'eac_config/envvars_node'
|
10
|
-
require 'eac_config/yaml_file_node'
|
11
|
-
[::EacConfig::EnvvarsNode, ::EacConfig::YamlFileNode]
|
12
|
-
end
|
13
|
-
|
8
|
+
# @return [Array<EacConfig::Node>]
|
14
9
|
def instanciate
|
15
|
-
|
16
|
-
raise("No class mapped for \"#{to_addressable}\"")
|
10
|
+
instance_uris.map { |uri| instanciate_single(uri) }
|
17
11
|
end
|
18
12
|
|
19
13
|
delegate :to_s, to: :to_addressable
|
20
14
|
|
21
15
|
private
|
22
16
|
|
17
|
+
# @return [Array<Addressable::URI>]
|
18
|
+
def instance_uris
|
19
|
+
if to_addressable.scheme == 'file'
|
20
|
+
::Pathname.glob(to_addressable.path).map do |found_path|
|
21
|
+
::Addressable::URI.new(scheme: 'file', path: found_path.to_path)
|
22
|
+
end
|
23
|
+
else
|
24
|
+
[to_addressable]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
23
28
|
def to_addressable_uncached
|
24
29
|
r = ::Addressable::URI.parse(source)
|
25
30
|
path = r.path.to_pathname
|
@@ -34,5 +39,7 @@ module EacConfig
|
|
34
39
|
|
35
40
|
r.to_pathname.parent
|
36
41
|
end
|
42
|
+
|
43
|
+
require_sub __FILE__, require_mode: :kernel
|
37
44
|
end
|
38
45
|
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_config/entry_path'
|
4
|
+
require 'eac_config/yaml_file_node/entry'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
require 'eac_ruby_utils/wildcards'
|
7
|
+
|
8
|
+
module EacConfig
|
9
|
+
class YamlFileNode
|
10
|
+
class SelfEntries
|
11
|
+
acts_as_instance_method
|
12
|
+
common_constructor :node, :path do
|
13
|
+
self.path = ::EacConfig::EntryPath.assert(path)
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [Array<EacConfig::YamlFileNode>]
|
17
|
+
def result
|
18
|
+
head_node.result.map { |found_path| ::EacConfig::YamlFileNode::Entry.new(node, found_path) }
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
# @return [DataNode]
|
24
|
+
def head_node
|
25
|
+
DataNode.new(node.data, ::EacConfig::EntryPath.new, path)
|
26
|
+
end
|
27
|
+
|
28
|
+
class DataNode
|
29
|
+
common_constructor :data_node, :path_from, :path_to do
|
30
|
+
self.data_node = data_node.stringify_keys if data_node.is_a?(::Hash)
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [DataNode]
|
34
|
+
def child(child_key)
|
35
|
+
self.class.new(data_node.fetch(child_key), path_from.with_last(child_key),
|
36
|
+
path_to.without_first)
|
37
|
+
end
|
38
|
+
|
39
|
+
def children
|
40
|
+
return [] unless data_node.is_a?(::Hash)
|
41
|
+
|
42
|
+
data_node.keys.select { |k| key_matcher.match?(k) }.map { |k| child(k) }
|
43
|
+
end
|
44
|
+
|
45
|
+
# @return [Symbol]
|
46
|
+
def key
|
47
|
+
path_to.first
|
48
|
+
end
|
49
|
+
|
50
|
+
# @return [EacRubyUtils::Wildcards]
|
51
|
+
def key_matcher
|
52
|
+
@key_matcher ||= ::EacRubyUtils::Wildcards.new(key)
|
53
|
+
end
|
54
|
+
|
55
|
+
# @return [Array<EacConfig::EntryPath>]
|
56
|
+
def result
|
57
|
+
(path_to.empty? ? result_from_self : result_from_children)
|
58
|
+
end
|
59
|
+
|
60
|
+
# @return [Array<EacConfig::EntryPath>]
|
61
|
+
def result_from_self
|
62
|
+
[path_from]
|
63
|
+
end
|
64
|
+
|
65
|
+
# @return [Array<EacConfig::EntryPath>]
|
66
|
+
def result_from_children
|
67
|
+
children.flat_map(&:result)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -20,6 +20,7 @@ module EacConfig
|
|
20
20
|
common_constructor :path do
|
21
21
|
self.path = path.to_pathname
|
22
22
|
end
|
23
|
+
compare_by :path
|
23
24
|
|
24
25
|
def persist_data(new_data)
|
25
26
|
path.parent.mkpath
|
@@ -47,5 +48,7 @@ module EacConfig
|
|
47
48
|
|
48
49
|
r.is_a?(::Hash) ? r : {}
|
49
50
|
end
|
51
|
+
|
52
|
+
require_sub __FILE__, require_mode: :kernel
|
50
53
|
end
|
51
54
|
end
|