eac_tools 0.65.0 → 0.66.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +45 -39
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/aranha-parsers/aranha-parsers.gemspec +4 -4
  5. data/sub/aranha-parsers/lib/aranha/parsers/base.rb +10 -5
  6. data/sub/aranha-parsers/lib/aranha/parsers/html/base.rb +14 -0
  7. data/sub/aranha-parsers/lib/aranha/parsers/html/node/default/string_support.rb +6 -6
  8. data/sub/aranha-parsers/lib/aranha/parsers/html/node/default.rb +16 -2
  9. data/sub/aranha-parsers/lib/aranha/parsers/version.rb +1 -1
  10. data/sub/avm/avm.gemspec +3 -3
  11. data/sub/avm/lib/avm/data/clearer.rb +18 -0
  12. data/sub/avm/lib/avm/data/package/clear.rb +23 -0
  13. data/sub/avm/lib/avm/data/package/dump.rb +0 -10
  14. data/sub/avm/lib/avm/data/package.rb +8 -1
  15. data/sub/avm/lib/avm/docker/runner.rb +0 -4
  16. data/sub/avm/lib/avm/instances/base/auto_values/data.rb +1 -2
  17. data/sub/avm/lib/avm/instances/base.rb +10 -0
  18. data/sub/avm/lib/avm/version.rb +1 -1
  19. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +4 -3
  20. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/launcher_stereotypes/base/publish.rb +8 -9
  21. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  22. data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +3 -3
  23. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/base.rb +0 -10
  24. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +1 -1
  25. data/sub/avm-tools/avm-tools.gemspec +3 -3
  26. data/sub/avm-tools/lib/avm/tools/runner/instance/data/clear.rb +18 -0
  27. data/sub/avm-tools/lib/avm/tools/runner/instance/data/dump.rb +1 -5
  28. data/sub/avm-tools/lib/avm/tools/runner/instance/data/unit/clear.rb +1 -5
  29. data/sub/avm-tools/lib/avm/tools/runner/instance/data/unit.rb +5 -0
  30. data/sub/avm-tools/lib/avm/tools/runner/instance/data.rb +5 -0
  31. data/sub/avm-tools/lib/avm/tools/runner/launcher.rb +0 -1
  32. data/sub/avm-tools/lib/avm/tools/runner/launcher_stereotypes/list.rb +0 -1
  33. data/sub/avm-tools/lib/avm/tools/runner_with/instance_data_clear.rb +20 -0
  34. data/sub/avm-tools/lib/avm/tools/runner_with.rb +11 -0
  35. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  36. data/sub/eac_cli/eac_cli.gemspec +1 -1
  37. data/sub/eac_cli/lib/eac_cli/runner/context.rb +9 -6
  38. data/sub/eac_cli/lib/eac_cli/runner/instance_methods.rb +3 -3
  39. data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
  40. data/sub/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +10 -1
  41. data/sub/eac_envs-http/Gemfile +8 -0
  42. data/sub/eac_envs-http/eac_envs-http.gemspec +25 -0
  43. data/sub/eac_envs-http/lib/eac_envs/http/error.rb +8 -0
  44. data/sub/eac_envs-http/lib/eac_envs/http/request/body_field.rb +51 -0
  45. data/sub/eac_envs-http/lib/eac_envs/http/request/body_field_value.rb +32 -0
  46. data/sub/eac_envs-http/lib/eac_envs/http/request/body_fields.rb +39 -0
  47. data/sub/eac_envs-http/lib/eac_envs/http/request/faraday_connection.rb +75 -0
  48. data/sub/eac_envs-http/lib/eac_envs/http/request.rb +58 -0
  49. data/sub/eac_envs-http/lib/eac_envs/http/response/body.rb +57 -0
  50. data/sub/eac_envs-http/lib/eac_envs/http/response/headers.rb +41 -0
  51. data/sub/eac_envs-http/lib/eac_envs/http/response/links.rb +28 -0
  52. data/sub/eac_envs-http/lib/eac_envs/http/response/statuses.rb +21 -0
  53. data/sub/eac_envs-http/lib/eac_envs/http/response.rb +30 -0
  54. data/sub/eac_envs-http/lib/eac_envs/http/rspec/echo_server/request_processor.rb +42 -0
  55. data/sub/eac_envs-http/lib/eac_envs/http/rspec/echo_server/webrick_servlet.rb +22 -0
  56. data/sub/eac_envs-http/lib/eac_envs/http/rspec/echo_server.rb +63 -0
  57. data/sub/eac_envs-http/lib/eac_envs/http/rspec.rb +11 -0
  58. data/sub/eac_envs-http/lib/eac_envs/http/version.rb +7 -0
  59. data/sub/{avm-tools/lib/avm/projects.rb → eac_envs-http/lib/eac_envs/http.rb} +2 -2
  60. data/sub/eac_envs-http/spec/lib/eac_envs/http/request/body_fields_spec.rb +47 -0
  61. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec.rb +68 -0
  62. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/get.source.yaml +5 -0
  63. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/get.target.yaml +9 -0
  64. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/get_with_auth.source.yaml +8 -0
  65. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/get_with_auth.target.yaml +10 -0
  66. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/post_array_body.source.yaml +10 -0
  67. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/post_array_body.target.yaml +11 -0
  68. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/post_string_body.source.yaml +4 -0
  69. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/post_string_body.target.yaml +11 -0
  70. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/put_hash_body.source.yaml +6 -0
  71. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/put_hash_body.target.yaml +11 -0
  72. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/put_with_file.source.yaml +5 -0
  73. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/put_with_file.target.yaml +13 -0
  74. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/root.source.yaml +2 -0
  75. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/root.target.yaml +9 -0
  76. data/sub/eac_envs-http/spec/rubocop_spec.rb +3 -0
  77. data/sub/eac_envs-http/spec/spec_helper/request_builder.rb +61 -0
  78. data/sub/eac_envs-http/spec/spec_helper.rb +7 -0
  79. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/executable.rb +14 -2
  80. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  81. metadata +59 -12
  82. data/sub/avm-tools/lib/avm/projects/stereotypes.rb +0 -15
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_envs/http/request'
4
+ require 'eac_ruby_utils/core_ext'
5
+ require 'webrick'
6
+
7
+ module EacEnvs
8
+ module Http
9
+ module Rspec
10
+ class EchoServer
11
+ class RequestProcessor
12
+ REQUEST_TO_DATA = {
13
+ ssl: :ssl?,
14
+ method: :request_method,
15
+ uri: :unparsed_uri,
16
+ body: :body
17
+ }.freeze
18
+
19
+ common_constructor :request, :response
20
+
21
+ def perform
22
+ response.body = response_body
23
+ response.header['Content-type'] = 'application/json'
24
+ response.status = 200
25
+ end
26
+
27
+ def request_data
28
+ REQUEST_TO_DATA.map { |k, v| [k, request.send(v)] }.to_h.merge(headers: request_headers)
29
+ end
30
+
31
+ def request_headers
32
+ request.header.map { |k, v| [k, v.first] }.to_h
33
+ end
34
+
35
+ def response_body
36
+ ::JSON.generate(request_data)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_envs/http/request'
4
+ require 'eac_envs/http/rspec/echo_server/request_processor'
5
+ require 'eac_ruby_utils/core_ext'
6
+ require 'webrick'
7
+
8
+ module EacEnvs
9
+ module Http
10
+ module Rspec
11
+ class EchoServer
12
+ class WebrickServlet < WEBrick::HTTPServlet::AbstractServlet
13
+ ::EacEnvs::Http::Request.lists.verb.each_value do |verb|
14
+ define_method "do_#{verb.to_s.upcase}" do |request, response|
15
+ ::EacEnvs::Http::Rspec::EchoServer::RequestProcessor.new(request, response).perform
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'addressable'
4
+ require 'eac_ruby_utils/core_ext'
5
+ require 'webrick'
6
+ require 'webrick/https'
7
+
8
+ module EacEnvs
9
+ module Http
10
+ module Rspec
11
+ class EchoServer
12
+ HOSTNAME = 'localhost'
13
+ SCHEMES = {
14
+ http: { Port: 8080 },
15
+ https: { Port: 8443, SSLEnable: true, SSLCertName: [['CN', HOSTNAME]] }
16
+ }.freeze
17
+
18
+ class << self
19
+ SCHEMES.each do |scheme, webrick_options|
20
+ # @return [::EacEnvs::Http::Rspec::EchoServer]
21
+ define_method scheme do
22
+ new(scheme, webrick_options)
23
+ end
24
+ end
25
+ end
26
+
27
+ common_constructor :scheme, :webrick_options
28
+
29
+ def on_active(&block)
30
+ servlet = webrick_servlet
31
+ ::Thread.abort_on_exception = true
32
+ servlet_thread = ::Thread.new { servlet.start }
33
+ begin
34
+ sleep 0.001 while servlet.status != :Running
35
+ block.call
36
+ ensure
37
+ servlet.shutdown
38
+ servlet_thread.join
39
+ end
40
+ end
41
+
42
+ def root_url
43
+ ::Addressable::URI.new(
44
+ scheme: scheme.to_s,
45
+ host: ::EacEnvs::Http::Rspec::EchoServer::HOSTNAME,
46
+ port: webrick_options.fetch(:Port)
47
+ )
48
+ end
49
+
50
+ private
51
+
52
+ # @return [EacEnvs::Http::Rspec::EchoServer::WebrickServlet]
53
+ def webrick_servlet
54
+ r = ::WEBrick::HTTPServer.new(webrick_options)
55
+ r.mount '/', ::EacEnvs::Http::Rspec::EchoServer::WebrickServlet
56
+ r
57
+ end
58
+
59
+ require_sub __FILE__
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacEnvs
6
+ module Http
7
+ module Rspec
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacEnvs
4
+ module Http
5
+ VERSION = '0.3.2'
6
+ end
7
+ end
@@ -2,8 +2,8 @@
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
4
 
