eac_tools 0.76.0 → 0.76.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +28 -48
- data/lib/eac_tools/version.rb +1 -1
- data/sub/eac_cli/Gemfile +2 -2
- data/sub/eac_cli/eac_cli.gemspec +5 -3
- data/sub/eac_cli/lib/eac_cli/config.rb +0 -4
- data/sub/eac_cli/lib/eac_cli/core_ext.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/definition/alternative.rb +24 -3
- data/sub/eac_cli/lib/eac_cli/definition.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/old_configs/store_passwords_entry_reader.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/parser/alternative/any_options.rb +19 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/long_options.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +1 -3
- data/sub/eac_cli/lib/eac_cli/parser/alternative.rb +0 -9
- data/sub/eac_cli/lib/eac_cli/parser.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/patches/object.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/patches.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/runner/class_runner.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/set.rb +2 -2
- data/sub/eac_cli/lib/eac_cli/runner/exit.rb +2 -1
- data/sub/eac_cli/lib/eac_cli/runner/instance_methods.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/runner_with/help/builder/alternative.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/runner_with/help/builder.rb +2 -2
- data/sub/eac_cli/lib/eac_cli/runner_with/help.rb +1 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/runner_with_set.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/speaker/list.rb +4 -4
- data/sub/eac_cli/lib/eac_cli/speaker/options.rb +3 -3
- data/sub/eac_cli/lib/eac_cli/speaker.rb +2 -1
- data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
- data/sub/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +2 -2
- data/sub/eac_cli/spec/lib/eac_cli/old_configs_spec.rb +1 -1
- data/sub/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +10 -10
- data/sub/eac_cli/spec/lib/eac_cli/runner/for_context_spec.rb +13 -13
- data/sub/eac_cli/spec/lib/eac_cli/runner_spec.rb +10 -10
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/confirmation_spec.rb +3 -3
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/help/layout_spec.rb +1 -1
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +3 -2
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/output_spec.rb +6 -6
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +6 -6
- data/sub/eac_cli/spec/lib/eac_cli/speaker_spec.rb +1 -1
- data/sub/eac_cli/spec/rubocop_spec.rb +1 -1
- data/sub/eac_cli/spec/spec_helper.rb +1 -1
- metadata +3 -166
- data/sub/eac_envs-http/Gemfile +0 -8
- data/sub/eac_envs-http/eac_envs-http.gemspec +0 -25
- data/sub/eac_envs-http/lib/eac_envs/http/error.rb +0 -8
- data/sub/eac_envs-http/lib/eac_envs/http/request/body_field.rb +0 -51
- data/sub/eac_envs-http/lib/eac_envs/http/request/body_field_value.rb +0 -32
- data/sub/eac_envs-http/lib/eac_envs/http/request/body_fields.rb +0 -39
- data/sub/eac_envs-http/lib/eac_envs/http/request/faraday_connection.rb +0 -75
- data/sub/eac_envs-http/lib/eac_envs/http/request.rb +0 -58
- data/sub/eac_envs-http/lib/eac_envs/http/response/body.rb +0 -62
- data/sub/eac_envs-http/lib/eac_envs/http/response/headers.rb +0 -41
- data/sub/eac_envs-http/lib/eac_envs/http/response/links.rb +0 -28
- data/sub/eac_envs-http/lib/eac_envs/http/response/statuses.rb +0 -21
- data/sub/eac_envs-http/lib/eac_envs/http/response.rb +0 -30
- data/sub/eac_envs-http/lib/eac_envs/http/rspec/echo_server/request_processor.rb +0 -42
- data/sub/eac_envs-http/lib/eac_envs/http/rspec/echo_server/webrick_servlet.rb +0 -22
- data/sub/eac_envs-http/lib/eac_envs/http/rspec/echo_server.rb +0 -63
- data/sub/eac_envs-http/lib/eac_envs/http/rspec.rb +0 -11
- data/sub/eac_envs-http/lib/eac_envs/http/version.rb +0 -7
- data/sub/eac_envs-http/lib/eac_envs/http.rb +0 -9
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request/body_fields_spec.rb +0 -47
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec.rb +0 -68
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/get.source.yaml +0 -5
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/get.target.yaml +0 -9
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/get_with_auth.source.yaml +0 -8
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/get_with_auth.target.yaml +0 -10
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/post_array_body.source.yaml +0 -10
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/post_array_body.target.yaml +0 -11
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/post_string_body.source.yaml +0 -4
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/post_string_body.target.yaml +0 -11
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/put_hash_body.source.yaml +0 -6
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/put_hash_body.target.yaml +0 -11
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/put_with_file.source.yaml +0 -5
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/put_with_file.target.yaml +0 -13
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/root.source.yaml +0 -2
- data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/root.target.yaml +0 -9
- data/sub/eac_envs-http/spec/rubocop_spec.rb +0 -3
- data/sub/eac_envs-http/spec/spec_helper/request_builder.rb +0 -62
- data/sub/eac_envs-http/spec/spec_helper.rb +0 -7
- data/sub/eac_fs/Gemfile +0 -8
- data/sub/eac_fs/eac_fs.gemspec +0 -20
- data/sub/eac_fs/lib/eac_fs/cached_download.rb +0 -40
- data/sub/eac_fs/lib/eac_fs/comparator/build.rb +0 -57
- data/sub/eac_fs/lib/eac_fs/comparator/rename_file.rb +0 -15
- data/sub/eac_fs/lib/eac_fs/comparator.rb +0 -18
- data/sub/eac_fs/lib/eac_fs/contexts.rb +0 -21
- data/sub/eac_fs/lib/eac_fs/core_ext.rb +0 -4
- data/sub/eac_fs/lib/eac_fs/file_info.rb +0 -29
- data/sub/eac_fs/lib/eac_fs/logs/file.rb +0 -56
- data/sub/eac_fs/lib/eac_fs/logs.rb +0 -64
- data/sub/eac_fs/lib/eac_fs/patches/module/fs_cache.rb +0 -15
- data/sub/eac_fs/lib/eac_fs/patches/module.rb +0 -4
- data/sub/eac_fs/lib/eac_fs/patches/object/fs_cache.rb +0 -32
- data/sub/eac_fs/lib/eac_fs/patches/object.rb +0 -4
- data/sub/eac_fs/lib/eac_fs/patches/pathname/info.rb +0 -12
- data/sub/eac_fs/lib/eac_fs/patches/pathname.rb +0 -4
- data/sub/eac_fs/lib/eac_fs/patches.rb +0 -4
- data/sub/eac_fs/lib/eac_fs/rspec/setup.rb +0 -25
- data/sub/eac_fs/lib/eac_fs/rspec.rb +0 -9
- data/sub/eac_fs/lib/eac_fs/storage_tree.rb +0 -81
- data/sub/eac_fs/lib/eac_fs/traversable.rb +0 -45
- data/sub/eac_fs/lib/eac_fs/traverser.rb +0 -76
- data/sub/eac_fs/lib/eac_fs/version.rb +0 -5
- data/sub/eac_fs/lib/eac_fs.rb +0 -7
- data/sub/eac_fs/spec/lib/eac_fs/storage_tree_spec.rb +0 -32
- data/sub/eac_fs/spec/rubocop_spec.rb +0 -3
- data/sub/eac_fs/spec/spec_helper.rb +0 -4
- data/sub/eac_rest/Gemfile +0 -8
- data/sub/eac_rest/eac_rest.gemspec +0 -21
- data/sub/eac_rest/lib/eac_rest/api.rb +0 -57
- data/sub/eac_rest/lib/eac_rest/entity/data.rb +0 -44
- data/sub/eac_rest/lib/eac_rest/entity/fetching.rb +0 -20
- data/sub/eac_rest/lib/eac_rest/entity.rb +0 -35
- data/sub/eac_rest/lib/eac_rest/error.rb +0 -6
- data/sub/eac_rest/lib/eac_rest/helper.rb +0 -34
- data/sub/eac_rest/lib/eac_rest/request.rb +0 -48
- data/sub/eac_rest/lib/eac_rest/response.rb +0 -27
- data/sub/eac_rest/lib/eac_rest/version.rb +0 -5
- data/sub/eac_rest/lib/eac_rest.rb +0 -7
- data/sub/eac_rest/spec/lib/eac_rest/api_spec.rb +0 -71
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/get.source.yaml +0 -5
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/get.target.yaml +0 -9
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/get_with_auth.source.yaml +0 -8
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/get_with_auth.target.yaml +0 -10
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/post_array_body.source.yaml +0 -10
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/post_array_body.target.yaml +0 -11
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/post_string_body.source.yaml +0 -4
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/post_string_body.target.yaml +0 -11
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/put_hash_body.source.yaml +0 -6
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/put_hash_body.target.yaml +0 -11
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/put_with_file.source.yaml +0 -5
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/put_with_file.target.yaml +0 -13
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/root.source.yaml +0 -2
- data/sub/eac_rest/spec/lib/eac_rest/api_spec_files/root.target.yaml +0 -9
- data/sub/eac_rest/spec/rubocop_spec.rb +0 -3
- data/sub/eac_rest/spec/spec_helper/request_builder.rb +0 -51
- data/sub/eac_rest/spec/spec_helper.rb +0 -7
- data/sub/eac_templates/Gemfile +0 -8
- data/sub/eac_templates/eac_templates.gemspec +0 -19
- data/sub/eac_templates/lib/eac_templates/abstract/directory.rb +0 -42
- data/sub/eac_templates/lib/eac_templates/abstract/file.rb +0 -25
- data/sub/eac_templates/lib/eac_templates/abstract/fs_object.rb +0 -94
- data/sub/eac_templates/lib/eac_templates/abstract/fs_object_by_pathname.rb +0 -13
- data/sub/eac_templates/lib/eac_templates/abstract/not_found_error.rb +0 -8
- data/sub/eac_templates/lib/eac_templates/core_ext.rb +0 -4
- data/sub/eac_templates/lib/eac_templates/interface_methods.rb +0 -12
- data/sub/eac_templates/lib/eac_templates/modules/ancestor/directory.rb +0 -17
- data/sub/eac_templates/lib/eac_templates/modules/ancestor/file.rb +0 -16
- data/sub/eac_templates/lib/eac_templates/modules/ancestor/fs_object.rb +0 -25
- data/sub/eac_templates/lib/eac_templates/modules/ancestor.rb +0 -51
- data/sub/eac_templates/lib/eac_templates/modules/base.rb +0 -35
- data/sub/eac_templates/lib/eac_templates/modules.rb +0 -9
- data/sub/eac_templates/lib/eac_templates/patches/module/erb_template.rb +0 -9
- data/sub/eac_templates/lib/eac_templates/patches/module/template.rb +0 -9
- data/sub/eac_templates/lib/eac_templates/patches/module.rb +0 -4
- data/sub/eac_templates/lib/eac_templates/patches/object/erb_template.rb +0 -9
- data/sub/eac_templates/lib/eac_templates/patches/object/template.rb +0 -9
- data/sub/eac_templates/lib/eac_templates/patches/object.rb +0 -4
- data/sub/eac_templates/lib/eac_templates/patches.rb +0 -4
- data/sub/eac_templates/lib/eac_templates/sources/directory.rb +0 -37
- data/sub/eac_templates/lib/eac_templates/sources/file.rb +0 -13
- data/sub/eac_templates/lib/eac_templates/sources/from_all_gems.rb +0 -4
- data/sub/eac_templates/lib/eac_templates/sources/from_gem.rb +0 -37
- data/sub/eac_templates/lib/eac_templates/sources/fs_object.rb +0 -53
- data/sub/eac_templates/lib/eac_templates/sources/internal_set.rb +0 -22
- data/sub/eac_templates/lib/eac_templates/sources/set.rb +0 -55
- data/sub/eac_templates/lib/eac_templates/sources/single.rb +0 -29
- data/sub/eac_templates/lib/eac_templates/sources.rb +0 -9
- data/sub/eac_templates/lib/eac_templates/variables/content.rb +0 -52
- data/sub/eac_templates/lib/eac_templates/variables/directory.rb +0 -49
- data/sub/eac_templates/lib/eac_templates/variables/file.rb +0 -26
- data/sub/eac_templates/lib/eac_templates/variables/fs_object.rb +0 -65
- data/sub/eac_templates/lib/eac_templates/variables/not_found_error.rb +0 -7
- data/sub/eac_templates/lib/eac_templates/variables/providers/base.rb +0 -23
- data/sub/eac_templates/lib/eac_templates/variables/providers/config_reader.rb +0 -29
- data/sub/eac_templates/lib/eac_templates/variables/providers/entries_reader.rb +0 -25
- data/sub/eac_templates/lib/eac_templates/variables/providers/generic.rb +0 -25
- data/sub/eac_templates/lib/eac_templates/variables/providers/hash.rb +0 -29
- data/sub/eac_templates/lib/eac_templates/variables/providers.rb +0 -25
- data/sub/eac_templates/lib/eac_templates/variables.rb +0 -9
- data/sub/eac_templates/lib/eac_templates/version.rb +0 -5
- data/sub/eac_templates/lib/eac_templates.rb +0 -7
- data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec.rb +0 -141
- data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec_files/path1/a_module/a/a_a +0 -1
- data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec_files/path1/a_module/b +0 -1
- data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec_files/path1/super_class/a/a_b +0 -1
- data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec_files/path1/super_class/b +0 -1
- data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec_files/path2/a_module/a/a_b +0 -1
- data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec_files/path2/a_module/b +0 -1
- data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec_files/path2/a_module/c +0 -1
- data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec_files/path2/prepended_module/c +0 -1
- data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec_files/path2/sub_class/b +0 -1
- data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec_files/path2/super_class/a/a_b +0 -1
- data/sub/eac_templates/spec/lib/eac_templates/modules/base_spec_files/path2/super_class/b +0 -1
- data/sub/eac_templates/spec/lib/eac_templates/patches/object/template_spec.rb +0 -26
- data/sub/eac_templates/spec/lib/eac_templates/patches/object/template_spec_files/path/my_stub_with_template +0 -1
- data/sub/eac_templates/spec/lib/eac_templates/sources/set_spec.rb +0 -42
- data/sub/eac_templates/spec/lib/eac_templates/sources/set_spec_files/path1/subdir1/file1.template +0 -1
- data/sub/eac_templates/spec/lib/eac_templates/sources/set_spec_files/path1/subdir1/file2 +0 -1
- data/sub/eac_templates/spec/lib/eac_templates/sources/set_spec_files/path2/subdir1/file3.template +0 -1
- data/sub/eac_templates/spec/lib/eac_templates/variables/content_spec.rb +0 -35
- data/sub/eac_templates/spec/lib/eac_templates/variables/content_spec_files/expected_content +0 -2
- data/sub/eac_templates/spec/lib/eac_templates/variables/content_spec_files/source.template +0 -2
- data/sub/eac_templates/spec/rubocop_spec.rb +0 -3
- data/sub/eac_templates/spec/spec_helper.rb +0 -4
@@ -1,11 +0,0 @@
|
|
1
|
-
---
|
2
|
-
ssl: false
|
3
|
-
method: POST
|
4
|
-
uri: "/path/to/service"
|
5
|
-
body: field1=value1&field1=value3&field2=value2
|
6
|
-
headers:
|
7
|
-
user-agent: EacRest
|
8
|
-
content-type: application/x-www-form-urlencoded
|
9
|
-
accept-encoding: gzip,deflate
|
10
|
-
accept: "*/*"
|
11
|
-
content-length: '41'
|
@@ -1,13 +0,0 @@
|
|
1
|
-
---
|
2
|
-
ssl: false
|
3
|
-
method: PUT
|
4
|
-
uri: "/path/to/service"
|
5
|
-
body: "-------------RubyMultipartPost-0123456789abcdef0123456789abcdef\r\nContent-Disposition:
|
6
|
-
form-data; name=\"field1\"; filename=\"basename\"\r\nContent-Length: 6\r\nContent-Type:
|
7
|
-
text/plain\r\nContent-Transfer-Encoding: binary\r\n\r\nvalue1\r\n-------------RubyMultipartPost-0123456789abcdef0123456789abcdef--\r\n"
|
8
|
-
headers:
|
9
|
-
user-agent: EacRest
|
10
|
-
content-type: multipart/form-data; boundary=-----------RubyMultipartPost-0123456789abcdef0123456789abcdef
|
11
|
-
content-length: '290'
|
12
|
-
accept-encoding: gzip,deflate
|
13
|
-
accept: "*/*"
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_ruby_utils/fs/temp'
|
5
|
-
require 'eac_ruby_utils/yaml'
|
6
|
-
|
7
|
-
class RequestBuilder
|
8
|
-
class << self
|
9
|
-
def from_file(api, path)
|
10
|
-
new(api, ::EacRubyUtils::Yaml.load_file(path))
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
FILE_FIELD_PARSER = /\A@(.+)\z/.to_parser { |m| m[1] }
|
15
|
-
|
16
|
-
common_constructor :api, :data do
|
17
|
-
self.data = data.with_indifferent_access
|
18
|
-
end
|
19
|
-
|
20
|
-
def result # rubocop:disable Metrics/AbcSize
|
21
|
-
r = %i[verb headers].inject(selected_api.request(data.fetch(:url_suffix))) do |a, e|
|
22
|
-
data[e].if_present(a) { |v| a.send(e, v) }
|
23
|
-
end
|
24
|
-
r = r.header('user-agent', 'EacRest')
|
25
|
-
data[:body_data].if_present(r) { |v| r.body_data(build_body_data(v)) }
|
26
|
-
end
|
27
|
-
|
28
|
-
def build_body_data(source)
|
29
|
-
return source unless source.is_a?(::Hash)
|
30
|
-
|
31
|
-
source.map { |k, v| build_body_field(k, v) }
|
32
|
-
end
|
33
|
-
|
34
|
-
def build_body_field(name, value)
|
35
|
-
FILE_FIELD_PARSER.parse(name).if_present([name, value]) do |v|
|
36
|
-
[v, file_with_value(value)]
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def file_with_value(value)
|
41
|
-
r = ::EacRubyUtils::Fs::Temp.directory.join('basename')
|
42
|
-
r.write(value)
|
43
|
-
::File.new(r.to_path)
|
44
|
-
end
|
45
|
-
|
46
|
-
def selected_api
|
47
|
-
data[:auth].if_present(api) do |v|
|
48
|
-
api.class.new(api.root_url, v.fetch(:username), v.fetch(:password))
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/sub/eac_templates/Gemfile
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
-
|
5
|
-
require 'eac_templates/version'
|
6
|
-
|
7
|
-
Gem::Specification.new do |s|
|
8
|
-
s.name = 'eac_templates'
|
9
|
-
s.version = EacTemplates::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 'eac_config', '~> 0.12'
|
16
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.112'
|
17
|
-
|
18
|
-
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
19
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_templates/interface_methods'
|
5
|
-
require 'eac_templates/abstract/fs_object'
|
6
|
-
require 'eac_templates/variables/directory'
|
7
|
-
|
8
|
-
module EacTemplates
|
9
|
-
module Abstract
|
10
|
-
class Directory < ::EacTemplates::Abstract::FsObject
|
11
|
-
enable_abstract_methods
|
12
|
-
delegate(*::EacTemplates::InterfaceMethods::DIRECTORY - %i[child chidren], to: :applier)
|
13
|
-
|
14
|
-
# @param basename [Pathname]
|
15
|
-
# @return [EacTemplates::Abstract::FsObject
|
16
|
-
def build_child(child_basename, child_type)
|
17
|
-
child_basename = child_basename.to_pathname
|
18
|
-
child_type = type_list.value_validate!(child_type)
|
19
|
-
category_module.const_get(child_type.to_s.camelize)
|
20
|
-
.new(owner, self, child_basename, options)
|
21
|
-
end
|
22
|
-
|
23
|
-
# @param basename [Pathname]
|
24
|
-
# @return [EacTemplates::Abstract::FsObject]
|
25
|
-
def child(basename)
|
26
|
-
basename = basename.to_pathname
|
27
|
-
children.find { |c| c.basename == basename } ||
|
28
|
-
raise_not_found("No child found with basename \"#{basename}\"")
|
29
|
-
end
|
30
|
-
|
31
|
-
# @return [Enumerable<EacTemplates::Abstract::FsObject>]
|
32
|
-
def children
|
33
|
-
children_basenames.map { |c_basename, c_type| build_child(c_basename, c_type) }
|
34
|
-
end
|
35
|
-
|
36
|
-
# @return [Hash<Pathname, Symbol>]
|
37
|
-
def children_basenames
|
38
|
-
raise_abstract_method __method__
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_templates/interface_methods'
|
5
|
-
require 'eac_templates/abstract/fs_object'
|
6
|
-
require 'eac_templates/variables/file'
|
7
|
-
|
8
|
-
module EacTemplates
|
9
|
-
module Abstract
|
10
|
-
class File < ::EacTemplates::Abstract::FsObject
|
11
|
-
enable_abstract_methods
|
12
|
-
delegate(*::EacTemplates::InterfaceMethods::FILE - %i[content path], to: :applier)
|
13
|
-
|
14
|
-
# @return [String]
|
15
|
-
def content
|
16
|
-
path.read
|
17
|
-
end
|
18
|
-
|
19
|
-
# @return [Pathname]
|
20
|
-
def path
|
21
|
-
raise_abstract_method __method__
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,94 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_templates/abstract/fs_object_by_pathname'
|
5
|
-
require 'eac_templates/abstract/not_found_error'
|
6
|
-
|
7
|
-
module EacTemplates
|
8
|
-
module Abstract
|
9
|
-
class FsObject
|
10
|
-
class << self
|
11
|
-
# @param obj [Object]
|
12
|
-
# @return [EacTemplates::Abstract::FsObject, EacTemplates::Abstracts::FsObjectByPathname]
|
13
|
-
def assert(obj)
|
14
|
-
if obj.is_a?(self)
|
15
|
-
obj
|
16
|
-
else
|
17
|
-
::EacTemplates::Abstract::FsObjectByPathname.new(obj)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# @param owner [Object]
|
22
|
-
# @param parent_object [Object, nil]
|
23
|
-
# @param subpath [Pathname]
|
24
|
-
# @return [EacTemplates::Abstract::FsObject]
|
25
|
-
def by_subpath(owner, parent_object, subpath, options = {})
|
26
|
-
r = nil
|
27
|
-
subpath.to_pathname.each_filename do |basename|
|
28
|
-
r = new(owner, parent_object, basename, options)
|
29
|
-
parent_object = r
|
30
|
-
end
|
31
|
-
r || raise("Subpath is empty: #{subpath}")
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
enable_abstract_methods
|
36
|
-
enable_simple_cache
|
37
|
-
enable_listable
|
38
|
-
lists.add_symbol :option, :source_set
|
39
|
-
lists.add_symbol :type, :directory, :file
|
40
|
-
common_constructor :owner, :parent_object, :basename, :options, default: [{}] do
|
41
|
-
self.basename = basename.present? ? basename.to_pathname : ::Pathname.new('')
|
42
|
-
self.options = ::EacTemplates::Abstract::FsObject.lists.option.hash_keys_validate!(options)
|
43
|
-
end
|
44
|
-
|
45
|
-
# @return [EacTemplates::Variables::Directory, EacTemplates::Variables::File]
|
46
|
-
def applier
|
47
|
-
applier_class.new(self)
|
48
|
-
end
|
49
|
-
|
50
|
-
# @return [Class]
|
51
|
-
def applier_class
|
52
|
-
::EacTemplates::Variables.const_get(type.to_s.camelize)
|
53
|
-
end
|
54
|
-
|
55
|
-
# @return [Module]
|
56
|
-
def category_module
|
57
|
-
self.class.module_parent
|
58
|
-
end
|
59
|
-
|
60
|
-
# @return [Pathname]
|
61
|
-
def path_for_search
|
62
|
-
if parent_object.present?
|
63
|
-
parent_object.path_for_search.join(basename)
|
64
|
-
else
|
65
|
-
path_for_search_prefix.join(basename)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
# @return [Pathname]
|
70
|
-
def path_for_search_prefix
|
71
|
-
raise_abstract_method __method__
|
72
|
-
end
|
73
|
-
|
74
|
-
def raise_not_found(message)
|
75
|
-
raise ::EacTemplates::Abstract::NotFoundError, message
|
76
|
-
end
|
77
|
-
|
78
|
-
# @return [EacTemplates::Sources::Set]
|
79
|
-
def source_set
|
80
|
-
options[OPTION_SOURCE_SET] || ::EacTemplates::Sources::Set.default
|
81
|
-
end
|
82
|
-
|
83
|
-
# @return [Symbol]
|
84
|
-
def type
|
85
|
-
type_list.value_validate!(self.class.name.demodulize.underscore.to_sym)
|
86
|
-
end
|
87
|
-
|
88
|
-
# @return [EacRubyUtils::Listable::SymbolList]
|
89
|
-
def type_list
|
90
|
-
::EacTemplates::Abstract::FsObject.lists.type
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module EacTemplates
|
4
|
-
module InterfaceMethods
|
5
|
-
COMMON = %i[apply path].freeze
|
6
|
-
ONLY_DIRECTORY = %i[child children].freeze
|
7
|
-
DIRECTORY = COMMON + ONLY_DIRECTORY
|
8
|
-
ONLY_FILE = %i[apply_to_file content variables].freeze
|
9
|
-
FILE = COMMON + ONLY_FILE
|
10
|
-
ALL = COMMON + ONLY_DIRECTORY + ONLY_FILE
|
11
|
-
end
|
12
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_templates/abstract/directory'
|
5
|
-
require 'eac_templates/interface_methods'
|
6
|
-
require 'eac_templates/modules/ancestor/fs_object'
|
7
|
-
|
8
|
-
module EacTemplates
|
9
|
-
module Modules
|
10
|
-
class Ancestor
|
11
|
-
class Directory < ::EacTemplates::Abstract::Directory
|
12
|
-
include ::EacTemplates::Modules::Ancestor::FsObject
|
13
|
-
delegate :children_basenames, to: :source_object
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_templates/abstract/file'
|
5
|
-
require 'eac_templates/interface_methods'
|
6
|
-
require 'eac_templates/modules/ancestor/fs_object'
|
7
|
-
|
8
|
-
module EacTemplates
|
9
|
-
module Modules
|
10
|
-
class Ancestor
|
11
|
-
class File < ::EacTemplates::Abstract::File
|
12
|
-
include ::EacTemplates::Modules::Ancestor::FsObject
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_templates/interface_methods'
|
5
|
-
|
6
|
-
module EacTemplates
|
7
|
-
module Modules
|
8
|
-
class Ancestor
|
9
|
-
module FsObject
|
10
|
-
delegate :found?, :path, to: :source_object
|
11
|
-
|
12
|
-
# @return [Pathname]
|
13
|
-
def path_for_search_prefix
|
14
|
-
owner.path_for_search
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def source_object_uncached
|
20
|
-
owner.source_set.send(type, path_for_search)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_templates/interface_methods'
|
5
|
-
require 'eac_templates/abstract/not_found_error'
|
6
|
-
|
7
|
-
module EacTemplates
|
8
|
-
module Modules
|
9
|
-
class Ancestor
|
10
|
-
class << self
|
11
|
-
# @param a_module [Module]
|
12
|
-
# @return [Pathname]
|
13
|
-
def path_for_search(a_module)
|
14
|
-
a_module.name.underscore.to_pathname
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
common_constructor :base, :ancestor
|
19
|
-
delegate :subpath, :source_set, to: :base
|
20
|
-
delegate(*::EacTemplates::InterfaceMethods::ALL, to: :source_object)
|
21
|
-
|
22
|
-
# @return [EacTemplates::Modules::Directory]
|
23
|
-
def directory
|
24
|
-
@directory ||= ::EacTemplates::Modules::Ancestor::Directory
|
25
|
-
.new(self, nil, nil, source_set: source_set)
|
26
|
-
end
|
27
|
-
|
28
|
-
# @return [EacTemplates::Modules::File]
|
29
|
-
def file
|
30
|
-
@file ||= ::EacTemplates::Modules::Ancestor::File
|
31
|
-
.new(self, nil, nil, source_set: source_set)
|
32
|
-
end
|
33
|
-
|
34
|
-
# @return [Pathname]
|
35
|
-
def path_for_search
|
36
|
-
r = self.class.path_for_search(ancestor)
|
37
|
-
subpath.if_present(r) { |v| r.join(v) }
|
38
|
-
end
|
39
|
-
|
40
|
-
# @return [EacTemplates::Modules::Ancestor::FsObject]
|
41
|
-
def source_object
|
42
|
-
return file if file.found?
|
43
|
-
return directory if directory.found?
|
44
|
-
|
45
|
-
raise ::EacTemplates::Abstract::NotFoundError, "No template found: #{path_for_search}"
|
46
|
-
end
|
47
|
-
|
48
|
-
require_sub __FILE__
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'eac_templates/interface_methods'
|
5
|
-
require 'eac_templates/modules/ancestor'
|
6
|
-
require 'eac_templates/sources/set'
|
7
|
-
|
8
|
-
module EacTemplates
|
9
|
-
module Modules
|
10
|
-
class Base
|
11
|
-
enable_listable
|
12
|
-
lists.add_symbol :option, :source_set, :subpath
|
13
|
-
common_constructor :the_module, :options, default: [{}] do
|
14
|
-
self.options = self.class.lists.option.hash_keys_validate!(options)
|
15
|
-
end
|
16
|
-
delegate(*::EacTemplates::InterfaceMethods::ALL, :path_for_search, :source_object,
|
17
|
-
to: :self_ancestor)
|
18
|
-
|
19
|
-
# @return [EacTemplates::Modules::Ancestor]
|
20
|
-
def self_ancestor
|
21
|
-
@self_ancestor ||= ::EacTemplates::Modules::Ancestor.new(self, the_module)
|
22
|
-
end
|
23
|
-
|
24
|
-
# @return [EacTemplates::SourceSet]
|
25
|
-
def source_set
|
26
|
-
options[OPTION_SOURCE_SET] || ::EacTemplates::Sources::Set.default
|
27
|
-
end
|
28
|
-
|
29
|
-
# @return [Pathname, nil]
|
30
|
-
def subpath
|
31
|
-
options[OPTION_SUBPATH].if_present(&:to_pathname)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|