eac_tools 0.75.2 → 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 +5 -5
- data/Gemfile.lock +69 -71
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm-eac_redmine_base0/Gemfile +2 -2
- data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +8 -6
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/install.rb +9 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/docker_image.rb +1 -1
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/entity_base.rb +2 -2
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/core_update.rb +1 -1
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
- data/sub/avm-eac_redmine_base0/spec/lib/avm/eac_redmine_base0/instances/apache_host_spec.rb +3 -3
- data/sub/avm-eac_redmine_base0/spec/lib/avm/eac_redmine_base0/instances/base/gitolite_spec.rb +1 -1
- data/sub/avm-eac_redmine_base0/spec/rubocop_spec.rb +1 -1
- data/sub/avm-eac_redmine_base0/spec/spec_helper.rb +2 -2
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/deploy/config/install.sh.template +3 -0
- 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
- data/sub/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/module_ancestors_variable.rb +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- metadata +10 -179
- 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
@@ -18,9 +18,9 @@ module EacCli
|
|
18
18
|
responders_instances.any?(&:callable?)
|
19
19
|
end
|
20
20
|
|
21
|
-
def call(
|
21
|
+
def call(...)
|
22
22
|
caller = responder_to_call
|
23
|
-
return caller.call(
|
23
|
+
return caller.call(...) if caller
|
24
24
|
|
25
25
|
raise ::NameError, "No method \"#{method_name}\" found in #{runner} or in its ancestors"
|
26
26
|
end
|
@@ -26,7 +26,7 @@ module EacCli
|
|
26
26
|
|
27
27
|
def option_usage_full(option)
|
28
28
|
if option.long.present?
|
29
|
-
[option.short, option_long(option)].
|
29
|
+
[option.short, option_long(option)].compact_blank.join(word_separator)
|
30
30
|
else
|
31
31
|
option_short(option)
|
32
32
|
end
|
@@ -53,7 +53,7 @@ module EacCli
|
|
53
53
|
def option_definition(option)
|
54
54
|
[self.class.option_usage_full(option), option.description,
|
55
55
|
option.default_value? ? "[Default: \"#{option.default_value}\"]" : nil]
|
56
|
-
.
|
56
|
+
.compact_blank.join(OPTION_DESCRIPTION_SEPARATOR)
|
57
57
|
end
|
58
58
|
|
59
59
|
# @return [String]
|
@@ -105,7 +105,7 @@ module EacCli
|
|
105
105
|
raise(::EacCli::Parser::Error.new(
|
106
106
|
self.class.runner_definition, runner_context.argv,
|
107
107
|
"Subcommand \"#{subcommand_name}\" not found " \
|
108
|
-
|
108
|
+
"(Available: #{available_subcommands_to_s})"
|
109
109
|
))
|
110
110
|
end
|
111
111
|
|
@@ -17,11 +17,11 @@ module EacCli
|
|
17
17
|
private
|
18
18
|
|
19
19
|
def hash_to_values(list)
|
20
|
-
list.map { |key, value| ::OpenStruct.new(key: key, label: key, value: value) }
|
20
|
+
list.map { |key, value| ::OpenStruct.new(key: key, label: key, value: value) } # rubocop:disable Style/OpenStructUse
|
21
21
|
end
|
22
22
|
|
23
23
|
def array_to_values(list)
|
24
|
-
list.map { |value| ::OpenStruct.new(key: value, label: value, value: value) }
|
24
|
+
list.map { |value| ::OpenStruct.new(key: value, label: value, value: value) } # rubocop:disable Style/OpenStructUse
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -29,7 +29,7 @@ module EacCli
|
|
29
29
|
|
30
30
|
def initialize(values)
|
31
31
|
@values = values.map do |v|
|
32
|
-
::OpenStruct.new(key: to_key(v.key), label: to_label(v.label), value: v.value)
|
32
|
+
::OpenStruct.new(key: to_key(v.key), label: to_label(v.label), value: v.value) # rubocop:disable Style/OpenStructUse
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -51,7 +51,7 @@ module EacCli
|
|
51
51
|
|
52
52
|
def build_value(value)
|
53
53
|
key = to_key(value)
|
54
|
-
values.each do |v|
|
54
|
+
values.each do |v|
|
55
55
|
return v.value if v.key == key
|
56
56
|
end
|
57
57
|
raise "Value not found: \"#{value}\" (#{values})"
|
@@ -11,15 +11,15 @@ module EacCli
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def err_out
|
14
|
-
option(OPTION_ERR_OUT,
|
14
|
+
option(OPTION_ERR_OUT, $stderr)
|
15
15
|
end
|
16
16
|
|
17
17
|
def out_out
|
18
|
-
option(OPTION_OUT_OUT,
|
18
|
+
option(OPTION_OUT_OUT, $stdout)
|
19
19
|
end
|
20
20
|
|
21
21
|
def in_in
|
22
|
-
option(OPTION_IN_IN,
|
22
|
+
option(OPTION_IN_IN, $stdin)
|
23
23
|
end
|
24
24
|
|
25
25
|
def err_line_prefix
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'eac_cli/definition/alternative'
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe EacCli::Definition::Alternative do
|
6
6
|
let(:instance) { described_class.new }
|
7
7
|
|
8
8
|
it { expect { instance.arg_opt '-a', '--opt2', 'A argument option' }.not_to raise_error }
|
@@ -10,7 +10,7 @@ RSpec.describe ::EacCli::Definition::Alternative do
|
|
10
10
|
it { expect { instance.bool_opt '-b', '--no-description' }.not_to raise_error }
|
11
11
|
it { expect { instance.bool_opt '--opt1', 'A option without short' }.not_to raise_error }
|
12
12
|
it { expect { instance.bool_opt '-b', 'A option without long' }.not_to raise_error }
|
13
|
-
it { expect { instance.bool_opt 'A option without selectors' }.to raise_error(
|
13
|
+
it { expect { instance.bool_opt 'A option without selectors' }.to raise_error(StandardError) }
|
14
14
|
it { expect { instance.options_argument(true) }.not_to raise_error }
|
15
15
|
it { expect { instance.pos_arg :pos1 }.not_to raise_error }
|
16
16
|
it { expect { instance.pos_arg :pos2, optional: true, repeat: true }.not_to raise_error }
|
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
require 'eac_cli/parser/alternative'
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe EacCli::Parser::Alternative do
|
6
6
|
let(:instance) { described_class.new(alternative, argv) }
|
7
7
|
let(:actual_parsed) { instance.parsed.to_h.symbolize_keys }
|
8
8
|
|
9
9
|
context 'without subcommands' do
|
10
10
|
let(:alternative) do
|
11
|
-
r =
|
11
|
+
r = EacCli::Definition::Alternative.new
|
12
12
|
r.bool_opt '-b', '--opt1', 'A boolean option'
|
13
13
|
r.arg_opt '-a', '--opt2', 'A argument option'
|
14
14
|
r.bool_opt '-c', '--opt3', 'A required boolean option', required: true
|
@@ -73,7 +73,7 @@ RSpec.describe ::EacCli::Parser::Alternative do
|
|
73
73
|
|
74
74
|
context 'with excedent positional' do
|
75
75
|
let(:alternative) do
|
76
|
-
r =
|
76
|
+
r = EacCli::Definition::Alternative.new
|
77
77
|
r.pos_arg :pos1
|
78
78
|
r
|
79
79
|
end
|
@@ -88,7 +88,7 @@ RSpec.describe ::EacCli::Parser::Alternative do
|
|
88
88
|
|
89
89
|
context 'with subcommands' do
|
90
90
|
let(:alternative) do
|
91
|
-
r =
|
91
|
+
r = EacCli::Definition::Alternative.new
|
92
92
|
r.bool_opt '-b', '--opt1', 'A boolean option'
|
93
93
|
r.arg_opt '-a', '--opt2', 'A argument option'
|
94
94
|
r.subcommands
|
@@ -100,8 +100,8 @@ RSpec.describe ::EacCli::Parser::Alternative do
|
|
100
100
|
let(:parsed_expected) do
|
101
101
|
{
|
102
102
|
opt1: true, opt2: 'OPT2',
|
103
|
-
|
104
|
-
|
103
|
+
EacCli::Definition::Alternative::SUBCOMMAND_NAME_ARG => 'CMD',
|
104
|
+
EacCli::Definition::Alternative::SUBCOMMAND_ARGS_ARG => %w[CMD_ARG_1 --CMD_ARG_2]
|
105
105
|
}
|
106
106
|
end
|
107
107
|
|
@@ -114,8 +114,8 @@ RSpec.describe ::EacCli::Parser::Alternative do
|
|
114
114
|
let(:parsed_expected) do
|
115
115
|
{
|
116
116
|
opt1: false, opt2: nil,
|
117
|
-
|
118
|
-
|
117
|
+
EacCli::Definition::Alternative::SUBCOMMAND_NAME_ARG => 'CMD',
|
118
|
+
EacCli::Definition::Alternative::SUBCOMMAND_ARGS_ARG => []
|
119
119
|
}
|
120
120
|
end
|
121
121
|
|
@@ -128,8 +128,8 @@ RSpec.describe ::EacCli::Parser::Alternative do
|
|
128
128
|
let(:parsed_expected) do
|
129
129
|
{
|
130
130
|
opt1: true, opt2: nil,
|
131
|
-
|
132
|
-
|
131
|
+
EacCli::Definition::Alternative::SUBCOMMAND_NAME_ARG => nil,
|
132
|
+
EacCli::Definition::Alternative::SUBCOMMAND_ARGS_ARG => []
|
133
133
|
}
|
134
134
|
end
|
135
135
|
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
require 'eac_cli/runner'
|
4
4
|
|
5
|
-
|
5
|
+
RSpec.describe EacCli::Runner, '#for_context' do # rubocop:disable RSpec/MultipleMemoizedHelpers
|
6
6
|
let(:parent_runner_class) do
|
7
7
|
example = self
|
8
|
-
|
8
|
+
Class.new do
|
9
9
|
include example.described_class
|
10
10
|
|
11
11
|
def self.name
|
@@ -22,9 +22,9 @@ require 'eac_cli/runner'
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
let(:
|
25
|
+
let(:child_runner_class1) do # rubocop:disable RSpec/IndexedLet
|
26
26
|
example = self
|
27
|
-
|
27
|
+
Class.new do
|
28
28
|
include example.described_class
|
29
29
|
|
30
30
|
def self.name
|
@@ -39,9 +39,9 @@ require 'eac_cli/runner'
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
let(:
|
42
|
+
let(:child_runner_class2) do # rubocop:disable RSpec/IndexedLet
|
43
43
|
example = self
|
44
|
-
|
44
|
+
Class.new do
|
45
45
|
include example.described_class
|
46
46
|
|
47
47
|
def self.name
|
@@ -58,22 +58,22 @@ require 'eac_cli/runner'
|
|
58
58
|
let(:context_args) { [{ argv: [], parent: parent_runner }] }
|
59
59
|
let(:child_runner) { child_runner_class.create(*context_args) }
|
60
60
|
|
61
|
-
it { expect(parent_runner.for_context?(:method_for_context)).to
|
62
|
-
it { expect(parent_runner.for_context?(:method_not_for_context)).to
|
61
|
+
it { expect(parent_runner.for_context?(:method_for_context)).to be(true) }
|
62
|
+
it { expect(parent_runner.for_context?(:method_not_for_context)).to be(false) }
|
63
63
|
|
64
|
-
context 'when method is for context' do
|
65
|
-
let(:child_runner_class) {
|
64
|
+
context 'when method is for context' do # rubocop:disable RSpec/MultipleMemoizedHelpers
|
65
|
+
let(:child_runner_class) { child_runner_class1 }
|
66
66
|
|
67
67
|
it do
|
68
68
|
expect { child_runner.run }.not_to raise_error
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
context 'when method is not for context' do
|
73
|
-
let(:child_runner_class) {
|
72
|
+
context 'when method is not for context' do # rubocop:disable RSpec/MultipleMemoizedHelpers
|
73
|
+
let(:child_runner_class) { child_runner_class2 }
|
74
74
|
|
75
75
|
it do
|
76
|
-
expect { child_runner.run }.to raise_error(
|
76
|
+
expect { child_runner.run }.to raise_error(NameError)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
require 'eac_cli/runner'
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe EacCli::Runner do
|
6
6
|
let(:runner_class) do
|
7
7
|
the_module = described_class
|
8
|
-
|
8
|
+
Class.new do
|
9
9
|
include the_module
|
10
10
|
|
11
11
|
runner_definition do
|
@@ -37,7 +37,7 @@ RSpec.describe ::EacCli::Runner do
|
|
37
37
|
|
38
38
|
it { expect(parsed_actual).to eq(parsed_expected) }
|
39
39
|
it { expect(instance.parsed.opt1).to eq('aaa') }
|
40
|
-
it { expect(instance.parsed.opt2?).to
|
40
|
+
it { expect(instance.parsed.opt2?).to be(true) }
|
41
41
|
it { expect(instance.parsed.pos1).to eq('bbb') }
|
42
42
|
it { expect(instance.parsed.pos2).to eq(%w[ccc ddd]) }
|
43
43
|
end
|
@@ -52,14 +52,14 @@ RSpec.describe ::EacCli::Runner do
|
|
52
52
|
let(:argv) { %w[-po aaa pos1] }
|
53
53
|
|
54
54
|
it { expect(instance.parsed.opt1).to eq('aaa') }
|
55
|
-
it { expect(instance.parsed.opt2?).to
|
55
|
+
it { expect(instance.parsed.opt2?).to be(true) }
|
56
56
|
end
|
57
57
|
|
58
58
|
context 'with invalid grouped short options' do
|
59
59
|
let(:argv) { %w[-op aaa pos1] }
|
60
60
|
|
61
61
|
it do
|
62
|
-
expect { instance.parsed }.to raise_error(
|
62
|
+
expect { instance.parsed }.to raise_error(EacCli::Parser::Error)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -72,7 +72,7 @@ RSpec.describe ::EacCli::Runner do
|
|
72
72
|
|
73
73
|
it { expect(parsed_actual).to eq(parsed_expected) }
|
74
74
|
it { expect(instance.parsed.opt1).to be_nil }
|
75
|
-
it { expect(instance.parsed.opt2?).to
|
75
|
+
it { expect(instance.parsed.opt2?).to be(false) }
|
76
76
|
it { expect(instance.parsed.pos1).to eq('bbb') }
|
77
77
|
it { expect(instance.parsed.pos2).to eq([]) }
|
78
78
|
end
|
@@ -81,7 +81,7 @@ RSpec.describe ::EacCli::Runner do
|
|
81
81
|
let(:argv) { %w[] }
|
82
82
|
|
83
83
|
it do
|
84
|
-
expect { instance.parsed }.to raise_error(
|
84
|
+
expect { instance.parsed }.to raise_error(EacCli::Parser::Error)
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
@@ -93,7 +93,7 @@ RSpec.describe ::EacCli::Runner do
|
|
93
93
|
end
|
94
94
|
|
95
95
|
it { expect(parsed_actual).to eq(parsed_expected) }
|
96
|
-
it { expect(instance.parsed.opt3?).to
|
96
|
+
it { expect(instance.parsed.opt3?).to be(true) }
|
97
97
|
end
|
98
98
|
|
99
99
|
context 'when repeated options are supplied' do
|
@@ -109,7 +109,7 @@ RSpec.describe ::EacCli::Runner do
|
|
109
109
|
context 'when extra args are not supplied' do
|
110
110
|
let(:runner_class) do
|
111
111
|
the_module = described_class
|
112
|
-
|
112
|
+
Class.new do
|
113
113
|
include the_module
|
114
114
|
|
115
115
|
runner_definition do
|
@@ -123,7 +123,7 @@ RSpec.describe ::EacCli::Runner do
|
|
123
123
|
let(:argv) { %w[aaa bbb] }
|
124
124
|
|
125
125
|
it do
|
126
|
-
expect { instance.parsed }.to raise_error(
|
126
|
+
expect { instance.parsed }.to raise_error(EacCli::Parser::Error)
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'eac_cli/runner_with/confirmation'
|
4
4
|
|
5
|
-
|
5
|
+
RSpec.describe EacCli::RunnerWith::Confirmation do
|
6
6
|
let(:runner) do
|
7
7
|
the_module = described_class
|
8
8
|
Class.new do
|
@@ -14,9 +14,9 @@ require 'eac_cli/runner_with/confirmation'
|
|
14
14
|
|
15
15
|
def run
|
16
16
|
if confirm?
|
17
|
-
|
17
|
+
Kernel.puts 'Accepted'
|
18
18
|
else
|
19
|
-
|
19
|
+
Kernel.puts 'Denied'
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'eac_cli/runner_with/help'
|
4
4
|
require 'eac_ruby_utils/fs/temp'
|
5
5
|
|
6
|
-
RSpec.describe
|
6
|
+
RSpec.describe EacCli::RunnerWith::Help do
|
7
7
|
let(:runner) do
|
8
8
|
the_module = described_class
|
9
9
|
Class.new do
|
@@ -22,7 +22,8 @@ RSpec.describe ::EacCli::RunnerWith::Help do
|
|
22
22
|
|
23
23
|
[
|
24
24
|
['--help'],
|
25
|
-
['trash-pos-arg-before', '--help', 'trash-pos-arg-after'
|
25
|
+
['trash-pos-arg-before', '--help', 'trash-pos-arg-after', '--any-option', '-XYZ',
|
26
|
+
'other-trash-arg']
|
26
27
|
].each do |runner_argv|
|
27
28
|
context "when runner ARGV is #{runner_argv}" do
|
28
29
|
let(:instance) { runner.create(argv: runner_argv) }
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'eac_cli/runner_with/output'
|
4
4
|
require 'eac_ruby_utils/fs/temp'
|
5
5
|
|
6
|
-
RSpec.describe
|
6
|
+
RSpec.describe EacCli::RunnerWith::Output do
|
7
7
|
let(:runner) do
|
8
8
|
the_module = described_class
|
9
9
|
Class.new do
|
@@ -36,7 +36,7 @@ RSpec.describe ::EacCli::RunnerWith::Output do
|
|
36
36
|
r.temp_dir = temp_dir
|
37
37
|
r
|
38
38
|
end
|
39
|
-
let(:temp_dir) {
|
39
|
+
let(:temp_dir) { EacRubyUtils::Fs::Temp.directory }
|
40
40
|
|
41
41
|
after { temp_dir.remove }
|
42
42
|
|
@@ -49,17 +49,17 @@ RSpec.describe ::EacCli::RunnerWith::Output do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
context 'without --output option as to stdout' do
|
52
|
-
let(:runner_argv) { ['--output',
|
52
|
+
let(:runner_argv) { ['--output', EacCli::RunnerWith::Output::STDOUT_OPTION, stub_text] }
|
53
53
|
|
54
54
|
it do
|
55
55
|
expect { instance.run }.to output(stub_text).to_stdout_from_any_process
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
context 'without --output option as to default file' do
|
59
|
+
context 'without --output option as to default file' do # rubocop:disable RSpec/MultipleMemoizedHelpers
|
60
60
|
let(:output_file) { temp_dir.join('default_file') }
|
61
61
|
let(:runner_argv) do
|
62
|
-
['--output',
|
62
|
+
['--output', EacCli::RunnerWith::Output::DEFAULT_FILE_OPTION,
|
63
63
|
stub_text]
|
64
64
|
end
|
65
65
|
|
@@ -69,7 +69,7 @@ RSpec.describe ::EacCli::RunnerWith::Output do
|
|
69
69
|
it { expect(output_file.read).to eq(stub_text) }
|
70
70
|
end
|
71
71
|
|
72
|
-
context 'with --output option' do
|
72
|
+
context 'with --output option' do # rubocop:disable RSpec/MultipleMemoizedHelpers
|
73
73
|
let(:output_file) { temp_dir.join('a output file') }
|
74
74
|
let(:runner_argv) { ['--output', output_file.to_path, stub_text] }
|
75
75
|
|
@@ -4,7 +4,7 @@ require 'eac_cli/runner'
|
|
4
4
|
require 'eac_cli/runner_with/help'
|
5
5
|
require 'eac_cli/runner_with/subcommands'
|
6
6
|
|
7
|
-
RSpec.describe
|
7
|
+
RSpec.describe EacCli::RunnerWith::Subcommands do
|
8
8
|
let(:parent_runner) do
|
9
9
|
the_module = described_class
|
10
10
|
the_child = child_runner
|
@@ -26,8 +26,8 @@ RSpec.describe ::EacCli::RunnerWith::Subcommands do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
let(:child_runner) do
|
29
|
-
|
30
|
-
include
|
29
|
+
Class.new do
|
30
|
+
include EacCli::Runner
|
31
31
|
|
32
32
|
runner_definition do
|
33
33
|
bool_opt '-c', '--child-opt', 'A boolean option.'
|
@@ -49,7 +49,7 @@ RSpec.describe ::EacCli::RunnerWith::Subcommands do
|
|
49
49
|
it { expect(instance.parsed.root_var).to eq('123') }
|
50
50
|
it { expect(instance.parsed.subcommand).to eq('child-cmd') }
|
51
51
|
it { expect(instance.parsed.subcommand_args).to eq(%w[--child-opt 456]) }
|
52
|
-
it { expect(instance.subcommand_runner.parsed.child_opt).to
|
52
|
+
it { expect(instance.subcommand_runner.parsed.child_opt).to be(true) }
|
53
53
|
it { expect(instance.subcommand_runner.parsed.child_var).to eq('456') }
|
54
54
|
|
55
55
|
it do
|
@@ -61,7 +61,7 @@ RSpec.describe ::EacCli::RunnerWith::Subcommands do
|
|
61
61
|
let(:instance) { parent_runner.create(%w[456]) }
|
62
62
|
|
63
63
|
it do
|
64
|
-
expect { instance.run }.to raise_error(
|
64
|
+
expect { instance.run }.to raise_error(EacCli::Parser::Error)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -88,7 +88,7 @@ RSpec.describe ::EacCli::RunnerWith::Subcommands do
|
|
88
88
|
end
|
89
89
|
|
90
90
|
before do
|
91
|
-
parent_runner.include(
|
91
|
+
parent_runner.include(EacCli::RunnerWith::Help)
|
92
92
|
end
|
93
93
|
|
94
94
|
it 'show help text' do
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.files = Dir['{lib}/**/*', 'MIT-LICENSE', 'README.rdoc']
|
17
17
|
|
18
18
|
s.add_dependency 'activesupport', '>= 4', '< 7'
|
19
|
-
s.add_dependency 'addressable', '~> 2.8', '>= 2.8.
|
19
|
+
s.add_dependency 'addressable', '~> 2.8', '>= 2.8.5'
|
20
20
|
s.add_dependency 'bundler'
|
21
21
|
s.add_dependency 'filesize', '~> 0.2'
|
22
22
|
s.add_dependency 'net-ssh', '~> 4.2'
|