5
- module Avm
6
- module Projects
5
+ module EacEnvs
6
+ module Http
7
7
  require_sub __FILE__
8
8
  end
9
9
  end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_envs/http/request/body_fields'
4
+
5
+ ::RSpec.describe ::EacEnvs::Http::Request::BodyFields do
6
+ describe '#to_h' do
7
+ [
8
+ [
9
+ { field1: 'value1', field2: %w[value2 value3] },
10
+ { 'field1' => ['value1'], 'field2' => %w[value2 value3] }
11
+ ], [
12
+ 'field1=value1&field2=value2',
13
+ nil
14
+ ], [
15
+ [%w[field1 value1], %w[field2 value2], %w[field2 value3]],
16
+ { 'field1' => ['value1'], 'field2' => %w[value2 value3] }
17
+ ]
18
+ ].each do |d|
19
+ source_body = d[0]
20
+ expected_result = d[1]
21
+ context "when source_body is #{source_body}" do
22
+ let(:instance) { described_class.new(source_body) }
23
+
24
+ it do
25
+ expect(instance.to_h).to eq(expected_result)
26
+ end
27
+ end
28
+ end
29
+
30
+ context 'when source_body has a file' do
31
+ let(:file) do
32
+ temp = ::EacRubyUtils::Fs::Temp.file
33
+ temp.write('TEMPORARY')
34
+ ::File.new(temp.to_path)
35
+ end
36
+ let(:source_body) { { file1: file } }
37
+ let(:instance) { described_class.new(source_body) }
38
+ let(:expected_file) { ::Faraday::Multipart::FilePart.new(file.path, 'text/plain') }
39
+
40
+ %w[class original_filename local_path content_type].each do |attr|
41
+ it do
42
+ expect(instance.to_h.fetch('file1').first.send(attr)).to eq(expected_file.send(attr))
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_envs/http/error'
4
+ require 'eac_envs/http/request'
5
+ require 'eac_envs/http/rspec/echo_server'
6
+
7
+ ::RSpec.describe ::EacEnvs::Http::Request do
8
+ let(:http_server) { ::EacEnvs::Http::Rspec::EchoServer.http }
9
+
10
+ around { |example| http_server.on_active(&example) }
11
+
12
+ before do
13
+ allow_any_instance_of(::Faraday::Multipart::Middleware).to( # rubocop:disable RSpec/AnyInstance
14
+ receive(:unique_boundary)
15
+ .and_return('-----------RubyMultipartPost-0123456789abcdef0123456789abcdef')
16
+ )
17
+ end
18
+
19
+ include_examples 'source_target_fixtures', __FILE__
20
+
21
+ def source_data(source_file)
22
+ remove_variable_values(
23
+ ::JSON.parse(
24
+ ::RequestBuilder.from_file(http_server.root_url, source_file).result.response.body_str
25
+ )
26
+ )
27
+ end
28
+
29
+ def remove_variable_values(obj)
30
+ if obj.is_a?(::Hash)
31
+ remove_variable_values_from_hash(obj)
32
+ elsif obj.is_a?(::Enumerable)
33
+ remove_variable_values_from_enumerable(obj)
34
+ end
35
+ obj
36
+ end
37
+
38
+ def remove_variable_values_from_hash(hash)
39
+ %w[host hostname ip].each { |key| hash.delete(key) }
40
+ hash.each_value { |value| remove_variable_values(value) }
41
+ end
42
+
43
+ def remove_variable_values_from_enumerable(enumerable)
44
+ enumerable.each { |value| remove_variable_values(value) }
45
+ end
46
+
47
+ context 'with self signed https server' do
48
+ let(:http_server) { ::EacEnvs::Http::Rspec::EchoServer.https }
49
+ let(:instance) { described_class.new.url(http_server.root_url + '/any/path') }
50
+ let(:response_body) { request.response.body_str }
51
+
52
+ context 'when no additional flag' do
53
+ let(:request) { instance }
54
+
55
+ it do
56
+ expect { response_body }.to(raise_error(::EacEnvs::Http::Error))
57
+ end
58
+ end
59
+
60
+ context 'when ssl_verify disabled' do
61
+ let(:request) { instance.ssl_verify(false) }
62
+
63
+ it do
64
+ expect { response_body }.not_to raise_error
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,5 @@
1
+ ---
2
+ url_suffix: '/path/to/service?field1=value1&field2=value2'
3
+ verb: :get
4
+ headers:
5
+ Accept: application/json
@@ -0,0 +1,9 @@
1
+ ---
2
+ ssl: false
3
+ method: GET
4
+ uri: "/path/to/service?field1=value1&field2=value2"
5
+ body:
6
+ headers:
7
+ user-agent: Faraday v2.7.4
8
+ accept: application/json
9
+ accept-encoding: gzip,deflate
@@ -0,0 +1,8 @@
1
+ ---
2
+ url_suffix: '/path/to/service?field1=value1&field2=value2'
3
+ auth:
4
+ username: the_user
5
+ password: the_secret
6
+ verb: :get
7
+ headers:
8
+ Accept: application/json
@@ -0,0 +1,10 @@
1
+ ---
2
+ ssl: false
3
+ method: GET
4
+ uri: "/path/to/service?field1=value1&field2=value2"
5
+ body:
6
+ headers:
7
+ user-agent: Faraday v2.7.4
8
+ accept: application/json
9
+ authorization: Basic dGhlX3VzZXI6dGhlX3NlY3JldA==
10
+ accept-encoding: gzip,deflate
@@ -0,0 +1,10 @@
1
+ ---
2
+ url_suffix: '/path/to/service'
3
+ verb: :post
4
+ body_data:
5
+ - - field1
6
+ - value1
7
+ - - field2
8
+ - value2
9
+ - - field1
10
+ - value3
@@ -0,0 +1,11 @@
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: Faraday v2.7.4
8
+ content-type: application/x-www-form-urlencoded
9
+ accept-encoding: gzip,deflate
10
+ accept: "*/*"
11
+ content-length: '41'
@@ -0,0 +1,4 @@
1
+ ---
2
+ url_suffix: '/path/to/service'
3
+ verb: :post
4
+ body_data: field1=value1&field2=value2
@@ -0,0 +1,11 @@
1
+ ---
2
+ ssl: false
3
+ method: POST
4
+ uri: "/path/to/service"
5
+ body: field1=value1&field2=value2
6
+ headers:
7
+ user-agent: Faraday v2.7.4
8
+ content-type: application/x-www-form-urlencoded
9
+ accept-encoding: gzip,deflate
10
+ accept: "*/*"
11
+ content-length: '27'
@@ -0,0 +1,6 @@
1
+ ---
2
+ url_suffix: '/path/to/service'
3
+ verb: :put
4
+ body_data:
5
+ field1: value1
6
+ field2: value2
@@ -0,0 +1,11 @@
1
+ ---
2
+ ssl: false
3
+ method: PUT
4
+ uri: "/path/to/service"
5
+ body: field1=value1&field2=value2
6
+ headers:
7
+ user-agent: Faraday v2.7.4
8
+ content-type: application/x-www-form-urlencoded
9
+ accept-encoding: gzip,deflate
10
+ accept: "*/*"
11
+ content-length: '27'
@@ -0,0 +1,5 @@
1
+ ---
2
+ url_suffix: '/path/to/service'
3
+ verb: :put
4
+ body_data:
5
+ '@field1': value1
@@ -0,0 +1,13 @@
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: Faraday v2.7.4
10
+ content-type: multipart/form-data; boundary=-----------RubyMultipartPost-0123456789abcdef0123456789abcdef
11
+ content-length: '290'
12
+ accept-encoding: gzip,deflate
13
+ accept: "*/*"
@@ -0,0 +1,9 @@
1
+ ---
2
+ ssl: false
3
+ method: GET
4
+ uri: "/"
5
+ body:
6
+ headers:
7
+ user-agent: Faraday v2.7.4
8
+ accept-encoding: gzip,deflate
9
+ accept: "*/*"
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ ::EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -0,0 +1,61 @@
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(root_url, path)
10
+ new(root_url, ::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 :root_url, :data do
17
+ self.root_url = root_url.to_uri
18
+ self.data = data.with_indifferent_access
19
+ end
20
+
21
+ def new_request
22
+ ::EacEnvs::Http::Request.new.url(root_url + data.fetch(:url_suffix))
23
+ end
24
+
25
+ def result
26
+ r = %i[verb headers].inject(new_request) do |a, e|
27
+ data[e].if_present(a) { |v| a.send(e, v) }
28
+ end
29
+ result_body_data(result_auth(r))
30
+ end
31
+
32
+ def build_body_data(source)
33
+ return source unless source.is_a?(::Hash)
34
+
35
+ source.map { |k, v| build_body_field(k, v) }
36
+ end
37
+
38
+ def build_body_field(name, value)
39
+ FILE_FIELD_PARSER.parse(name).if_present([name, value]) do |v|
40
+ [v, file_with_value(value)]
41
+ end
42
+ end
43
+
44
+ def file_with_value(value)
45
+ r = ::EacRubyUtils::Fs::Temp.directory.join('basename')
46
+ r.write(value)
47
+ ::File.new(r.to_path)
48
+ end
49
+
50
+ private
51
+
52
+ def result_auth(request)
53
+ request = data[:auth].if_present(request) do |v|
54
+ request.basic_auth(v.fetch(:username), v.fetch(:password))
55
+ end
56
+ end
57
+
58
+ def result_body_data(request)
59
+ data[:body_data].if_present(request) { |v| request.body_data(build_body_data(v)) }
60
+ end
61
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/rspec/default_setup'
4
+ ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
5
+
6
+ require 'eac_ruby_utils/require_sub'
7
+ ::EacRubyUtils.require_sub __FILE__
@@ -9,7 +9,7 @@ module EacRubyUtils
9
9
  include ::EacRubyUtils::Listable
10
10
  include ::EacRubyUtils::SimpleCache
11
11
 
12
- lists.add_symbol :option, :check_args, :auto_validate
12
+ lists.add_symbol :option, :check_args, :exec_args, :auto_validate
13
13
 
14
14
  DEFAULT_AUTO_VALIDATE = true
15
15
 
@@ -53,7 +53,7 @@ module EacRubyUtils
53
53
  end
54
54
 
55
55
  def executable_args
56
- executable_args_from_envvar || [name]
56
+ executable_args_from_envvar || executable_args_from_options || executable_args_from_name
57
57
  end
58
58
 
59
59
  def executable_args_envvar
@@ -64,6 +64,18 @@ module EacRubyUtils
64
64
  ENV[executable_args_envvar].if_present { |v| ::Shellwords.split(v) }
65
65
  end
66
66
 
67
+ # @return [Enumerable<String>]
68
+ def executable_args_from_name
69
+ ::Shellwords.split(name)
70
+ end
71
+
72
+ # @return [Enumerable<String>]
73
+ def executable_args_from_options
74
+ options[OPTION_EXEC_ARGS].if_present do |v|
75
+ v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v.to_s)
76
+ end
77
+ end
78
+
67
79
  private
68
80
 
69
81
  attr_writer :options
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.115.0'
4
+ VERSION = '0.116.0'
5
5
  end