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,45 @@
|
|
1
|
+
# Ruby
|
2
|
+
export ruby_version='%%INSTALL.RUBY.VERSION%%'
|
3
|
+
|
4
|
+
# NodeJs
|
5
|
+
export nodejs_version='%%INSTALL.NODEJS.VERSION%%'
|
6
|
+
|
7
|
+
# Database
|
8
|
+
export postgresql_internal='%%DATABASE_INTERNAL%%'
|
9
|
+
export postgresql_host='%%DATABASE.HOSTNAME%%'
|
10
|
+
export postgresql_port='%%DATABASE.PORT%%'
|
11
|
+
export postgresql_database='%%DATABASE.NAME%%'
|
12
|
+
export postgresql_user='%%DATABASE.USERNAME%%'
|
13
|
+
export postgresql_password='%%DATABASE.PASSWORD%%'
|
14
|
+
export postgresql_version='%%POSTGRESQL.VERSION%%'
|
15
|
+
export postgresql_extra_settings='%%DATABASE.EXTRA%%'
|
16
|
+
|
17
|
+
# Web
|
18
|
+
if [ '%%WEB.SCHEME%%' == 'https' ]; then
|
19
|
+
export address_https='true'
|
20
|
+
else
|
21
|
+
export address_https='false'
|
22
|
+
fi
|
23
|
+
export address_host='%%WEB.AUTHORITY%%'
|
24
|
+
export address_path='%%WEB.PATH%%'
|
25
|
+
|
26
|
+
# Git
|
27
|
+
export git_repositories_hierarchical_organisation=false
|
28
|
+
export gitolite_user='%%GITOLITE.USERNAME%%'
|
29
|
+
export gitolite_user_home='%%GITOLITE.PATH%%'
|
30
|
+
export redmine_git_hosting_ssh_key_name=redmine_git_hosting_id
|
31
|
+
|
32
|
+
# Mail settings
|
33
|
+
export smtp_server='%%MAILER.SMTP.ADDRESS%%'
|
34
|
+
export smtp_port='%%MAILER.SMTP.PORT%%'
|
35
|
+
export smtp_domain='%%MAILER.SMTP.DOMAIN%%'
|
36
|
+
export smtp_tls='%%MAILER.SMTP.TLS%%'
|
37
|
+
export smtp_enable_starttls_auto='%%MAILER.SMTP.STARTTLS_AUTO%%'
|
38
|
+
export smtp_openssl_verify_mode='%%MAILER.SMTP.OPENSSL_VERIFY_MODE%%'
|
39
|
+
export smtp_authentication='%%MAILER.SMTP.AUTHENTICATION%%'
|
40
|
+
export smtp_username='%%MAILER.SMTP.USERNAME%%'
|
41
|
+
export smtp_password='%%MAILER.SMTP.PASSWORD%%'
|
42
|
+
export mail_from='%%MAILER.FROM%%'
|
43
|
+
|
44
|
+
# Extra
|
45
|
+
%%INSTALL.EXTRA%%
|
@@ -0,0 +1,37 @@
|
|
1
|
+
FROM '%%base_image%%'
|
2
|
+
USER root
|
3
|
+
|
4
|
+
# Redmine / Código-fonte
|
5
|
+
RUN echo '%%redmine_source_git_id%%' '%%redmine_user_home%%/redmine_source_git_id'
|
6
|
+
ADD '%%redmine_source_path%%' '%%redmine_path%%/'
|
7
|
+
RUN chown -R '%%redmine_user%%:%%redmine_user%%' '%%redmine_user_home%%'
|
8
|
+
|
9
|
+
# Redmine / Configuração de instalação
|
10
|
+
USER '%%redmine_user%%'
|
11
|
+
WORKDIR '%%redmine_user_home%%'
|
12
|
+
COPY install_settings.sh "%%redmine_path%%/config/install.sh"
|
13
|
+
|
14
|
+
# Redmine / Instalação
|
15
|
+
USER '%%redmine_user%%'
|
16
|
+
WORKDIR '%%redmine_user_home%%'
|
17
|
+
RUN SKIP_DATABASE='%%skip_database%%' \
|
18
|
+
'%%redmine_path%%/plugins/redmine_installer/installer/run.sh' '%%installer_target_task%%'
|
19
|
+
|
20
|
+
# Apache / Configuração do virtualhost
|
21
|
+
%%apache_setup%%
|
22
|
+
|
23
|
+
# Portas
|
24
|
+
EXPOSE 80/tcp 443/tcp
|
25
|
+
|
26
|
+
# Servidor SSH
|
27
|
+
%%ssh_server_install%%
|
28
|
+
|
29
|
+
# Execução
|
30
|
+
USER root
|
31
|
+
COPY start.sh '%%start_path%%'
|
32
|
+
RUN /bin/chmod +x '%%start_path%%'
|
33
|
+
RUN /bin/chown '%%redmine_user%%:%%redmine_user%%' '%%start_path%%'
|
34
|
+
RUN chmod 755 '%%redmine_user_home%%'
|
35
|
+
USER '%%redmine_user%%'
|
36
|
+
WORKDIR '%%redmine_user_home%%'
|
37
|
+
CMD '%%start_path%%'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
COPY apache_http_virtualhost.conf /etc/apache2/sites-available/redmine.conf
|
2
|
+
COPY apache_https_virtualhost.conf /etc/apache2/sites-available/redmine_ssl.conf
|
3
|
+
USER root
|
4
|
+
RUN a2ensite redmine
|
5
|
+
RUN a2ensite redmine_ssl
|
6
|
+
RUN a2dissite 000-default
|
7
|
+
RUN a2enmod ssl
|
8
|
+
RUN service apache2 restart
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<IfModule mod_ssl.c>
|
2
|
+
<VirtualHost _default_:443>
|
3
|
+
SSLEngine on
|
4
|
+
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
|
5
|
+
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
|
6
|
+
|
7
|
+
DocumentRoot "%%redmine_path%%/public"
|
8
|
+
PassengerEnabled On
|
9
|
+
|
10
|
+
<Directory "%%redmine_path%%/public" >
|
11
|
+
Allow from all
|
12
|
+
Options -MultiViews
|
13
|
+
Require all granted
|
14
|
+
</Directory>
|
15
|
+
</VirtualHost>
|
16
|
+
</IfModule>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -u
|
4
|
+
set -e
|
5
|
+
|
6
|
+
source '%%redmine_path%%/plugins/redmine_installer/installer/environment.sh'
|
7
|
+
|
8
|
+
function title() {
|
9
|
+
infom ">>>> $1 <<<<"
|
10
|
+
}
|
11
|
+
|
12
|
+
function redmine_install() {
|
13
|
+
title 'Installing Redmine...'
|
14
|
+
"$INSTALL_ROOT/run.sh" '%%installer_target_task%%'
|
15
|
+
}
|
16
|
+
|
17
|
+
function apache_start() {
|
18
|
+
title 'Restarting Apache HTTPD service...'
|
19
|
+
sudo service apache2 restart
|
20
|
+
}
|
21
|
+
|
22
|
+
function ssh_start() {
|
23
|
+
title 'Restarting SSH service...'
|
24
|
+
sudo service ssh restart
|
25
|
+
}
|
26
|
+
|
27
|
+
function postgresql_start() {
|
28
|
+
if bool_r "$SKIP_DATABASE"; then return 0; fi
|
29
|
+
if ! bool_r "$postgresql_internal"; then return 0; fi
|
30
|
+
|
31
|
+
title 'Restarting PostgresSQL service...'
|
32
|
+
sudo service postgresql restart
|
33
|
+
}
|
34
|
+
|
35
|
+
function request_http_interface() {
|
36
|
+
title 'Requesting web interface...'
|
37
|
+
wget 'http://localhost%%web.path%%' &> /dev/null
|
38
|
+
}
|
39
|
+
|
40
|
+
function redmine_log() {
|
41
|
+
title 'Reading production log...'
|
42
|
+
LOG_FILE='%%redmine_path%%/log/production.log'
|
43
|
+
printf " * tail -f \"$LOG_FILE\":\n"
|
44
|
+
sudo tail -f "$LOG_FILE"
|
45
|
+
}
|
46
|
+
|
47
|
+
redmine_install
|
48
|
+
apache_start
|
49
|
+
ssh_start
|
50
|
+
postgresql_start
|
51
|
+
request_http_interface
|
52
|
+
redmine_log
|
data/sub/eac_cli/Gemfile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
+
|
5
|
+
require 'eac_cli/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'eac_cli'
|
9
|
+
s.version = EacCli::VERSION
|
10
|
+
s.authors = ['Esquilo Azul Company']
|
11
|
+
s.summary = 'Utilities to build CLI applications with Ruby.'
|
12
|
+
|
13
|
+
s.files = Dir['{lib}/**/*', 'Gemfile']
|
14
|
+
|
15
|
+
s.required_ruby_version = '>= 2.7.0'
|
16
|
+
|
17
|
+
s.add_dependency 'colorize', '~> 0.8', '>= 0.8.1'
|
18
|
+
s.add_dependency 'eac_config', '~> 0.15'
|
19
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.128', '>= 0.128.3'
|
20
|
+
s.add_dependency 'tty-table', '~> 0.12'
|
21
|
+
|
22
|
+
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.12'
|
23
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
class Config < ::SimpleDelegator
|
5
|
+
class Entry < ::EacConfig::NodeEntry
|
6
|
+
class Options
|
7
|
+
enable_simple_cache
|
8
|
+
enable_listable
|
9
|
+
|
10
|
+
lists.add_symbol :type, :undefined
|
11
|
+
|
12
|
+
DEFAULT_VALUES = {
|
13
|
+
before_input: nil, bool: false, list: false, noecho: false, noenv: false, noinput: false,
|
14
|
+
required: true, store: true, type: TYPE_UNDEFINED, validator: nil
|
15
|
+
}.freeze
|
16
|
+
|
17
|
+
lists.add_symbol :option, *DEFAULT_VALUES.keys
|
18
|
+
|
19
|
+
common_constructor :options do
|
20
|
+
self.options = self.class.lists.option.hash_keys_validate!(options)
|
21
|
+
end
|
22
|
+
|
23
|
+
delegate :to_h, to: :options
|
24
|
+
|
25
|
+
def [](key)
|
26
|
+
values.fetch(key.to_sym)
|
27
|
+
end
|
28
|
+
|
29
|
+
def request_input_options
|
30
|
+
values.slice(:bool, :list, :noecho)
|
31
|
+
end
|
32
|
+
|
33
|
+
DEFAULT_VALUES.each do |attr, default_value|
|
34
|
+
define_method(attr.to_s + ([true, false].include?(default_value) ? '?' : '')) do
|
35
|
+
self[attr]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def values_uncached
|
42
|
+
consumer = options.to_options_consumer
|
43
|
+
r = {}
|
44
|
+
DEFAULT_VALUES.each do |key, default_value|
|
45
|
+
value = consumer.consume(key)
|
46
|
+
value = default_value if value.nil?
|
47
|
+
r[key] = value
|
48
|
+
end
|
49
|
+
consumer.validate
|
50
|
+
r
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
class Config < ::SimpleDelegator
|
5
|
+
class Entry < ::EacConfig::NodeEntry
|
6
|
+
module Undefined
|
7
|
+
private
|
8
|
+
|
9
|
+
def undefined_value
|
10
|
+
loop do
|
11
|
+
entry_value = undefined_value_no_loop
|
12
|
+
next unless options[:validator].if_present(true) { |v| v.call(entry_value) }
|
13
|
+
|
14
|
+
return entry_value
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def undefined_value_no_loop
|
19
|
+
input("Value for entry \"#{path}\"", options.request_input_options)
|
20
|
+
rescue ::EacCli::Speaker::InputRequested
|
21
|
+
raise ::EacConfig::Entry::NotFoundError, self
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
class Config < ::SimpleDelegator
|
5
|
+
class Entry < ::EacConfig::NodeEntry
|
6
|
+
require_sub __FILE__, include_modules: true
|
7
|
+
enable_listable
|
8
|
+
enable_simple_cache
|
9
|
+
enable_speaker
|
10
|
+
|
11
|
+
common_constructor :root_node, :path, :options, super_args: -> { [root_node, path] } do
|
12
|
+
self.options = ::EacCli::Config::Entry::Options.new(options)
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [EacCli::Config]
|
16
|
+
def config
|
17
|
+
root_node
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [Object, nil]
|
21
|
+
def value
|
22
|
+
sub_entry.found? ? sub_value_to_return : nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def value!
|
26
|
+
return sub_value_to_return if sub_entry.found?
|
27
|
+
return nil unless options.required?
|
28
|
+
|
29
|
+
input_value
|
30
|
+
end
|
31
|
+
|
32
|
+
def secret_value
|
33
|
+
self.class.new(config, path, options.to_h.merge(noecho: true).to_h).value
|
34
|
+
end
|
35
|
+
|
36
|
+
delegate :found?, :value=, to: :sub_entry
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def sub_value_to_return
|
41
|
+
sub_entry.value.presence || ::EacRubyUtils::BlankNotBlank.instance
|
42
|
+
end
|
43
|
+
|
44
|
+
def sub_entry_uncached
|
45
|
+
config.sub.entry(path)
|
46
|
+
end
|
47
|
+
|
48
|
+
def input_value_uncached
|
49
|
+
r = send("#{options.type}_value")
|
50
|
+
sub_entry.value = r if options.store?
|
51
|
+
r
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
class Definition
|
5
|
+
class Alternative
|
6
|
+
ANY_OPTION_DESCRIPTION = 'ANY_OPTION'
|
7
|
+
ANY_OPTION_LONG = '__'
|
8
|
+
ANY_OPTION_SHORT = '_'
|
9
|
+
SUBCOMMAND_NAME_ARG = :subcommand
|
10
|
+
SUBCOMMAND_ARGS_ARG = :subcommand_args
|
11
|
+
|
12
|
+
# @return [Boolean]
|
13
|
+
def any_opt
|
14
|
+
@any_opt = true
|
15
|
+
end
|
16
|
+
|
17
|
+
# @return [Boolean]
|
18
|
+
def any_option?
|
19
|
+
@any_opt ? true : false
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [EacCli::Definition::BooleanOption]
|
23
|
+
def any_options_option
|
24
|
+
@any_options_option ||= ::EacCli::Definition::BooleanOption.new(
|
25
|
+
ANY_OPTION_SHORT, ANY_OPTION_LONG, ANY_OPTION_DESCRIPTION,
|
26
|
+
optional: true, repeat: true, usage: false
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def arg_opt(*args)
|
31
|
+
options_set << ::EacCli::Definition::ArgumentOption.from_args(args)
|
32
|
+
end
|
33
|
+
|
34
|
+
def bool_opt(*args)
|
35
|
+
options_set << ::EacCli::Definition::BooleanOption.from_args(args)
|
36
|
+
end
|
37
|
+
|
38
|
+
def options
|
39
|
+
options_set.to_a
|
40
|
+
end
|
41
|
+
|
42
|
+
def options_argument?
|
43
|
+
@options_argument ? true : false
|
44
|
+
end
|
45
|
+
|
46
|
+
def options_argument(enable)
|
47
|
+
@options_argument = enable
|
48
|
+
|
49
|
+
self
|
50
|
+
end
|
51
|
+
|
52
|
+
def pos_arg(name, arg_options = {})
|
53
|
+
new_pos_arg = ::EacCli::Definition::Positional.new(name, arg_options)
|
54
|
+
check_positional_blocked(new_pos_arg)
|
55
|
+
pos_set << new_pos_arg
|
56
|
+
end
|
57
|
+
|
58
|
+
def positional
|
59
|
+
pos_set.to_a
|
60
|
+
end
|
61
|
+
|
62
|
+
def positional_arguments_blocked_reason(new_pos_arg)
|
63
|
+
last = pos_set.last
|
64
|
+
return nil unless last
|
65
|
+
return 'there are subcommands' if subcommands?
|
66
|
+
return 'last argument repeats' if last.repeat?
|
67
|
+
return 'new argument is required and last is optional' if
|
68
|
+
last.optional? && new_pos_arg.if_present(&:required?)
|
69
|
+
|
70
|
+
nil
|
71
|
+
end
|
72
|
+
|
73
|
+
def subcommands
|
74
|
+
pos_arg(SUBCOMMAND_NAME_ARG, subcommand: true)
|
75
|
+
pos_set << ::EacCli::Definition::Positional.new(SUBCOMMAND_ARGS_ARG,
|
76
|
+
optional: true, repeat: true)
|
77
|
+
end
|
78
|
+
|
79
|
+
def subcommands?
|
80
|
+
pos_set.any?(&:subcommand?)
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
def check_positional_blocked(new_pos_arg)
|
86
|
+
positional_arguments_blocked_reason(new_pos_arg).if_present do |v|
|
87
|
+
raise ::EacCli::Definition::Error, "Positional arguments are blocked: #{v} " \
|
88
|
+
"(New argument: #{new_pos_arg})"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def pos_set
|
93
|
+
@pos_set ||= []
|
94
|
+
end
|
95
|
+
|
96
|
+
def options_set
|
97
|
+
@options_set ||= []
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
class Definition
|
5
|
+
class ArgumentOption < ::EacCli::Definition::Option
|
6
|
+
def argument?
|
7
|
+
true
|
8
|
+
end
|
9
|
+
|
10
|
+
def build_value(new_value, previous_value)
|
11
|
+
repeat? ? previous_value + [new_value] : new_value
|
12
|
+
end
|
13
|
+
|
14
|
+
def default_default_value
|
15
|
+
repeat? ? [] : nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
class Definition
|
5
|
+
class BooleanOption < ::EacCli::Definition::Option
|
6
|
+
def argument?
|
7
|
+
false
|
8
|
+
end
|
9
|
+
|
10
|
+
def build_value(_new_value, previous_value)
|
11
|
+
repeat? ? previous_value + 1 : true
|
12
|
+
end
|
13
|
+
|
14
|
+
def default_value
|
15
|
+
return super unless default_value?
|
16
|
+
|
17
|
+
raise("Unallowed default value for boolean options (Option: #{self})")
|
18
|
+
end
|
19
|
+
|
20
|
+
def default_default_value
|
21
|
+
repeat? ? 0 : false
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
class Definition
|
5
|
+
class Option
|
6
|
+
class InitializeArgsParser
|
7
|
+
PROPERTIES = %i[short long description options].freeze
|
8
|
+
attr_reader(*PROPERTIES)
|
9
|
+
|
10
|
+
def initialize(args)
|
11
|
+
self.options = args.extract_options!.freeze
|
12
|
+
args.each { |arg| absorb_arg(arg) }
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
attr_writer(*PROPERTIES)
|
18
|
+
|
19
|
+
def absorb_arg(arg)
|
20
|
+
arg_ext = ArgumentParser.new(arg)
|
21
|
+
send("#{arg_ext.type}=", arg_ext.value)
|
22
|
+
end
|
23
|
+
|
24
|
+
class ArgumentParser
|
25
|
+
TYPES = %i[short long description].freeze
|
26
|
+
common_constructor :value
|
27
|
+
|
28
|
+
def type
|
29
|
+
TYPES.find { |type| send("#{type}?") } ||
|
30
|
+
raise(::EacCli::Definition::Error, "Unknown type for \"#{value}\"")
|
31
|
+
end
|
32
|
+
|
33
|
+
def short?
|
34
|
+
value.start_with?('-') && !long?
|
35
|
+
end
|
36
|
+
|
37
|
+
def long?
|
38
|
+
value.start_with?('--')
|
39
|
+
end
|
40
|
+
|
41
|
+
def description?
|
42
|
+
!short? || !long?
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
class Definition
|
5
|
+
# @abstract
|
6
|
+
class Option < ::EacCli::Definition::OptionOrPositional
|
7
|
+
require_sub __FILE__
|
8
|
+
|
9
|
+
class << self
|
10
|
+
# @param args [Enumerable<String>]
|
11
|
+
# @return [EacCli::Definition::Option]
|
12
|
+
def from_args(args)
|
13
|
+
p = ::EacCli::Definition::Option::InitializeArgsParser.new(args)
|
14
|
+
new(p.short, p.long, p.description, p.options)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
DEFAULT_REQUIRED = false
|
19
|
+
|
20
|
+
enable_abstract_methods
|
21
|
+
lists.add_symbol :option, *OPTION_LIST, :default, :usage
|
22
|
+
|
23
|
+
# @!method initialize(short, long, description, options = {})
|
24
|
+
# @param short [String]
|
25
|
+
# @param long [String]
|
26
|
+
# @param description [String]
|
27
|
+
# @param options [Hash<Symbol, Object>]
|
28
|
+
# @raise [EacCli::Definition::Error]
|
29
|
+
common_constructor :short, :long, :description, :options, default: [{}] do
|
30
|
+
validate
|
31
|
+
self.options = ::EacCli::Definition::Option.lists.option.hash_keys_validate!(
|
32
|
+
options.symbolize_keys
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [Object]
|
37
|
+
def default_value
|
38
|
+
default_value? ? options[OPTION_DEFAULT] : default_default_value
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [Boolean]
|
42
|
+
def default_value?
|
43
|
+
options.key?(OPTION_DEFAULT)
|
44
|
+
end
|
45
|
+
|
46
|
+
# @return [Symbol]
|
47
|
+
# @raise [EacCli::Definition::Error] If no short or long option is provided.
|
48
|
+
def identifier
|
49
|
+
[long, short].each do |v|
|
50
|
+
v.to_s.if_present { |vv| return vv.variableize.to_sym }
|
51
|
+
end
|
52
|
+
|
53
|
+
raise('No short or long option to build identifier')
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [Boolean]
|
57
|
+
def show_on_usage?
|
58
|
+
options[:usage]
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
# @return [void]
|
64
|
+
# @raise [EacCli::Definition::Error]
|
65
|
+
def validate
|
66
|
+
raise 'Nor short neither long selector was set' if short.blank? && long.blank?
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|