eac_tools 0.102.1 → 0.103.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +46 -43
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +26 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/apache_host.rb +10 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/database.rb +27 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/files.rb +18 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/gitolite.rb +52 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/install.rb +43 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/nodejs.rb +19 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/web.rb +17 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base.rb +53 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/deploy.rb +16 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/docker_image.rb +110 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/entity_base.rb +31 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/project.rb +21 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/root.rb +17 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/wiki_page.rb +50 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api.rb +10 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/docker.rb +15 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page/read.rb +25 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page/write.rb +68 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page.rb +26 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project.rb +22 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project_rename.rb +53 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/base.rb +32 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/core_update.rb +125 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/runners/core_update.rb +61 -0
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/runners/docker.rb +16 -0
- data/sub/{avm-git/lib/avm/git → avm-eac_redmine_base0/lib/avm/eac_redmine_base0}/version.rb +2 -2
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0.rb +16 -0
- data/sub/avm-eac_redmine_base0/locale/en.yml +6 -0
- data/sub/avm-eac_redmine_base0/locale/pt-BR.yml +6 -0
- data/sub/avm-eac_redmine_base0/spec/lib/avm/eac_redmine_base0/instances/apache_host_spec.rb +22 -0
- data/sub/avm-eac_redmine_base0/spec/lib/avm/eac_redmine_base0/instances/apache_host_spec_files/apache_host_spec_no_ssl_content.conf +11 -0
- data/sub/avm-eac_redmine_base0/spec/lib/avm/eac_redmine_base0/instances/base/gitolite_spec.rb +26 -0
- data/sub/avm-eac_redmine_base0/spec/lib/avm/eac_redmine_base0/instances/base/gitolite_spec_files/config.yml +10 -0
- data/sub/{avm-git → avm-eac_redmine_base0}/spec/spec_helper.rb +3 -2
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/deploy/config/install.sh.template +45 -0
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/deploy/config/secrets.yml +8 -0
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/Dockerfile.template +37 -0
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/apache_host_dockerfile +8 -0
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/apache_http_virtualhost.conf.template +10 -0
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/apache_https_virtualhost.conf.template +16 -0
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/apache_path_dockerfile +5 -0
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/start.sh.template +52 -0
- data/sub/eac_cli/Gemfile +8 -0
- data/sub/eac_cli/eac_cli.gemspec +23 -0
- data/sub/eac_cli/lib/eac_cli/config/entry/options.rb +55 -0
- data/sub/eac_cli/lib/eac_cli/config/entry/undefined.rb +26 -0
- data/sub/eac_cli/lib/eac_cli/config/entry.rb +55 -0
- data/sub/eac_cli/lib/eac_cli/config.rb +15 -0
- data/sub/eac_cli/lib/eac_cli/core_ext.rb +4 -0
- data/sub/eac_cli/lib/eac_cli/default_runner.rb +12 -0
- data/sub/eac_cli/lib/eac_cli/definition/alternative.rb +101 -0
- data/sub/eac_cli/lib/eac_cli/definition/argument_option.rb +19 -0
- data/sub/eac_cli/lib/eac_cli/definition/boolean_option.rb +25 -0
- data/sub/eac_cli/lib/eac_cli/definition/error.rb +8 -0
- data/sub/eac_cli/lib/eac_cli/definition/option/initialize_args_parser.rb +48 -0
- data/sub/eac_cli/lib/eac_cli/definition/option.rb +70 -0
- data/sub/eac_cli/lib/eac_cli/definition/option_or_positional.rb +41 -0
- data/sub/eac_cli/lib/eac_cli/definition/positional.rb +50 -0
- data/sub/eac_cli/lib/eac_cli/definition.rb +104 -0
- data/sub/eac_cli/lib/eac_cli/enum.rb +42 -0
- data/sub/eac_cli/lib/eac_cli/old_configs/entry_reader.rb +76 -0
- data/sub/eac_cli/lib/eac_cli/old_configs/password_entry_reader.rb +14 -0
- data/sub/eac_cli/lib/eac_cli/old_configs/read_entry_options.rb +42 -0
- data/sub/eac_cli/lib/eac_cli/old_configs/store_passwords_entry_reader.rb +23 -0
- data/sub/eac_cli/lib/eac_cli/old_configs.rb +31 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/any_options.rb +17 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/argv.rb +19 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/double_dash.rb +24 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/long_options.rb +37 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/option_argument.rb +29 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/options.rb +29 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/positionals.rb +30 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +54 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative.rb +99 -0
- data/sub/eac_cli/lib/eac_cli/parser/collector.rb +52 -0
- data/sub/eac_cli/lib/eac_cli/parser/error.rb +13 -0
- data/sub/eac_cli/lib/eac_cli/parser.rb +32 -0
- data/sub/eac_cli/lib/eac_cli/patches/object/runner_with.rb +22 -0
- data/sub/eac_cli/lib/eac_cli/patches/object.rb +5 -0
- data/sub/{avm-git/lib/avm/git/issue.rb → eac_cli/lib/eac_cli/patches.rb} +0 -7
- data/sub/eac_cli/lib/eac_cli/rspec/setup.rb +41 -0
- data/sub/eac_cli/lib/eac_cli/rspec.rb +7 -0
- data/sub/eac_cli/lib/eac_cli/runner/after_class_methods.rb +34 -0
- data/sub/eac_cli/lib/eac_cli/runner/class_runner.rb +32 -0
- data/sub/eac_cli/lib/eac_cli/runner/context.rb +57 -0
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/base.rb +22 -0
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/parent.rb +24 -0
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/runner.rb +17 -0
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/runner_missing_method.rb +29 -0
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/set.rb +41 -0
- data/sub/{avm-git/lib/avm/git/launcher_stereotypes.rb → eac_cli/lib/eac_cli/runner/context_responders.rb} +3 -3
- data/sub/eac_cli/lib/eac_cli/runner/exit.rb +14 -0
- data/sub/eac_cli/lib/eac_cli/runner/for_context.rb +35 -0
- data/sub/eac_cli/lib/eac_cli/runner/instance_methods.rb +45 -0
- data/sub/eac_cli/lib/eac_cli/runner.rb +47 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/confirmation/input_result.rb +60 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/confirmation.rb +65 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/help/builder/alternative.rb +61 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/help/builder.rb +79 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/help/layout.rb +38 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/help.rb +51 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/input.rb +32 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output.rb +54 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_item/asciidoc_formatter.rb +70 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_item/base_formatter.rb +12 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_item/csv_formatter.rb +21 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_item/yaml_formatter.rb +16 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_item.rb +47 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_list/base_formatter.rb +44 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_list/csv_formatter.rb +24 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_list/tty_formatter.rb +34 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_list/yaml_formatter.rb +21 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_list.rb +39 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/subcommands/definition_concern.rb +10 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb +124 -0
- data/sub/eac_cli/lib/eac_cli/runner_with.rb +7 -0
- data/sub/eac_cli/lib/eac_cli/runner_with_set.rb +54 -0
- data/sub/eac_cli/lib/eac_cli/speaker/constants.rb +11 -0
- data/sub/eac_cli/lib/eac_cli/speaker/input_blocked.rb +14 -0
- data/sub/eac_cli/lib/eac_cli/speaker/input_requested.rb +8 -0
- data/sub/eac_cli/lib/eac_cli/speaker/list.rb +84 -0
- data/sub/eac_cli/lib/eac_cli/speaker/options.rb +42 -0
- data/sub/eac_cli/lib/eac_cli/speaker/request_from_list.rb +40 -0
- data/sub/eac_cli/lib/eac_cli/speaker.rb +114 -0
- data/sub/eac_cli/lib/eac_cli/version.rb +5 -0
- data/sub/eac_cli/lib/eac_cli.rb +14 -0
- data/sub/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +18 -0
- data/sub/eac_cli/spec/lib/eac_cli/old_configs_spec.rb +14 -0
- data/sub/eac_cli/spec/lib/eac_cli/parser/alternative/subcommands_spec.rb +58 -0
- data/sub/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +89 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner/for_context_spec.rb +79 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_spec.rb +129 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/confirmation/input_result_spec.rb +36 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/confirmation_spec.rb +42 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/help/layout_spec.rb +21 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +51 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/output_list_spec.rb +57 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/output_spec.rb +81 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +99 -0
- data/sub/eac_cli/spec/lib/eac_cli/speaker_spec.rb +36 -0
- data/sub/eac_cli/spec/rubocop_spec.rb +3 -0
- data/sub/eac_cli/spec/spec_helper.rb +4 -0
- metadata +157 -130
- data/sub/avm-git/avm-git.gemspec +0 -25
- data/sub/avm-git/lib/avm/git/application_scms/base/assert_main_at.rb +0 -44
- data/sub/avm-git/lib/avm/git/application_scms/base.rb +0 -18
- data/sub/avm-git/lib/avm/git/application_scms.rb +0 -9
- data/sub/avm-git/lib/avm/git/commit/class_methods.rb +0 -29
- data/sub/avm-git/lib/avm/git/commit/diff_tree_line.rb +0 -32
- data/sub/avm-git/lib/avm/git/commit/file.rb +0 -42
- data/sub/avm-git/lib/avm/git/commit.rb +0 -57
- data/sub/avm-git/lib/avm/git/issue/complete/commits.rb +0 -40
- data/sub/avm-git/lib/avm/git/issue/complete/git_subrepos.rb +0 -20
- data/sub/avm-git/lib/avm/git/issue/complete/local_branch.rb +0 -59
- data/sub/avm-git/lib/avm/git/issue/complete/local_tag.rb +0 -37
- data/sub/avm-git/lib/avm/git/issue/complete/push.rb +0 -60
- data/sub/avm-git/lib/avm/git/issue/complete/remote.rb +0 -33
- data/sub/avm-git/lib/avm/git/issue/complete/test.rb +0 -34
- data/sub/avm-git/lib/avm/git/issue/complete/tracker.rb +0 -21
- data/sub/avm-git/lib/avm/git/issue/complete/validation.rb +0 -36
- data/sub/avm-git/lib/avm/git/issue/complete/validations.rb +0 -54
- data/sub/avm-git/lib/avm/git/issue/complete/working_tree.rb +0 -19
- data/sub/avm-git/lib/avm/git/issue/complete.rb +0 -66
- data/sub/avm-git/lib/avm/git/launcher/base/class_methods.rb +0 -28
- data/sub/avm-git/lib/avm/git/launcher/base/dirty_files.rb +0 -21
- data/sub/avm-git/lib/avm/git/launcher/base/remotes.rb +0 -37
- data/sub/avm-git/lib/avm/git/launcher/base/subrepo.rb +0 -42
- data/sub/avm-git/lib/avm/git/launcher/base/underlying.rb +0 -54
- data/sub/avm-git/lib/avm/git/launcher/base.rb +0 -81
- data/sub/avm-git/lib/avm/git/launcher/error.rb +0 -13
- data/sub/avm-git/lib/avm/git/launcher/mirror_update.rb +0 -36
- data/sub/avm-git/lib/avm/git/launcher/publish_base.rb +0 -127
- data/sub/avm-git/lib/avm/git/launcher/remote.rb +0 -53
- data/sub/avm-git/lib/avm/git/launcher/sub_warp_base.rb +0 -36
- data/sub/avm-git/lib/avm/git/launcher/warp_base.rb +0 -63
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git/local_project_mixin.rb +0 -16
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git/publish.rb +0 -13
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git/warp.rb +0 -25
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git.rb +0 -22
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo/publish.rb +0 -29
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo/warp.rb +0 -82
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb +0 -32
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree/publish.rb +0 -12
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree/warp.rb +0 -29
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb +0 -47
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/provider.rb +0 -17
- data/sub/avm-git/lib/avm/git/organize/reference_update.rb +0 -32
- data/sub/avm-git/lib/avm/git/organize/repository.rb +0 -74
- data/sub/avm-git/lib/avm/git/organize.rb +0 -9
- data/sub/avm-git/lib/avm/git/revision_test.rb +0 -102
- data/sub/avm-git/lib/avm/git/runners/base/commit.rb +0 -96
- data/sub/avm-git/lib/avm/git/runners/base/deploy.rb +0 -108
- data/sub/avm-git/lib/avm/git/runners/base/dirty_files.rb +0 -42
- data/sub/avm-git/lib/avm/git/runners/base/organize.rb +0 -72
- data/sub/avm-git/lib/avm/git/runners/base/revisions_test.rb +0 -63
- data/sub/avm-git/lib/avm/git/runners/base/subrepo/check.rb +0 -45
- data/sub/avm-git/lib/avm/git/runners/base/subrepo/clone.rb +0 -80
- data/sub/avm-git/lib/avm/git/runners/base/subrepo/fix.rb +0 -69
- data/sub/avm-git/lib/avm/git/runners/base/subrepo.rb +0 -17
- data/sub/avm-git/lib/avm/git/runners/base.rb +0 -40
- data/sub/avm-git/lib/avm/git/runners.rb +0 -9
- data/sub/avm-git/lib/avm/git/scms/git/branch.rb +0 -28
- data/sub/avm-git/lib/avm/git/scms/git/branches.rb +0 -17
- data/sub/avm-git/lib/avm/git/scms/git/change_tracker.rb +0 -34
- data/sub/avm-git/lib/avm/git/scms/git/changed_file.rb +0 -25
- data/sub/avm-git/lib/avm/git/scms/git/changed_files.rb +0 -21
- data/sub/avm-git/lib/avm/git/scms/git/commit/deploy.rb +0 -37
- data/sub/avm-git/lib/avm/git/scms/git/commit/deploy_methods.rb +0 -24
- data/sub/avm-git/lib/avm/git/scms/git/commit.rb +0 -64
- data/sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb +0 -32
- data/sub/avm-git/lib/avm/git/scms/git/commits.rb +0 -44
- data/sub/avm-git/lib/avm/git/scms/git/interval.rb +0 -28
- data/sub/avm-git/lib/avm/git/scms/git/milestones.rb +0 -18
- data/sub/avm-git/lib/avm/git/scms/git/remote.rb +0 -18
- data/sub/avm-git/lib/avm/git/scms/git/remotes.rb +0 -29
- data/sub/avm-git/lib/avm/git/scms/git/run_commit.rb +0 -54
- data/sub/avm-git/lib/avm/git/scms/git.rb +0 -46
- data/sub/avm-git/lib/avm/git/scms/git_sub_base/changed_file.rb +0 -19
- data/sub/avm-git/lib/avm/git/scms/git_sub_base/commit.rb +0 -23
- data/sub/avm-git/lib/avm/git/scms/git_sub_base/interval.rb +0 -23
- data/sub/avm-git/lib/avm/git/scms/git_sub_base.rb +0 -30
- data/sub/avm-git/lib/avm/git/scms/git_subrepo.rb +0 -33
- data/sub/avm-git/lib/avm/git/scms/git_subtree.rb +0 -29
- data/sub/avm-git/lib/avm/git/scms/provider.rb +0 -16
- data/sub/avm-git/lib/avm/git/scms.rb +0 -9
- data/sub/avm-git/lib/avm/git/subrepo_check/parent.rb +0 -48
- data/sub/avm-git/lib/avm/git/subrepo_check/remote.rb +0 -86
- data/sub/avm-git/lib/avm/git/subrepo_check/show_result.rb +0 -30
- data/sub/avm-git/lib/avm/git/subrepo_check.rb +0 -36
- data/sub/avm-git/lib/avm/git/subrepo_checks.rb +0 -57
- data/sub/avm-git/lib/avm/git/vendor/github.rb +0 -20
- data/sub/avm-git/lib/avm/git/vendor.rb +0 -9
- data/sub/avm-git/lib/avm/git.rb +0 -16
- data/sub/avm-git/locale/en.yml +0 -6
- data/sub/avm-git/locale/pt-BR.yml +0 -6
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec.rb +0 -13
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.source.out +0 -1
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.target.yaml +0 -7
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/modify.source.out +0 -1
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/modify.target.yaml +0 -7
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/remove.source.out +0 -1
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/remove.target.yaml +0 -7
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename.source.out +0 -2
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename.target.yaml +0 -13
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename_modify.source.out +0 -2
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename_modify.target.yaml +0 -13
- data/sub/avm-git/spec/lib/avm/git/commit_spec.rb +0 -56
- data/sub/avm-git/spec/lib/avm/git/launcher/base_spec.rb +0 -45
- data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/publish_spec.rb +0 -83
- data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/publish_spec_files/config.yml +0 -5
- data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/publish_spec_settings.yml +0 -6
- data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/warp_spec.rb +0 -53
- data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/warp_spec_files/config.yml +0 -3
- data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/warp_spec_settings.yml +0 -6
- data/sub/avm-git/spec/lib/avm/git/runners/base/deploy_spec.rb +0 -126
- data/sub/avm-git/spec/lib/avm/git/runners/base/deploy_spec_files/append1/stub3.txt.template +0 -1
- data/sub/avm-git/spec/lib/avm/git/runners/base/deploy_spec_files/append2/stub4.txt +0 -1
- data/sub/avm-git/spec/lib/avm/git/scms/git/commit/deploy_spec.rb +0 -92
- data/sub/avm-git/spec/lib/avm/git/scms/git_spec.rb +0 -8
- data/sub/avm-git/spec/lib/avm/git/scms/git_subrepo_spec.rb +0 -8
- data/sub/avm-git/spec/lib/avm/git/vendor/github_spec.rb +0 -23
- /data/sub/{avm-git → avm-eac_redmine_base0}/Gemfile +0 -0
- /data/sub/{avm-git → avm-eac_redmine_base0}/spec/rubocop_spec.rb +0 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
module RunnerWith
|
5
|
+
module OutputList
|
6
|
+
class BaseFormatter
|
7
|
+
acts_as_abstract :to_output
|
8
|
+
common_constructor :columns, :rows
|
9
|
+
|
10
|
+
# @return [String]
|
11
|
+
def build_column(column)
|
12
|
+
column.to_s
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [Array<String>]
|
16
|
+
def build_columns
|
17
|
+
columns.map(&:to_s)
|
18
|
+
end
|
19
|
+
|
20
|
+
# @param row [Object]
|
21
|
+
# @return [Object]
|
22
|
+
def build_row(_row)
|
23
|
+
raise_abstract_method __method__
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Array<Hash<String, String>>]
|
27
|
+
def build_rows
|
28
|
+
rows.map { |row| build_row(row) }
|
29
|
+
end
|
30
|
+
|
31
|
+
# @param row [Object]
|
32
|
+
# @param column [String]
|
33
|
+
# @return [Object]
|
34
|
+
def build_value(row, column)
|
35
|
+
return row.send(column) if row.respond_to?(column)
|
36
|
+
return row.with_indifferent_access.fetch(column) if row.is_a?(::Hash)
|
37
|
+
|
38
|
+
raise ::ArgumentError, "Row \"#{row}\" do not respond to column \"#{column}\" neither " \
|
39
|
+
"is a Hash (Row: #{row}, Column: #{column})"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'csv'
|
4
|
+
|
5
|
+
module EacCli
|
6
|
+
module RunnerWith
|
7
|
+
module OutputList
|
8
|
+
class CsvFormatter < ::EacCli::RunnerWith::OutputList::BaseFormatter
|
9
|
+
# @return [Array]
|
10
|
+
def build_row(row)
|
11
|
+
build_columns.map { |c| build_value(row, c) }
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [String]
|
15
|
+
def to_output
|
16
|
+
::CSV.generate do |csv|
|
17
|
+
csv << build_columns
|
18
|
+
build_rows.each { |row| csv << row }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'tty/table'
|
4
|
+
|
5
|
+
module EacCli
|
6
|
+
module RunnerWith
|
7
|
+
module OutputList
|
8
|
+
class TtyFormatter < ::EacCli::RunnerWith::OutputList::BaseFormatter
|
9
|
+
# @param row [Object]
|
10
|
+
# @return [Array]
|
11
|
+
def build_row(row)
|
12
|
+
build_columns.map { |c| build_value(row, c) }
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [String]
|
16
|
+
def to_output
|
17
|
+
"#{tty_table_output}\n"
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [TTY::Table]
|
21
|
+
def tty_table
|
22
|
+
::TTY::Table.new(build_columns, build_rows)
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [String]
|
26
|
+
def tty_table_output
|
27
|
+
tty_table.render(:unicode, multiline: true) do |renderer|
|
28
|
+
renderer.border.separator = ->(row) { ((row + 1) % columns.count).zero? }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module EacCli
|
6
|
+
module RunnerWith
|
7
|
+
module OutputList
|
8
|
+
class YamlFormatter < ::EacCli::RunnerWith::OutputList::BaseFormatter
|
9
|
+
# @return [Hash<String, String>]
|
10
|
+
def build_row(row)
|
11
|
+
build_columns.inject({}) { |a, e| a.merge(e => build_value(row, e).to_s) }
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [String]
|
15
|
+
def to_output
|
16
|
+
::YAML.dump(build_rows)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
module RunnerWith
|
5
|
+
module OutputList
|
6
|
+
require_sub __FILE__
|
7
|
+
|
8
|
+
FORMATS = {
|
9
|
+
'csv' => ::EacCli::RunnerWith::OutputList::CsvFormatter,
|
10
|
+
'tty' => ::EacCli::RunnerWith::OutputList::TtyFormatter,
|
11
|
+
'yaml' => ::EacCli::RunnerWith::OutputList::YamlFormatter
|
12
|
+
}.freeze
|
13
|
+
|
14
|
+
common_concern do
|
15
|
+
acts_as_abstract :list_columns, :list_rows
|
16
|
+
include ::EacCli::RunnerWith::Output
|
17
|
+
|
18
|
+
runner_definition do
|
19
|
+
arg_opt '-f', '--format', 'Format to output list.', default: 'yaml'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [String]
|
24
|
+
def output_content
|
25
|
+
formatter.to_output
|
26
|
+
end
|
27
|
+
|
28
|
+
# @return [EacCli::RunnerWith::OutputList::BaseFormatter]
|
29
|
+
def formatter
|
30
|
+
formatter_class.new(list_columns, list_rows)
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [Class]
|
34
|
+
def formatter_class
|
35
|
+
FORMATS.fetch(parsed.format)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
module RunnerWith
|
5
|
+
module Subcommands
|
6
|
+
require_sub __FILE__
|
7
|
+
|
8
|
+
class << self
|
9
|
+
delegate :runner?, to: :'::EacCli::Runner'
|
10
|
+
|
11
|
+
# @return [Hash<String, EacCli::Runner>]
|
12
|
+
def subcommands_from_module(a_module)
|
13
|
+
a_module.constants
|
14
|
+
.map { |name| [name.to_s.underscore.gsub('_', '-'), a_module.const_get(name)] }
|
15
|
+
.select { |c| runner?(c[1]) }
|
16
|
+
.to_h.with_indifferent_access
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
common_concern do
|
21
|
+
include ::EacCli::Runner
|
22
|
+
runner_definition.singleton_class
|
23
|
+
.include(::EacCli::RunnerWith::Subcommands::DefinitionConcern)
|
24
|
+
end
|
25
|
+
|
26
|
+
EXTRA_AVAILABLE_SUBCOMMANDS_METHOD_NAME = :extra_available_subcommands
|
27
|
+
|
28
|
+
def available_subcommands
|
29
|
+
@available_subcommands ||= available_subcommands_auto.merge(available_subcommands_extra)
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [Hash<String, EacCli::Runner>]
|
33
|
+
def available_subcommands_auto
|
34
|
+
::EacCli::RunnerWith::Subcommands.subcommands_from_module(self.class)
|
35
|
+
end
|
36
|
+
|
37
|
+
def available_subcommands_extra
|
38
|
+
if respond_to?(EXTRA_AVAILABLE_SUBCOMMANDS_METHOD_NAME, true)
|
39
|
+
send(EXTRA_AVAILABLE_SUBCOMMANDS_METHOD_NAME)
|
40
|
+
else
|
41
|
+
{}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def available_subcommands_to_s
|
46
|
+
available_subcommands.keys.sort.join(', ')
|
47
|
+
end
|
48
|
+
|
49
|
+
# @return [Hash<String, Enumerable<String>]
|
50
|
+
def help_extra_text
|
51
|
+
help_list_section('Subcommands', available_subcommands.keys.sort)
|
52
|
+
end
|
53
|
+
|
54
|
+
def method_missing(method_name, *arguments, &block)
|
55
|
+
return run_with_subcommand(*arguments, &block) if
|
56
|
+
run_with_subcommand_alias_run?(method_name)
|
57
|
+
|
58
|
+
super
|
59
|
+
end
|
60
|
+
|
61
|
+
def respond_to_missing?(method_name, include_private = false)
|
62
|
+
run_with_subcommand_alias_run?(method_name) || super
|
63
|
+
end
|
64
|
+
|
65
|
+
def run_with_subcommand
|
66
|
+
if run_subcommand?
|
67
|
+
if subcommand_runner.respond_to?(:run_run)
|
68
|
+
subcommand_runner.run_run
|
69
|
+
else
|
70
|
+
subcommand_runner.run
|
71
|
+
end
|
72
|
+
else
|
73
|
+
run_without_subcommand
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def run_with_subcommand_alias_run?(method_name)
|
78
|
+
subcommands? && method_name.to_sym == :run
|
79
|
+
end
|
80
|
+
|
81
|
+
def run_without_subcommand
|
82
|
+
"Method #{__method__} should be overrided in #{self.class.name}"
|
83
|
+
end
|
84
|
+
|
85
|
+
def run_subcommand?
|
86
|
+
subcommand_name.present?
|
87
|
+
end
|
88
|
+
|
89
|
+
def subcommands?
|
90
|
+
self.class.runner_definition.subcommands?
|
91
|
+
end
|
92
|
+
|
93
|
+
def subcommand_args
|
94
|
+
parsed.fetch(::EacCli::Definition::SUBCOMMAND_ARGS_ARG)
|
95
|
+
end
|
96
|
+
|
97
|
+
def subcommand_class
|
98
|
+
available_subcommands[subcommand_name].if_present { |v| return v }
|
99
|
+
|
100
|
+
raise(::EacCli::Parser::Error.new(
|
101
|
+
self.class.runner_definition, runner_context.argv,
|
102
|
+
"Subcommand \"#{subcommand_name}\" not found " \
|
103
|
+
"(Available: #{available_subcommands_to_s})"
|
104
|
+
))
|
105
|
+
end
|
106
|
+
|
107
|
+
def subcommand_name
|
108
|
+
parsed.fetch(::EacCli::Definition::SUBCOMMAND_NAME_ARG)
|
109
|
+
end
|
110
|
+
|
111
|
+
def subcommand_program
|
112
|
+
[program_name, subcommand_name]
|
113
|
+
end
|
114
|
+
|
115
|
+
def subcommand_runner
|
116
|
+
@subcommand_runner ||= subcommand_class.create(
|
117
|
+
argv: subcommand_args,
|
118
|
+
program_name: subcommand_program,
|
119
|
+
parent: self
|
120
|
+
)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
class RunnerWithSet
|
5
|
+
class << self
|
6
|
+
def default
|
7
|
+
@default ||= new
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def add_namespace(namespace)
|
12
|
+
namespace = sanitize_namespace(namespace)
|
13
|
+
namespace_set << namespace unless namespace_set.include?(namespace)
|
14
|
+
self
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_from_gems_registry
|
18
|
+
::EacRubyUtils::GemsRegistry.new('RunnerWith').registered.each do |registered_gem|
|
19
|
+
add_namespace(registered_gem.registered_module)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def item_to_module(item)
|
24
|
+
item.is_a?(::Module) ? item : key_to_module(item)
|
25
|
+
end
|
26
|
+
|
27
|
+
def namespaces
|
28
|
+
namespace_set.dup
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def namespace_set
|
34
|
+
@namespace_set ||= []
|
35
|
+
end
|
36
|
+
|
37
|
+
def key_to_module(key)
|
38
|
+
namespace_set.lazy
|
39
|
+
.map { |namespace| key_to_module_in_namespace(namespace, key) }
|
40
|
+
.find(&:present?) ||
|
41
|
+
raise("Not module found with key \"#{key}\" (Namespaces: #{namespace_set})")
|
42
|
+
end
|
43
|
+
|
44
|
+
def key_to_module_in_namespace(namespace, key)
|
45
|
+
namespace.const_get(key.to_s.camelize)
|
46
|
+
rescue ::NameError
|
47
|
+
nil
|
48
|
+
end
|
49
|
+
|
50
|
+
def sanitize_namespace(source)
|
51
|
+
source.is_a?(::Module) ? source : source.to_s.constantize
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
class Speaker
|
5
|
+
module Constants
|
6
|
+
STDERR = ::EacRubyUtils::ByReference.new { $stderr }
|
7
|
+
STDIN = ::EacRubyUtils::ByReference.new { $stdin }
|
8
|
+
STDOUT = ::EacRubyUtils::ByReference.new { $stdout }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
class Speaker
|
5
|
+
class InputBlocked
|
6
|
+
%w[gets noecho].each do |method|
|
7
|
+
define_method(method) do
|
8
|
+
raise ::EacCli::Speaker::InputRequested,
|
9
|
+
"Method (\"#{method}\") was requested, but input is blocked"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/hash_with_indifferent_access'
|
4
|
+
require 'ostruct'
|
5
|
+
|
6
|
+
module EacCli
|
7
|
+
class Speaker
|
8
|
+
class List
|
9
|
+
VALUE_STRUCT = ::Struct.new(:key, :label, :value)
|
10
|
+
|
11
|
+
class << self
|
12
|
+
# @param list [Array, Hash]
|
13
|
+
# @param options [Hash]
|
14
|
+
def build(list, options = {})
|
15
|
+
return List.new(hash_to_values(list), options) if list.is_a?(::Hash)
|
16
|
+
return List.new(array_to_values(list), options) if list.is_a?(::Array)
|
17
|
+
|
18
|
+
raise "Invalid list: #{list} (#{list.class})"
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def hash_to_values(list)
|
24
|
+
list.map { |key, value| VALUE_STRUCT.new(key, key, value) }
|
25
|
+
end
|
26
|
+
|
27
|
+
def array_to_values(list)
|
28
|
+
list.map { |value| VALUE_STRUCT.new(value, value, value) }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
DEFAULT_IGNORE_CASE = true
|
33
|
+
|
34
|
+
enable_listable
|
35
|
+
lists.add_symbol :option, :ignore_case
|
36
|
+
|
37
|
+
# @!attribute [r] values
|
38
|
+
# @return [Array<VALUE_STRUCT>]
|
39
|
+
# # @!attribute [r] options
|
40
|
+
# @return [Hash]
|
41
|
+
# @!method initialize(values)
|
42
|
+
# @param values [Array<VALUE_STRUCT>]
|
43
|
+
# @param options [Hash]
|
44
|
+
common_constructor :values, :options, default: [{}] do
|
45
|
+
self.options = self.class.lists.option.hash_keys_validate!(options)
|
46
|
+
self.values = values.map do |v|
|
47
|
+
VALUE_STRUCT.new(to_key(v.key), to_label(v.label), v.value)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [Boolean]
|
52
|
+
def ignore_case?
|
53
|
+
options.if_key(OPTION_IGNORE_CASE, DEFAULT_IGNORE_CASE, &:to_bool)
|
54
|
+
end
|
55
|
+
|
56
|
+
def valid_labels
|
57
|
+
values.map(&:label)
|
58
|
+
end
|
59
|
+
|
60
|
+
def valid_value?(value)
|
61
|
+
values.any? { |v| v.key == to_key(value) }
|
62
|
+
end
|
63
|
+
|
64
|
+
# @param value [Object]
|
65
|
+
# @return [String]
|
66
|
+
def to_key(value)
|
67
|
+
r = to_label(value)
|
68
|
+
ignore_case? ? r.downcase : r
|
69
|
+
end
|
70
|
+
|
71
|
+
def to_label(value)
|
72
|
+
value.to_s.strip
|
73
|
+
end
|
74
|
+
|
75
|
+
def build_value(value)
|
76
|
+
key = to_key(value)
|
77
|
+
values.each do |v|
|
78
|
+
return v.value if v.key == key
|
79
|
+
end
|
80
|
+
raise "Value not found: \"#{value}\" (#{values})"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
class Speaker
|
5
|
+
module Options
|
6
|
+
common_concern do
|
7
|
+
enable_listable
|
8
|
+
lists.add_symbol :option, :out_out, :err_out, :in_in, :parent, :err_line_prefix,
|
9
|
+
:ignore_case
|
10
|
+
end
|
11
|
+
|
12
|
+
def err_out
|
13
|
+
option(OPTION_ERR_OUT, $stderr)
|
14
|
+
end
|
15
|
+
|
16
|
+
def out_out
|
17
|
+
option(OPTION_OUT_OUT, $stdout)
|
18
|
+
end
|
19
|
+
|
20
|
+
def in_in
|
21
|
+
option(OPTION_IN_IN, $stdin)
|
22
|
+
end
|
23
|
+
|
24
|
+
# @return [Boolean]
|
25
|
+
def ignore_case
|
26
|
+
option(OPTION_IGNORE_CASE, nil)
|
27
|
+
end
|
28
|
+
|
29
|
+
def err_line_prefix
|
30
|
+
option(OPTION_ERR_LINE_PREFIX, '')
|
31
|
+
end
|
32
|
+
|
33
|
+
def parent
|
34
|
+
options[OPTION_PARENT]
|
35
|
+
end
|
36
|
+
|
37
|
+
def option(key, default)
|
38
|
+
options[key] || parent.if_present(default) { |v| v.send(__METHOD__) }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
class Speaker
|
5
|
+
class RequestFromList
|
6
|
+
acts_as_instance_method
|
7
|
+
enable_simple_cache
|
8
|
+
common_constructor :speaker, :question, :list_values, :noecho,
|
9
|
+
:ignore_case
|
10
|
+
|
11
|
+
# @return [String]
|
12
|
+
def result
|
13
|
+
loop do
|
14
|
+
return list.build_value(input) if list.valid_value?(input)
|
15
|
+
|
16
|
+
speaker.warn "Invalid input: \"#{input}\" (Valid: #{list.valid_labels.join(', ')})"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
# @return [String]
|
23
|
+
def input_uncached
|
24
|
+
speaker.send(
|
25
|
+
:request_string,
|
26
|
+
"#{question} [#{list.valid_labels.join('/')}]",
|
27
|
+
noecho
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [EacCli::Speaker::List]
|
32
|
+
def list_uncached
|
33
|
+
list_options = {}
|
34
|
+
list_options[::EacCli::Speaker::List::OPTION_IGNORE_CASE] = ignore_case unless
|
35
|
+
ignore_case.nil?
|
36
|
+
::EacCli::Speaker::List.build(list_values, list_options)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
class Speaker
|
5
|
+
require_sub __FILE__, include_modules: true
|
6
|
+
include ::EacRubyUtils::Speaker::Receiver
|
7
|
+
|
8
|
+
common_constructor :options, default: [{}] do
|
9
|
+
self.options = self.class.lists.option.hash_keys_validate!(options)
|
10
|
+
end
|
11
|
+
|
12
|
+
def puts(string = '')
|
13
|
+
string.to_s.each_line do |line|
|
14
|
+
err_out.puts(err_line_prefix.to_s + line)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def out(string = '')
|
19
|
+
out_out.write(string.to_s)
|
20
|
+
end
|
21
|
+
|
22
|
+
def error(string)
|
23
|
+
puts "ERROR: #{string}".white.on_red
|
24
|
+
end
|
25
|
+
|
26
|
+
def title(string)
|
27
|
+
string = string.to_s
|
28
|
+
puts(('-' * (8 + string.length)).green)
|
29
|
+
puts("--- #{string} ---".green)
|
30
|
+
puts(('-' * (8 + string.length)).green)
|
31
|
+
puts
|
32
|
+
end
|
33
|
+
|
34
|
+
def info(string)
|
35
|
+
puts string.to_s.white
|
36
|
+
end
|
37
|
+
|
38
|
+
def infom(string)
|
39
|
+
puts string.to_s.light_yellow
|
40
|
+
end
|
41
|
+
|
42
|
+
def warn(string)
|
43
|
+
puts string.to_s.yellow
|
44
|
+
end
|
45
|
+
|
46
|
+
# Options:
|
47
|
+
# +bool+ ([Boolean], default: +false+): requires a answer "yes" or "no".
|
48
|
+
# +list+ ([Hash] or [Array], default: +nil+): requires a answer from a list.
|
49
|
+
# +noecho+ ([Boolean], default: +false+): does not output answer.
|
50
|
+
def input(question, options = {})
|
51
|
+
bool, list, noecho, ignore_case =
|
52
|
+
options.to_options_consumer.consume_all(:bool, :list, :noecho, :ignore_case)
|
53
|
+
if list
|
54
|
+
request_from_list(question, list, noecho, ignore_case)
|
55
|
+
elsif bool
|
56
|
+
request_from_bool(question, noecho)
|
57
|
+
else
|
58
|
+
request_string(question, noecho)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def infov(*args)
|
63
|
+
r = []
|
64
|
+
args.each_with_index do |v, i|
|
65
|
+
if i.even?
|
66
|
+
r << "#{v}: ".cyan
|
67
|
+
else
|
68
|
+
r.last << v.to_s
|
69
|
+
end
|
70
|
+
end
|
71
|
+
puts r.join(', ')
|
72
|
+
end
|
73
|
+
|
74
|
+
def success(string)
|
75
|
+
puts string.to_s.green
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
def list_value(list, input)
|
81
|
+
values = list_values(list)
|
82
|
+
return input, true unless values
|
83
|
+
|
84
|
+
[input, false] unless values.include?(input)
|
85
|
+
end
|
86
|
+
|
87
|
+
def list_values(list)
|
88
|
+
if list.is_a?(::Hash)
|
89
|
+
list.keys.map(&:to_s)
|
90
|
+
elsif list.is_a?(::Array)
|
91
|
+
list.map(&:to_s)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def request_from_bool(question, noecho)
|
96
|
+
request_from_list(question, { yes: true, y: true, no: false, n: false }, noecho, true)
|
97
|
+
end
|
98
|
+
|
99
|
+
def request_string(question, noecho)
|
100
|
+
err_out.write "#{question}: ".yellow
|
101
|
+
noecho ? request_string_noecho : request_string_echo
|
102
|
+
end
|
103
|
+
|
104
|
+
def request_string_noecho
|
105
|
+
r = in_in.noecho(&:gets).chomp.strip
|
106
|
+
err_out.write("\n")
|
107
|
+
r
|
108
|
+
end
|
109
|
+
|
110
|
+
def request_string_echo
|
111
|
+
in_in.gets.chomp.strip
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|