eac_tools 0.82.0 → 0.83.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.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +45 -40
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/avm.gemspec +4 -3
  5. data/sub/avm/lib/avm/data/rotate.rb +1 -1
  6. data/sub/avm/lib/avm/launcher/instances/base/publishing.rb +1 -1
  7. data/sub/avm/lib/avm/registry/from_gems.rb +2 -2
  8. data/sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb +0 -1
  9. data/sub/avm/lib/avm/source_generators/base.rb +1 -0
  10. data/sub/avm/lib/avm/source_generators/runner.rb +6 -0
  11. data/sub/avm/lib/avm/sources/tests/builder.rb +1 -1
  12. data/sub/avm/lib/avm/version.rb +1 -1
  13. data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/avm-tools_stub/avm-tools.gemspec +1 -0
  14. data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/ruby_gem_stub/ruby_gem_stub.gemspec +1 -0
  15. data/sub/avm-eac_asciidoctor_base0/Gemfile +2 -2
  16. data/sub/avm-eac_asciidoctor_base0/avm-eac_asciidoctor_base0.gemspec +6 -5
  17. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb +5 -3
  18. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document.rb +2 -2
  19. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb +2 -2
  20. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base.rb +1 -3
  21. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
  22. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/file_formats/base_spec.rb +1 -1
  23. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build/document_spec.rb +18 -18
  24. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build/document_spec_files/pre_processed_root_body.adoc +1 -0
  25. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec.rb +3 -3
  26. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec.rb +1 -1
  27. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/sources/base_spec.rb +2 -2
  28. data/sub/avm-eac_asciidoctor_base0/spec/rubocop_spec.rb +1 -1
  29. data/sub/avm-eac_asciidoctor_base0/spec/spec_helper/eac_asciidoctor_base0_stubs.rb +1 -1
  30. data/sub/avm-eac_asciidoctor_base0/spec/spec_helper.rb +3 -3
  31. data/sub/avm-eac_python_base0/Gemfile +2 -2
  32. data/sub/avm-eac_python_base0/avm-eac_python_base0.gemspec +5 -4
  33. data/sub/avm-eac_python_base0/lib/avm/eac_python_base0/executables.rb +1 -1
  34. data/sub/avm-eac_python_base0/lib/avm/eac_python_base0/version.rb +1 -1
  35. data/sub/avm-eac_python_base0/spec/lib/avm/eac_python_base0/file_formats/base_spec.rb +1 -1
  36. data/sub/avm-eac_python_base0/spec/lib/avm/eac_python_base0/file_formats/base_spec_files/python_code.source +1 -1
  37. data/sub/avm-eac_python_base0/spec/lib/avm/eac_python_base0/file_formats/base_spec_files/python_code.target +1 -1
  38. data/sub/avm-eac_python_base0/spec/rubocop_spec.rb +1 -1
  39. data/sub/avm-eac_python_base0/spec/spec_helper.rb +1 -1
  40. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +2 -2
  41. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/rubocop_command.rb +2 -1
  42. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  43. metadata +14 -144
  44. data/sub/eac_cli/Gemfile +0 -8
  45. data/sub/eac_cli/eac_cli.gemspec +0 -22
  46. data/sub/eac_cli/lib/eac_cli/config/entry/options.rb +0 -58
  47. data/sub/eac_cli/lib/eac_cli/config/entry/undefined.rb +0 -31
  48. data/sub/eac_cli/lib/eac_cli/config/entry.rb +0 -60
  49. data/sub/eac_cli/lib/eac_cli/config.rb +0 -17
  50. data/sub/eac_cli/lib/eac_cli/core_ext.rb +0 -6
  51. data/sub/eac_cli/lib/eac_cli/default_runner.rb +0 -14
  52. data/sub/eac_cli/lib/eac_cli/definition/alternative.rb +0 -105
  53. data/sub/eac_cli/lib/eac_cli/definition/argument_option.rb +0 -21
  54. data/sub/eac_cli/lib/eac_cli/definition/boolean_option.rb +0 -27
  55. data/sub/eac_cli/lib/eac_cli/definition/error.rb +0 -8
  56. data/sub/eac_cli/lib/eac_cli/definition/option/initialize_args_parser.rb +0 -48
  57. data/sub/eac_cli/lib/eac_cli/definition/option.rb +0 -73
  58. data/sub/eac_cli/lib/eac_cli/definition/option_or_positional.rb +0 -43
  59. data/sub/eac_cli/lib/eac_cli/definition/positional.rb +0 -53
  60. data/sub/eac_cli/lib/eac_cli/definition.rb +0 -109
  61. data/sub/eac_cli/lib/eac_cli/enum.rb +0 -45
  62. data/sub/eac_cli/lib/eac_cli/old_configs/entry_reader.rb +0 -80
  63. data/sub/eac_cli/lib/eac_cli/old_configs/password_entry_reader.rb +0 -16
  64. data/sub/eac_cli/lib/eac_cli/old_configs/read_entry_options.rb +0 -44
  65. data/sub/eac_cli/lib/eac_cli/old_configs/store_passwords_entry_reader.rb +0 -25
  66. data/sub/eac_cli/lib/eac_cli/old_configs.rb +0 -35
  67. data/sub/eac_cli/lib/eac_cli/parser/alternative/any_options.rb +0 -19
  68. data/sub/eac_cli/lib/eac_cli/parser/alternative/argv.rb +0 -19
  69. data/sub/eac_cli/lib/eac_cli/parser/alternative/double_dash.rb +0 -24
  70. data/sub/eac_cli/lib/eac_cli/parser/alternative/long_options.rb +0 -37
  71. data/sub/eac_cli/lib/eac_cli/parser/alternative/option_argument.rb +0 -29
  72. data/sub/eac_cli/lib/eac_cli/parser/alternative/options.rb +0 -29
  73. data/sub/eac_cli/lib/eac_cli/parser/alternative/positionals.rb +0 -30
  74. data/sub/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +0 -54
  75. data/sub/eac_cli/lib/eac_cli/parser/alternative.rb +0 -103
  76. data/sub/eac_cli/lib/eac_cli/parser/collector.rb +0 -55
  77. data/sub/eac_cli/lib/eac_cli/parser/error.rb +0 -15
  78. data/sub/eac_cli/lib/eac_cli/parser.rb +0 -34
  79. data/sub/eac_cli/lib/eac_cli/patches/object/runner_with.rb +0 -26
  80. data/sub/eac_cli/lib/eac_cli/patches/object.rb +0 -5
  81. data/sub/eac_cli/lib/eac_cli/patches.rb +0 -4
  82. data/sub/eac_cli/lib/eac_cli/rspec/setup.rb +0 -42
  83. data/sub/eac_cli/lib/eac_cli/rspec.rb +0 -9
  84. data/sub/eac_cli/lib/eac_cli/runner/after_class_methods.rb +0 -38
  85. data/sub/eac_cli/lib/eac_cli/runner/class_runner.rb +0 -36
  86. data/sub/eac_cli/lib/eac_cli/runner/context.rb +0 -63
  87. data/sub/eac_cli/lib/eac_cli/runner/context_responders/base.rb +0 -24
  88. data/sub/eac_cli/lib/eac_cli/runner/context_responders/parent.rb +0 -27
  89. data/sub/eac_cli/lib/eac_cli/runner/context_responders/runner.rb +0 -20
  90. data/sub/eac_cli/lib/eac_cli/runner/context_responders/runner_missing_method.rb +0 -32
  91. data/sub/eac_cli/lib/eac_cli/runner/context_responders/set.rb +0 -44
  92. data/sub/eac_cli/lib/eac_cli/runner/context_responders.rb +0 -11
  93. data/sub/eac_cli/lib/eac_cli/runner/exit.rb +0 -14
  94. data/sub/eac_cli/lib/eac_cli/runner/for_context.rb +0 -40
  95. data/sub/eac_cli/lib/eac_cli/runner/instance_methods.rb +0 -45
  96. data/sub/eac_cli/lib/eac_cli/runner.rb +0 -50
  97. data/sub/eac_cli/lib/eac_cli/runner_with/confirmation.rb +0 -44
  98. data/sub/eac_cli/lib/eac_cli/runner_with/help/builder/alternative.rb +0 -63
  99. data/sub/eac_cli/lib/eac_cli/runner_with/help/builder.rb +0 -81
  100. data/sub/eac_cli/lib/eac_cli/runner_with/help/layout.rb +0 -40
  101. data/sub/eac_cli/lib/eac_cli/runner_with/help.rb +0 -53
  102. data/sub/eac_cli/lib/eac_cli/runner_with/input.rb +0 -36
  103. data/sub/eac_cli/lib/eac_cli/runner_with/output.rb +0 -58
  104. data/sub/eac_cli/lib/eac_cli/runner_with/output_item/base_formatter.rb +0 -15
  105. data/sub/eac_cli/lib/eac_cli/runner_with/output_item/csv_formatter.rb +0 -23
  106. data/sub/eac_cli/lib/eac_cli/runner_with/output_item/yaml_formatter.rb +0 -18
  107. data/sub/eac_cli/lib/eac_cli/runner_with/output_item.rb +0 -42
  108. data/sub/eac_cli/lib/eac_cli/runner_with/output_list/base_formatter.rb +0 -30
  109. data/sub/eac_cli/lib/eac_cli/runner_with/output_list/csv_formatter.rb +0 -26
  110. data/sub/eac_cli/lib/eac_cli/runner_with/output_list/yaml_formatter.rb +0 -23
  111. data/sub/eac_cli/lib/eac_cli/runner_with/output_list.rb +0 -42
  112. data/sub/eac_cli/lib/eac_cli/runner_with/subcommands/definition_concern.rb +0 -10
  113. data/sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb +0 -129
  114. data/sub/eac_cli/lib/eac_cli/runner_with.rb +0 -9
  115. data/sub/eac_cli/lib/eac_cli/runner_with_set.rb +0 -56
  116. data/sub/eac_cli/lib/eac_cli/speaker/constants.rb +0 -13
  117. data/sub/eac_cli/lib/eac_cli/speaker/input_blocked.rb +0 -16
  118. data/sub/eac_cli/lib/eac_cli/speaker/input_requested.rb +0 -8
  119. data/sub/eac_cli/lib/eac_cli/speaker/list.rb +0 -61
  120. data/sub/eac_cli/lib/eac_cli/speaker/options.rb +0 -38
  121. data/sub/eac_cli/lib/eac_cli/speaker.rb +0 -127
  122. data/sub/eac_cli/lib/eac_cli/version.rb +0 -5
  123. data/sub/eac_cli/lib/eac_cli.rb +0 -7
  124. data/sub/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +0 -18
  125. data/sub/eac_cli/spec/lib/eac_cli/old_configs_spec.rb +0 -14
  126. data/sub/eac_cli/spec/lib/eac_cli/parser/alternative/subcommands_spec.rb +0 -58
  127. data/sub/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +0 -89
  128. data/sub/eac_cli/spec/lib/eac_cli/runner/for_context_spec.rb +0 -79
  129. data/sub/eac_cli/spec/lib/eac_cli/runner_spec.rb +0 -129
  130. data/sub/eac_cli/spec/lib/eac_cli/runner_with/confirmation_spec.rb +0 -42
  131. data/sub/eac_cli/spec/lib/eac_cli/runner_with/help/layout_spec.rb +0 -21
  132. data/sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +0 -51
  133. data/sub/eac_cli/spec/lib/eac_cli/runner_with/output_spec.rb +0 -81
  134. data/sub/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +0 -98
  135. data/sub/eac_cli/spec/lib/eac_cli/speaker_spec.rb +0 -32
  136. data/sub/eac_cli/spec/rubocop_spec.rb +0 -3
  137. data/sub/eac_cli/spec/spec_helper.rb +0 -4
  138. data/sub/eac_config/Gemfile +0 -8
  139. data/sub/eac_config/eac_config.gemspec +0 -19
  140. data/sub/eac_config/lib/eac_config/entries.rb +0 -35
  141. data/sub/eac_config/lib/eac_config/entry/not_found_error.rb +0 -13
  142. data/sub/eac_config/lib/eac_config/entry.rb +0 -64
  143. data/sub/eac_config/lib/eac_config/entry_path.rb +0 -89
  144. data/sub/eac_config/lib/eac_config/envvars_node/entry.rb +0 -54
  145. data/sub/eac_config/lib/eac_config/envvars_node.rb +0 -35
  146. data/sub/eac_config/lib/eac_config/load_nodes_search.rb +0 -39
  147. data/sub/eac_config/lib/eac_config/load_path.rb +0 -28
  148. data/sub/eac_config/lib/eac_config/node.rb +0 -81
  149. data/sub/eac_config/lib/eac_config/node_entry.rb +0 -28
  150. data/sub/eac_config/lib/eac_config/node_uri/instanciate_single.rb +0 -29
  151. data/sub/eac_config/lib/eac_config/node_uri.rb +0 -45
  152. data/sub/eac_config/lib/eac_config/old_configs/base.rb +0 -43
  153. data/sub/eac_config/lib/eac_config/old_configs/file.rb +0 -47
  154. data/sub/eac_config/lib/eac_config/old_configs.rb +0 -75
  155. data/sub/eac_config/lib/eac_config/paths_hash/entry_key_error.rb +0 -8
  156. data/sub/eac_config/lib/eac_config/paths_hash/node.rb +0 -67
  157. data/sub/eac_config/lib/eac_config/paths_hash/path_search.rb +0 -39
  158. data/sub/eac_config/lib/eac_config/paths_hash.rb +0 -63
  159. data/sub/eac_config/lib/eac_config/prefixed_path_node/entry.rb +0 -25
  160. data/sub/eac_config/lib/eac_config/prefixed_path_node.rb +0 -19
  161. data/sub/eac_config/lib/eac_config/rspec/setup.rb +0 -65
  162. data/sub/eac_config/lib/eac_config/rspec.rb +0 -9
  163. data/sub/eac_config/lib/eac_config/version.rb +0 -5
  164. data/sub/eac_config/lib/eac_config/yaml_file_node/entry.rb +0 -36
  165. data/sub/eac_config/lib/eac_config/yaml_file_node/self_entries.rb +0 -72
  166. data/sub/eac_config/lib/eac_config/yaml_file_node.rb +0 -54
  167. data/sub/eac_config/lib/eac_config.rb +0 -7
  168. data/sub/eac_config/spec/lib/eac_config/entry_path_spec.rb +0 -30
  169. data/sub/eac_config/spec/lib/eac_config/envvars_node/entry_spec.rb +0 -14
  170. data/sub/eac_config/spec/lib/eac_config/envvars_node_spec.rb +0 -51
  171. data/sub/eac_config/spec/lib/eac_config/old_configs_spec.rb +0 -46
  172. data/sub/eac_config/spec/lib/eac_config/paths_hash_spec.rb +0 -88
  173. data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec.rb +0 -88
  174. data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1.yaml +0 -10
  175. data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_1.yaml +0 -4
  176. data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2/storage1_2_1.yaml +0 -4
  177. data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2.yaml +0 -10
  178. data/sub/eac_config/spec/rubocop_spec.rb +0 -3
  179. data/sub/eac_config/spec/spec_helper.rb +0 -4
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/rspec/default_setup'
4
- EacRubyUtils::Rspec.default_setup_create(File.expand_path('..', __dir__))
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
6
-
7
- local_gemfile = ::File.join(::File.dirname(__FILE__), 'Gemfile.local')
8
- eval_gemfile local_gemfile if ::File.exist?(local_gemfile)
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- $LOAD_PATH.push File.expand_path('lib', __dir__)
4
-
5
- require 'eac_config/version'
6
-
7
- Gem::Specification.new do |s|
8
- s.name = 'eac_config'
9
- s.version = EacConfig::VERSION
10
- s.authors = ['Put here the authors']
11
- s.summary = 'Put here de description.'
12
-
13
- s.files = Dir['{lib}/**/*']
14
-
15
- s.add_dependency 'addressable', '~> 2.8', '>= 2.8.5'
16
- s.add_dependency 'eac_ruby_utils', '~> 0.119', '>= 0.119.2'
17
-
18
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
19
- end
@@ -1,35 +0,0 @@
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
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module EacConfig
6
- class Entry
7
- class NotFoundError < ::RuntimeError
8
- def initialize(entry)
9
- super("Entry #{entry} not found")
10
- end
11
- end
12
- end
13
- end
@@ -1,64 +0,0 @@
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 Entry
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 found?
15
- node_entry.if_present(false, &:found?)
16
- end
17
-
18
- def found_node
19
- node_entry.if_present(&:node)
20
- end
21
-
22
- def secret_value
23
- node_entry.if_present(&:secret_value)
24
- end
25
-
26
- def to_s
27
- "#{self.class}[RootNode: #{root_node}, Path: #{path}]"
28
- end
29
-
30
- def value
31
- node_entry.if_present(&:value)
32
- end
33
-
34
- def value!
35
- return value if found?
36
-
37
- raise ::EacConfig::Entry::NotFoundError, self
38
- end
39
-
40
- def value=(a_value)
41
- write_node.self_entry(path).value = a_value
42
- end
43
-
44
- def write_node
45
- root_node.write_node || root_node
46
- end
47
-
48
- private
49
-
50
- def node_entry_uncached
51
- node_entry_from_root || node_entry_from_load_path
52
- end
53
-
54
- def node_entry_from_load_path_uncached
55
- root_node.recursive_loaded_nodes.lazy.map { |loaded_node| loaded_node.self_entry(path) }
56
- .find(&:found?)
57
- end
58
-
59
- def node_entry_from_root_uncached
60
- e = root_node.self_entry(path)
61
- e.found? ? e : nil
62
- end
63
- end
64
- end
@@ -1,89 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module EacConfig
6
- class EntryPath
7
- PART_SEPARATOR = '.'
8
-
9
- class << self
10
- def assert(source)
11
- source.is_a?(self) ? source : new(build_parts(source))
12
- end
13
-
14
- def build_parts(source)
15
- return validate_parts!(source.split(PART_SEPARATOR)) if source.is_a?(::String)
16
- return validate_parts!(source.flat_map { |part| build_parts(part) }) if
17
- source.is_a?(::Enumerable)
18
-
19
- build_parts(source.to_s)
20
- end
21
-
22
- def validate_parts!(parts)
23
- parts.assert_argument(::Enumerable, 'parts')
24
- parts.each_with_index do |part, index|
25
- raise ::ArgumentError, "Part #{index} of #{parts} is blank" if part.blank?
26
- raise ::ArgumentError, "Part #{index} is not a string" unless part.is_a?(::String)
27
- end
28
- end
29
- end
30
-
31
- common_constructor :parts, default: [[]] do
32
- self.parts = ::Array.new(parts).freeze
33
- end
34
-
35
- compare_by :parts
36
- delegate :any?, :count, :each, :each_value, :each_with_index, :empty?, :fetch, :first, :index,
37
- :inject, :last, :map, :size, to: :parts
38
-
39
- # @return [EacConfig::EntryPath]
40
- def +(other)
41
- self.class.new(parts + self.class.assert(other).parts)
42
- end
43
-
44
- def [](*args)
45
- slice(*args)
46
- end
47
-
48
- def slice(*args)
49
- r = parts.slice(*args)
50
- r.is_a?(::Enumerable) ? self.class.new(r) : r
51
- end
52
-
53
- def to_s
54
- "#{self.class}[#{to_string}]"
55
- end
56
-
57
- # @return [String]
58
- def to_string
59
- parts.join(PART_SEPARATOR)
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
88
- end
89
- end
@@ -1,54 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_config/entry_path'
4
- require 'eac_config/node_entry'
5
- require 'eac_ruby_utils/blank_not_blank'
6
- require 'eac_ruby_utils/core_ext'
7
- require 'eac_ruby_utils/yaml'
8
-
9
- module EacConfig
10
- class EnvvarsNode
11
- class Entry < ::EacConfig::NodeEntry
12
- class << self
13
- def entry_path_to_envvar_name(path)
14
- ::EacConfig::EntryPath.assert(path).parts.join('_').gsub(/[^a-z0-9_]/i, '')
15
- .gsub(/\A_+/, '').gsub(/_+\z/, '').gsub(/_{2,}/, '_').upcase
16
- end
17
-
18
- def from_value(string)
19
- return nil if string.nil?
20
- return ::EacRubyUtils::Yaml.load(string) if string.start_with?('---')
21
-
22
- string
23
- end
24
-
25
- def to_value(object)
26
- return nil if object.nil?
27
- return object if object.is_a?(String)
28
-
29
- ::EacRubyUtils::Yaml.dump(object)
30
- end
31
- end
32
-
33
- enable_simple_cache
34
-
35
- def found?
36
- ENV.key?(envvar_name)
37
- end
38
-
39
- def value
40
- self.class.from_value(ENV[envvar_name])
41
- end
42
-
43
- def value=(a_value)
44
- ENV[envvar_name] = self.class.to_value(a_value)
45
- end
46
-
47
- private
48
-
49
- def envvar_name_uncached
50
- self.class.entry_path_to_envvar_name(path)
51
- end
52
- end
53
- end
54
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'addressable'
4
- require 'eac_config/node'
5
- require 'eac_ruby_utils/core_ext'
6
-
7
- module EacConfig
8
- # A node that read/write entries from environment variables.
9
- class EnvvarsNode
10
- require_sub __FILE__
11
- include ::EacConfig::Node
12
-
13
- URI = ::Addressable::URI.parse('self://envvars')
14
-
15
- class << self
16
- def from_uri(uri)
17
- return new if uri == URI
18
- end
19
- end
20
-
21
- # @param path [EacConfig::EntryPath]
22
- # @return [Array<EacConfig::Entries>]
23
- def self_entries(_path)
24
- []
25
- end
26
-
27
- def url
28
- URI
29
- end
30
-
31
- def to_s
32
- "#{self.class}[ObjectId: #{object_id}]}"
33
- end
34
- end
35
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module EacConfig
6
- class LoadNodesSearch
7
- common_constructor :root_node do
8
- add_next_pending until pending.empty?
9
- end
10
-
11
- def result
12
- added
13
- end
14
-
15
- private
16
-
17
- def added
18
- @added ||= []
19
- end
20
-
21
- def add_next_pending
22
- current = pending.pop
23
- current.self_loaded_nodes.each do |loaded_node|
24
- next if added.include?(loaded_node)
25
-
26
- added << loaded_node
27
- pending.push(loaded_node)
28
- end
29
- end
30
-
31
- def pending
32
- @pending ||= begin
33
- r = Queue.new
34
- r.push(root_node)
35
- r
36
- end
37
- end
38
- end
39
- end
@@ -1,28 +0,0 @@
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 LoadPath
8
- ENTRY_PATH = ::EacConfig::EntryPath.assert(%w[load_path])
9
-
10
- common_constructor :node
11
-
12
- def entry
13
- node.self_entry(ENTRY_PATH)
14
- end
15
-
16
- # @return [Array<String>]
17
- def paths
18
- r = entry.value
19
- r.is_a?(::Array) ? r : []
20
- end
21
-
22
- def push(new_path)
23
- entry.value = paths + [new_path]
24
- end
25
-
26
- delegate :to_s, to: :paths
27
- end
28
- end
@@ -1,81 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_config/entries'
4
- require 'eac_config/entry'
5
- require 'eac_config/entry_path'
6
- require 'eac_config/load_path'
7
- require 'eac_config/load_nodes_search'
8
- require 'eac_config/node_entry'
9
- require 'eac_config/node_uri'
10
- require 'eac_ruby_utils/core_ext'
11
- require 'eac_ruby_utils/context'
12
-
13
- module EacConfig
14
- module Node
15
- class << self
16
- def context
17
- @context ||= ::EacRubyUtils::Context.new
18
- end
19
- end
20
-
21
- attr_accessor :write_node
22
-
23
- common_concern do
24
- acts_as_abstract :self_entries
25
- include ::Comparable
26
- end
27
-
28
- # @return [Array<EacConfig::Entries>]
29
- def entries(path)
30
- ::EacConfig::Entries.new(self, path)
31
- end
32
-
33
- def entry(path)
34
- ::EacConfig::Entry.new(self, path)
35
- end
36
-
37
- # @return [[EacConfig::IncludePath]]
38
- def load_path
39
- @load_path ||= ::EacConfig::LoadPath.new(self)
40
- end
41
-
42
- # @return [Addressable::URI]
43
- def url
44
- raise_abstract_method(__method__)
45
- end
46
-
47
- # Return a entry which search values only in the self node.
48
- # @return [EacConfig::NodeEntry]
49
- def self_entry(path)
50
- self_entry_class.new(self, path)
51
- end
52
-
53
- def self_entry_class
54
- self.class.const_get('Entry')
55
- end
56
-
57
- # @return [Array<EacConfig::Node>]
58
- def self_loaded_nodes
59
- load_path.paths.flat_map { |node_path| load_nodes(node_path) }
60
- end
61
-
62
- # @return [Array<EacConfig::Node>]
63
- def recursive_loaded_nodes
64
- ::EacConfig::LoadNodesSearch.new(self).result
65
- end
66
-
67
- # @return [EacConfig::PrefixedPathNode]
68
- def with_prefix(path_prefix)
69
- require 'eac_config/prefixed_path_node'
70
- ::EacConfig::PrefixedPathNode.new(self, path_prefix)
71
- end
72
-
73
- private
74
-
75
- # @param node_path [String]
76
- # @return [Array<EacConfig::Node>]
77
- def load_nodes(node_path)
78
- ::EacConfig::NodeUri.new(node_path, url).instanciate
79
- end
80
- end
81
- end
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_config/entry_path'
4
- require 'eac_config/paths_hash'
5
- require 'eac_ruby_utils/core_ext'
6
-
7
- module EacConfig
8
- # A entry which search values only in the source node.
9
- class NodeEntry
10
- enable_abstract_methods
11
- enable_simple_cache
12
- common_constructor :node, :path do
13
- self.path = ::EacConfig::EntryPath.assert(path)
14
- end
15
- compare_by :node, :path
16
-
17
- abstract_methods :found?, :value, :value=
18
-
19
- def secret_value
20
- value
21
- end
22
-
23
- # @return [String]
24
- def to_s
25
- "#{self.class}[Node: #{node}, Path: #{path}]"
26
- end
27
- end
28
- end
@@ -1,29 +0,0 @@
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
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module EacConfig
4
- class NodeUri
5
- enable_simple_cache
6
- common_constructor :source, :loader_uri, default: [nil]
7
-
8
- # @return [Array<EacConfig::Node>]
9
- def instanciate
10
- instance_uris.map { |uri| instanciate_single(uri) }
11
- end
12
-
13
- delegate :to_s, to: :to_addressable
14
-
15
- private
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
-
28
- def to_addressable_uncached
29
- r = ::Addressable::URI.parse(source)
30
- path = r.path.to_pathname
31
- r.path = path.expand_path(loader_uri_path_directory).to_path if path.relative?
32
- r.scheme = 'file' if r.scheme.blank?
33
- r
34
- end
35
-
36
- def loader_uri_path_directory
37
- r = loader_uri.path
38
- raise ".loader_uri \"#{loader_uri}\" has no path (Source: \"#{source}\")" if r.blank?
39
-
40
- r.to_pathname.parent
41
- end
42
-
43
- require_sub __FILE__, require_mode: :kernel
44
- end
45
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/blank_not_blank'
4
- require 'eac_ruby_utils/core_ext'
5
- require 'eac_config/paths_hash'
6
-
7
- module EacConfig
8
- class OldConfigs
9
- class Base
10
- enable_simple_cache
11
-
12
- common_constructor :data, default: [{}] do
13
- self.data = ::EacConfig::PathsHash.new(data)
14
- end
15
-
16
- def []=(entry_key, entry_value)
17
- write(entry_key, entry_value)
18
- end
19
-
20
- def [](entry_key)
21
- read(entry_key)
22
- end
23
-
24
- def clear
25
- replace({})
26
- end
27
-
28
- def read(entry_key)
29
- return nil unless data.key?(entry_key)
30
-
31
- data.fetch(entry_key).if_present(::EacRubyUtils::BlankNotBlank.instance)
32
- end
33
-
34
- def replace(new_data)
35
- self.data = ::EacConfig::PathsHash.new(new_data)
36
- end
37
-
38
- def write(entry_key, entry_value)
39
- data[entry_key] = entry_value
40
- end
41
- end
42
- end
43
- end
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_config/old_configs/base'
4
- require 'yaml'
5
-
6
- module EacConfig
7
- class OldConfigs
8
- class File < ::EacConfig::OldConfigs::Base
9
- attr_reader :path, :options
10
-
11
- # Valid options: [:autosave]
12
- def initialize(path, options = {})
13
- @path = path
14
- @options = options.to_sym_keys_hash.freeze
15
- super(raw_data_from_file)
16
- end
17
-
18
- def save
19
- ::FileUtils.mkdir_p(::File.dirname(path))
20
- ::File.write(path, data.to_h.to_yaml)
21
- end
22
-
23
- def load
24
- replace(raw_data_from_file)
25
- end
26
-
27
- def write(entry_key, entry_value)
28
- super
29
- save if autosave?
30
- end
31
-
32
- def autosave?
33
- options[:autosave] ? true : false
34
- end
35
-
36
- private
37
-
38
- def raw_data_from_file
39
- if ::File.exist?(path) && ::File.size(path).positive?
40
- ::YAML.load_file(path)
41
- else
42
- {}
43
- end
44
- end
45
- end
46
- end
47
- end