eac_tools 0.60.1 → 0.60.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +32 -27
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/avm.gemspec +1 -1
  5. data/sub/avm/lib/avm/version.rb +1 -1
  6. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/docker_image.rb +7 -2
  7. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
  8. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/apache_path_dockerfile +5 -0
  9. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +2 -2
  10. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base.rb +2 -2
  11. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  12. data/sub/avm-eac_ubuntu_base0/Gemfile +3 -0
  13. data/sub/avm-eac_ubuntu_base0/avm-eac_ubuntu_base0.gemspec +1 -1
  14. data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/docker_image.rb +1 -1
  15. data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/version.rb +1 -1
  16. data/sub/avm-files/avm-files.gemspec +5 -5
  17. data/sub/avm-files/lib/avm/files/appendable/templatized_directory.rb +2 -2
  18. data/sub/avm-files/lib/avm/files/version.rb +1 -1
  19. data/sub/eac_templates/Gemfile +8 -0
  20. data/sub/eac_templates/eac_templates.gemspec +19 -0
  21. data/sub/eac_templates/lib/eac_templates/core_ext.rb +4 -0
  22. data/sub/eac_templates/lib/eac_templates/interface_methods.rb +12 -0
  23. data/sub/eac_templates/lib/eac_templates/modules/ancestor/directory.rb +15 -0
  24. data/sub/eac_templates/lib/eac_templates/modules/ancestor/file.rb +15 -0
  25. data/sub/eac_templates/lib/eac_templates/modules/ancestor/fs_object.rb +32 -0
  26. data/sub/eac_templates/lib/eac_templates/modules/ancestor.rb +48 -0
  27. data/sub/eac_templates/lib/eac_templates/modules/base.rb +35 -0
  28. data/sub/eac_templates/lib/eac_templates/modules.rb +9 -0
  29. data/sub/eac_templates/lib/eac_templates/patches/module/erb_template.rb +9 -0
  30. data/sub/eac_templates/lib/eac_templates/patches/module/template.rb +9 -0
  31. data/sub/eac_templates/lib/eac_templates/patches/module.rb +4 -0
  32. data/sub/eac_templates/lib/eac_templates/patches/object/erb_template.rb +9 -0
  33. data/sub/eac_templates/lib/eac_templates/patches/object/template.rb +9 -0
  34. data/sub/eac_templates/lib/eac_templates/patches/object.rb +4 -0
  35. data/sub/eac_templates/lib/eac_templates/patches.rb +4 -0
  36. data/sub/eac_templates/lib/eac_templates/sources/directory.rb +24 -0
  37. data/sub/eac_templates/lib/eac_templates/sources/file.rb +24 -0
  38. data/sub/eac_templates/lib/eac_templates/sources/from_all_gems.rb +4 -0
  39. data/sub/eac_templates/lib/eac_templates/sources/from_gem.rb +37 -0
  40. data/sub/eac_templates/lib/eac_templates/sources/fs_object.rb +53 -0
  41. data/sub/eac_templates/lib/eac_templates/sources/internal_set.rb +22 -0
  42. data/sub/eac_templates/lib/eac_templates/sources/set.rb +54 -0
  43. data/sub/eac_templates/lib/eac_templates/sources/single.rb +29 -0
  44. data/sub/eac_templates/lib/eac_templates/sources.rb +9 -0
  45. data/sub/eac_templates/lib/eac_templates/variables/directory.rb +47 -0
  46. data/sub/eac_templates/lib/eac_templates/variables/file.rb +50 -0
  47. data/sub/eac_templates/lib/eac_templates/variables/fs_object.rb +65 -0
  48. data/sub/eac_templates/lib/eac_templates/variables/not_found_error.rb +7 -0
  49. data/sub/eac_templates/lib/eac_templates/variables/providers/base.rb +23 -0
  50. data/sub/eac_templates/lib/eac_templates/variables/providers/config_reader.rb +29 -0
  51. data/sub/eac_templates/lib/eac_templates/variables/providers/entries_reader.rb +25 -0
  52. data/sub/eac_templates/lib/eac_templates/variables/providers/generic.rb +25 -0
  53. data/sub/eac_templates/lib/eac_templates/variables/providers/hash.rb +29 -0
  54. data/sub/eac_templates/lib/eac_templates/variables/providers.rb +25 -0
  55. data/sub/eac_templates/lib/eac_templates/variables.rb +9 -0
  56. data/sub/eac_templates/lib/eac_templates/version.rb +5 -0
  57. data/sub/eac_templates/lib/eac_templates.rb +7 -0
  58. data/sub/eac_templates/spec/lib/eac_templates/patches/module/template_spec.rb +120 -0
  59. data/sub/eac_templates/spec/lib/eac_templates/patches/module/template_spec_files/path1/a_module/a/a_a +1 -0
  60. data/sub/eac_templates/spec/lib/eac_templates/patches/module/template_spec_files/path1/a_module/b +1 -0
  61. data/sub/eac_templates/spec/lib/eac_templates/patches/module/template_spec_files/path1/super_class/a/a_b +1 -0
  62. data/sub/eac_templates/spec/lib/eac_templates/patches/module/template_spec_files/path1/super_class/b +1 -0
  63. data/sub/eac_templates/spec/lib/eac_templates/patches/module/template_spec_files/path2/a_module/a/a_b +1 -0
  64. data/sub/eac_templates/spec/lib/eac_templates/patches/module/template_spec_files/path2/a_module/b +1 -0
  65. data/sub/eac_templates/spec/lib/eac_templates/patches/module/template_spec_files/path2/a_module/c +1 -0
  66. data/sub/eac_templates/spec/lib/eac_templates/patches/module/template_spec_files/path2/sub_class/b +1 -0
  67. data/sub/eac_templates/spec/lib/eac_templates/patches/module/template_spec_files/path2/super_class/a/a_b +1 -0
  68. data/sub/eac_templates/spec/lib/eac_templates/patches/module/template_spec_files/path2/super_class/b +1 -0
  69. data/sub/eac_templates/spec/lib/eac_templates/patches/object/template_spec.rb +26 -0
  70. data/sub/eac_templates/spec/lib/eac_templates/patches/object/template_spec_files/path/my_stub_with_template +1 -0
  71. data/sub/eac_templates/spec/lib/eac_templates/sources/set_spec.rb +42 -0
  72. data/sub/eac_templates/spec/lib/eac_templates/sources/set_spec_files/path1/subdir1/file1.template +1 -0
  73. data/sub/eac_templates/spec/lib/eac_templates/sources/set_spec_files/path1/subdir1/file2 +1 -0
  74. data/sub/eac_templates/spec/lib/eac_templates/sources/set_spec_files/path2/subdir1/file3.template +1 -0
  75. data/sub/eac_templates/spec/lib/eac_templates/variables/file_spec.rb +35 -0
  76. data/sub/eac_templates/spec/lib/eac_templates/variables/file_spec_files/expected_content +2 -0
  77. data/sub/eac_templates/spec/lib/eac_templates/variables/file_spec_files/source.template +2 -0
  78. data/sub/eac_templates/spec/rubocop_spec.rb +3 -0
  79. data/sub/eac_templates/spec/spec_helper.rb +4 -0
  80. metadata +75 -7
  81. /data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/{Dockerfile_apache_setup → apache_host_dockerfile} +0 -0
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_templates/sources/fs_object'
5
+ require 'eac_templates/variables/file'
6
+
7
+ module EacTemplates
8
+ module Sources
9
+ class File < ::EacTemplates::Sources::FsObject
10
+ delegate :apply, :apply_to_file, :content, :path, :variables, to: :applier
11
+
12
+ # @return [Class]
13
+ def applier_class
14
+ ::EacTemplates::Variables::File
15
+ end
16
+
17
+ # @param path [Pathname]
18
+ # @return [Boolean]
19
+ def select_path?(path)
20
+ super && path.file?
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_templates/sources/from_gem'
4
+ ::EacTemplates::Sources::FromGem.include_all
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_templates/sources/set'
4
+
5
+ module EacTemplates
6
+ module Sources
7
+ class FromGem
8
+ class << self
9
+ def include_all(searcher = nil)
10
+ ::Gem::Specification.each { |gemspec| new(gemspec, searcher).include }
11
+ end
12
+ end
13
+
14
+ TEMPLATES_DIR_SUBPATH = 'template'
15
+
16
+ common_constructor :gemspec, :searcher, default: [nil] do
17
+ self.searcher ||= ::EacTemplates::Sources::Set.default
18
+ end
19
+
20
+ # @return [Boolean]
21
+ delegate :exist?, to: :path
22
+
23
+ # @return [Pathname]
24
+ def include
25
+ return nil unless exist?
26
+
27
+ searcher.included_paths << path
28
+ path
29
+ end
30
+
31
+ # @return [Pathname]
32
+ def path
33
+ gemspec.gem_dir.to_pathname.join(TEMPLATES_DIR_SUBPATH)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacTemplates
6
+ module Sources
7
+ class FsObject
8
+ enable_abstract_methods
9
+ enable_simple_cache
10
+ common_constructor :source_set, :subpath do
11
+ self.subpath = subpath.to_pathname
12
+ end
13
+
14
+ # @return [Boolean]
15
+ def found?
16
+ real_paths.any?
17
+ end
18
+
19
+ protected
20
+
21
+ # @return [Class]
22
+ def applier_class
23
+ raise_abstract_method __method__
24
+ end
25
+
26
+ # @return [EacTemplates::Variables::SourceFile]
27
+ def applier_uncached
28
+ raise "No #{self.class.name.downcase} found for \"#{subpath}\"" unless found?
29
+
30
+ applier_class.new(real_paths.first)
31
+ end
32
+
33
+ # @return [Array<Pathname>]
34
+ def real_paths_uncached
35
+ source_set.included_paths.lazy.map { |source_single| source_single_search(source_single) }
36
+ .select(&:present?)
37
+ end
38
+
39
+ # @param path [Pathname]
40
+ # @return [Boolean]
41
+ def select_path?(path)
42
+ path.present?
43
+ end
44
+
45
+ # @param source_single [EacTemplates::Sources::Single]
46
+ # @return [Pathname, nil]
47
+ def source_single_search(source_single)
48
+ r = source_single.search(subpath)
49
+ select_path?(r) ? r : nil
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_templates/sources/single'
5
+
6
+ module EacTemplates
7
+ module Sources
8
+ class InternalSet < ::Set
9
+ # @param single [EacTemplates::Sources::Single]
10
+ # @return [self]
11
+ def add(single)
12
+ super(::EacTemplates::Sources::Single.assert(single))
13
+ end
14
+
15
+ # @param single [EacTemplates::Sources::Single]
16
+ # @return [self]
17
+ def <<(single)
18
+ add(single)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/object/blank'
4
+ require 'eac_templates/sources/directory'
5
+ require 'eac_templates/sources/file'
6
+ require 'eac_templates/sources/internal_set'
7
+
8
+ module EacTemplates
9
+ module Sources
10
+ class Set
11
+ class << self
12
+ def default
13
+ @default ||= new
14
+ end
15
+ end
16
+
17
+ # @param subpath [Pathname]
18
+ # @return [EacTemplates::Sources::Directory]
19
+ def directory(subpath)
20
+ ::EacTemplates::Sources::Directory.new(self, subpath)
21
+ end
22
+
23
+ # @param subpath [Pathname]
24
+ # @return [EacTemplates::Sources::Directory]
25
+ def file(subpath)
26
+ ::EacTemplates::Sources::File.new(self, subpath)
27
+ end
28
+
29
+ def template(subpath, required = true)
30
+ found_file = file(subpath)
31
+ return found_file if found_file.found?
32
+
33
+ found_directory = directory(subpath)
34
+ return found_directory if found_directory.found?
35
+
36
+ return nil unless required
37
+
38
+ raise_template_not_found(subpath)
39
+ end
40
+
41
+ # @return [EacTemplates::Sources::InternalSet]
42
+ def included_paths
43
+ @included_paths ||= ::EacTemplates::Sources::InternalSet.new
44
+ end
45
+
46
+ private
47
+
48
+ def raise_template_not_found(subpath)
49
+ raise "Template not found for subpath \"#{subpath}\"" \
50
+ " (Included paths: #{included_paths.to_a.join(::File::PATH_SEPARATOR)})"
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacTemplates
6
+ module Sources
7
+ class Single
8
+ class << self
9
+ # @param object [EacTemplates::Sources::Single, Pathname]
10
+ # @return [EacTemplates::Sources::Single]
11
+ def assert(object)
12
+ return object if object.is_a?(self)
13
+
14
+ new(object.to_pathname)
15
+ end
16
+ end
17
+
18
+ common_constructor :path do
19
+ self.path = path.to_pathname.expand_path
20
+ end
21
+
22
+ # @return [Pathname, nil]
23
+ def search(subpath)
24
+ r = path.join(subpath)
25
+ r.exist? ? r : nil
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacTemplates
6
+ module Sources
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_templates/variables/file'
4
+ require 'eac_templates/variables/fs_object'
5
+
6
+ module EacTemplates
7
+ module Variables
8
+ class Directory
9
+ attr_reader :path
10
+
11
+ def initialize(path)
12
+ @path = path.is_a?(::Pathname) ? path : ::Pathname.new(path.to_s)
13
+ end
14
+
15
+ def apply(variables_source, directory)
16
+ ::EacTemplates::Variables::FsObject.new(self, '.', directory, variables_source).apply
17
+ end
18
+
19
+ def child(subpath)
20
+ child_path = ::File.join(path, subpath)
21
+ return ::EacTemplates::Variables::File.new(child_path) if ::File.file?(child_path)
22
+ return ::EacTemplates::Variables::Directory.new(child_path) if ::File.directory?(child_path)
23
+
24
+ raise "Child \"#{subpath}\" from \"#{path}\" not found"
25
+ end
26
+
27
+ def children
28
+ path.children.map do |path_child|
29
+ child(path_child.basename.to_path)
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ def apply_fs_object(source_relative, target)
36
+ if ::File.directory?(source_absolute(source_relative))
37
+ apply_directory(source_relative, target)
38
+ elsif ::File.file?(source_absolute(source_relative))
39
+ end
40
+ end
41
+
42
+ def source_absolute(source_relative)
43
+ ::File.expand_path(source_relative, path)
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_templates/variables/providers'
5
+
6
+ module EacTemplates
7
+ module Variables
8
+ class File
9
+ VARIABLE_DELIMITER = ::Regexp.quote('%%')
10
+ VARIABLE_PATTERN = /#{VARIABLE_DELIMITER}([a-z0-9\._]*)#{VARIABLE_DELIMITER}/i.freeze
11
+
12
+ enable_simple_cache
13
+ common_constructor :path do
14
+ self.path = path.to_pathname
15
+ end
16
+
17
+ # +variables_provider+ A [Hash] or object which responds to +read_entry(entry_name)+.
18
+ def apply(variables_source)
19
+ variables_provider = ::EacTemplates::Variables::Providers.build(variables_source)
20
+ variables.inject(content) do |a, e|
21
+ a.gsub(variable_pattern(e), variables_provider.variable_value(e).to_s)
22
+ end
23
+ end
24
+
25
+ def apply_to_file(variables_source, output_file_path)
26
+ output_file_path.to_pathname.write(apply(variables_source))
27
+ end
28
+
29
+ private
30
+
31
+ def variables_uncached
32
+ content.scan(VARIABLE_PATTERN).map(&:first).map do |name|
33
+ sanitize_variable_name(name)
34
+ end.to_set
35
+ end
36
+
37
+ def content_uncached
38
+ path.read
39
+ end
40
+
41
+ def sanitize_variable_name(variable_name)
42
+ variable_name.to_s.downcase
43
+ end
44
+
45
+ def variable_pattern(name)
46
+ /#{VARIABLE_DELIMITER}#{::Regexp.quote(name)}#{VARIABLE_DELIMITER}/i
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_templates/variables/file'
4
+
5
+ module EacTemplates
6
+ module Variables
7
+ class FsObject
8
+ TEMPLATE_EXTNAME = '.template'
9
+
10
+ common_constructor :source_directory, :source_relative, :target_root_directory,
11
+ :variables_source
12
+
13
+ def apply
14
+ if file?
15
+ apply_file
16
+ elsif directory?
17
+ apply_directory
18
+ else
19
+ raise "Unknown filesystem type: #{source_absolute}"
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def apply_directory
26
+ ::FileUtils.mkdir_p(target_absolute)
27
+ Dir.entries(source_absolute).each do |entry|
28
+ child(entry).apply unless %w[. ..].include?(entry)
29
+ end
30
+ end
31
+
32
+ def apply_file
33
+ if ::File.extname(source_absolute) == TEMPLATE_EXTNAME
34
+ ::EacTemplates::Variables::File.new(source_absolute).apply_to_file(
35
+ variables_source, target_absolute
36
+ )
37
+ else
38
+ ::FileUtils.cp(source_absolute, target_absolute)
39
+ end
40
+ end
41
+
42
+ def child(entry)
43
+ self.class.new(source_directory, ::File.join(source_relative, entry),
44
+ target_root_directory, variables_source)
45
+ end
46
+
47
+ def file?
48
+ ::File.file?(source_absolute)
49
+ end
50
+
51
+ def directory?
52
+ ::File.directory?(source_absolute)
53
+ end
54
+
55
+ def source_absolute
56
+ ::File.expand_path(source_relative, source_directory.path)
57
+ end
58
+
59
+ def target_absolute
60
+ ::File.expand_path(source_relative, target_root_directory)
61
+ .gsub(/#{::Regexp.quote(TEMPLATE_EXTNAME)}\z/, '')
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacTemplates
4
+ module Variables
5
+ class NotFoundError < StandardError; end
6
+ end
7
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_templates/variables/not_found_error'
4
+
5
+ module EacTemplates
6
+ module Variables
7
+ module Providers
8
+ class Base
9
+ attr_reader :source
10
+
11
+ def initialize(source)
12
+ @source = source
13
+ end
14
+
15
+ def variable_value(name)
16
+ return variable_fetch(name) if variable_exist?(name)
17
+
18
+ raise VariableNotFoundError, "Variable \"#{name}\" not found in #{source}"
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_config/node'
4
+ require 'eac_templates/variables/providers/base'
5
+
6
+ module EacTemplates
7
+ module Variables
8
+ module Providers
9
+ class ConfigReader < ::EacTemplates::Variables::Providers::Base
10
+ class << self
11
+ def accept?(variables_source)
12
+ return false unless variables_source.respond_to?(:entry)
13
+
14
+ entry = variables_source.entry(:any_value)
15
+ entry.respond_to?(:value) && entry.respond_to?(:found?)
16
+ end
17
+ end
18
+
19
+ def variable_exist?(name)
20
+ source.entry(name).found?
21
+ end
22
+
23
+ def variable_fetch(name)
24
+ source.entry(name).value
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_templates/variables/providers/base'
4
+
5
+ module EacTemplates
6
+ module Variables
7
+ module Providers
8
+ class EntriesReader < ::EacTemplates::Variables::Providers::Base
9
+ class << self
10
+ def accept?(variables_source)
11
+ variables_source.respond_to?(:read_entry)
12
+ end
13
+ end
14
+
15
+ def variable_exist?(_name)
16
+ true
17
+ end
18
+
19
+ def variable_fetch(name)
20
+ source.read_entry(name)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_templates/variables/providers/base'
4
+
5
+ module EacTemplates
6
+ module Variables
7
+ module Providers
8
+ class Generic < ::EacTemplates::Variables::Providers::Base
9
+ class << self
10
+ def accept?(variables_source)
11
+ variables_source.is_a?(::Object)
12
+ end
13
+ end
14
+
15
+ def variable_exist?(name)
16
+ source.respond_to?(name)
17
+ end
18
+
19
+ def variable_fetch(name)
20
+ source.send(name)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_templates/variables/providers/base'
4
+
5
+ module EacTemplates
6
+ module Variables
7
+ module Providers
8
+ class Hash < ::EacTemplates::Variables::Providers::Base
9
+ class << self
10
+ def accept?(variables_source)
11
+ variables_source.is_a?(::Hash)
12
+ end
13
+ end
14
+
15
+ def initialize(source)
16
+ super(source.with_indifferent_access)
17
+ end
18
+
19
+ def variable_exist?(name)
20
+ source.key?(name)
21
+ end
22
+
23
+ def variable_fetch(name)
24
+ source.fetch(name)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacTemplates
6
+ module Variables
7
+ module Providers
8
+ require_sub __FILE__
9
+
10
+ PROVIDERS = %w[config_reader entries_reader hash generic].map do |name|
11
+ "eac_templates/variables/providers/#{name}".camelize.constantize
12
+ end
13
+
14
+ class << self
15
+ def build(variables_source)
16
+ PROVIDERS.each do |provider|
17
+ return provider.new(variables_source) if provider.accept?(variables_source)
18
+ end
19
+
20
+ raise "Variables provider not found for #{variables_source}"
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacTemplates
6
+ module Variables
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacTemplates
4
+ VERSION = '0.4.0'
5
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacTemplates
6
+ require_sub __FILE__
7
+ end