eac_tools 0.92.0 → 0.94.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +68 -53
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +3 -3
- data/sub/avm/lib/avm/launcher/context.rb +0 -5
- data/sub/avm/lib/avm/rspec/launcher_controller.rb +96 -0
- data/sub/avm/lib/avm/rspec/setup.rb +1 -1
- data/sub/avm/lib/avm/rspec/shared_examples/with_launcher.rb +16 -0
- data/sub/avm/lib/avm/scms/base.rb +1 -1
- data/sub/avm/lib/avm/sources/base/sub.rb +1 -1
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm/spec/lib/avm/launcher/context_spec.rb +2 -2
- data/sub/avm/spec/lib/avm/launcher/instances/base_spec.rb +2 -2
- data/sub/avm/template/avm/rspec/launcher_controller/settings.yml +1 -0
- data/sub/avm-eac_webapp_base0/Gemfile +8 -0
- data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +25 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/executables.rb +26 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/file_formats/css/file_apply.rb +48 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/file_formats/css.rb +22 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/file_formats/html.rb +43 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/file_formats/javascript.rb +22 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/file_formats/json.rb +25 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/file_formats/provider.rb +24 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/file_formats/xml.rb +26 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/file_formats.rb +11 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/apache_base.rb +33 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/apache_host.rb +78 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/apache_path.rb +42 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/base/apache.rb +44 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/base/deploy_info.rb +30 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/base/install.rb +22 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/base.rb +44 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/appended_directories.rb +27 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/build.rb +50 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/info.rb +47 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/scm.rb +88 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/setup_files_unit.rb +53 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy/write_on_target.rb +20 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy.rb +76 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/deploy_info.rb +37 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/processes/web_server.rb +37 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/processes.rb +13 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/apache_host.rb +36 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/apache_path.rb +40 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data/load.rb +60 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/deploy.rb +57 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/deploy_info.rb +28 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners.rb +13 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/sources/base.rb +15 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/sources.rb +11 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +7 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0.rb +9 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/css_spec.rb +7 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/css_spec_files/css1.source.css +11 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/css_spec_files/css1.target.css +11 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/html_spec.rb +7 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/html_spec_files/html_code.html.erb.source +8 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/html_spec_files/html_code.html.erb.target +8 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/html_spec_files/html_code.html.source +5 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/html_spec_files/html_code.html.target +5 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/javascript_spec.rb +7 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/javascript_spec_files/javascript_code1.js.source +29 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/javascript_spec_files/javascript_code1.js.target +21 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/json_spec.rb +7 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/json_spec_files/json_code.json.source +8 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/json_spec_files/json_code.json.target +7 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/xml_spec.rb +7 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/xml_spec_files/xml_code.xml.source +11 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/xml_spec_files/xml_code.xml.target +9 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/instances/base_spec.rb +11 -0
- data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/sources/base_spec.rb +7 -0
- data/sub/avm-eac_webapp_base0/spec/rubocop_spec.rb +3 -0
- data/sub/avm-eac_webapp_base0/spec/spec_helper.rb +4 -0
- data/sub/avm-eac_webapp_base0/template/avm/eac_webapp_base0/instances/apache_host/no_ssl.conf +11 -0
- data/sub/avm-eac_webapp_base0/template/avm/eac_webapp_base0/instances/apache_path/default.conf +7 -0
- data/sub/avm-git/Gemfile +8 -0
- data/sub/avm-git/avm-git.gemspec +25 -0
- data/sub/avm-git/lib/avm/git/application_scms/base/assert_main_at.rb +49 -0
- data/sub/avm-git/lib/avm/git/application_scms/base.rb +21 -0
- data/sub/avm-git/lib/avm/git/application_scms.rb +11 -0
- data/sub/avm-git/lib/avm/git/commit/class_methods.rb +31 -0
- data/sub/avm-git/lib/avm/git/commit/diff_tree_line.rb +32 -0
- data/sub/avm-git/lib/avm/git/commit/file.rb +46 -0
- data/sub/avm-git/lib/avm/git/commit.rb +59 -0
- data/sub/avm-git/lib/avm/git/issue/complete/commits.rb +42 -0
- data/sub/avm-git/lib/avm/git/issue/complete/git_subrepos.rb +23 -0
- data/sub/avm-git/lib/avm/git/issue/complete/local_branch.rb +61 -0
- data/sub/avm-git/lib/avm/git/issue/complete/local_tag.rb +39 -0
- data/sub/avm-git/lib/avm/git/issue/complete/push.rb +60 -0
- data/sub/avm-git/lib/avm/git/issue/complete/remote.rb +33 -0
- data/sub/avm-git/lib/avm/git/issue/complete/test.rb +40 -0
- data/sub/avm-git/lib/avm/git/issue/complete/tracker.rb +21 -0
- data/sub/avm-git/lib/avm/git/issue/complete/validation.rb +39 -0
- data/sub/avm-git/lib/avm/git/issue/complete/validations.rb +53 -0
- data/sub/avm-git/lib/avm/git/issue/complete/working_tree.rb +19 -0
- data/sub/avm-git/lib/avm/git/issue/complete.rb +69 -0
- data/sub/avm-git/lib/avm/git/issue.rb +11 -0
- data/sub/avm-git/lib/avm/git/launcher/base/class_methods.rb +28 -0
- data/sub/avm-git/lib/avm/git/launcher/base/dirty_files.rb +23 -0
- data/sub/avm-git/lib/avm/git/launcher/base/remotes.rb +40 -0
- data/sub/avm-git/lib/avm/git/launcher/base/subrepo.rb +44 -0
- data/sub/avm-git/lib/avm/git/launcher/base/underlying.rb +59 -0
- data/sub/avm-git/lib/avm/git/launcher/base.rb +87 -0
- data/sub/avm-git/lib/avm/git/launcher/error.rb +15 -0
- data/sub/avm-git/lib/avm/git/launcher/mirror_update.rb +38 -0
- data/sub/avm-git/lib/avm/git/launcher/publish_base.rb +131 -0
- data/sub/avm-git/lib/avm/git/launcher/remote.rb +55 -0
- data/sub/avm-git/lib/avm/git/launcher/sub_warp_base.rb +33 -0
- data/sub/avm-git/lib/avm/git/launcher/warp_base.rb +68 -0
- data/sub/avm-git/lib/avm/git/launcher.rb +7 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git/local_project_mixin.rb +19 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git/publish.rb +15 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git/warp.rb +27 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git.rb +25 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo/publish.rb +31 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo/warp.rb +88 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb +36 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree/publish.rb +14 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree/warp.rb +32 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb +51 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes/provider.rb +22 -0
- data/sub/avm-git/lib/avm/git/launcher_stereotypes.rb +11 -0
- data/sub/avm-git/lib/avm/git/organize/reference_update.rb +34 -0
- data/sub/avm-git/lib/avm/git/organize/repository.rb +77 -0
- data/sub/avm-git/lib/avm/git/organize.rb +11 -0
- data/sub/avm-git/lib/avm/git/revision_test.rb +105 -0
- data/sub/avm-git/lib/avm/git/runners/base/commit.rb +102 -0
- data/sub/avm-git/lib/avm/git/runners/base/deploy.rb +111 -0
- data/sub/avm-git/lib/avm/git/runners/base/dirty_files.rb +44 -0
- data/sub/avm-git/lib/avm/git/runners/base/organize.rb +75 -0
- data/sub/avm-git/lib/avm/git/runners/base/revisions_test.rb +66 -0
- data/sub/avm-git/lib/avm/git/runners/base/subrepo/check.rb +48 -0
- data/sub/avm-git/lib/avm/git/runners/base/subrepo/clone.rb +83 -0
- data/sub/avm-git/lib/avm/git/runners/base/subrepo/fix.rb +76 -0
- data/sub/avm-git/lib/avm/git/runners/base/subrepo.rb +19 -0
- data/sub/avm-git/lib/avm/git/runners/base.rb +43 -0
- data/sub/avm-git/lib/avm/git/runners.rb +11 -0
- data/sub/avm-git/lib/avm/git/scms/git/branch.rb +31 -0
- data/sub/avm-git/lib/avm/git/scms/git/branches.rb +20 -0
- data/sub/avm-git/lib/avm/git/scms/git/change_tracker.rb +36 -0
- data/sub/avm-git/lib/avm/git/scms/git/changed_file.rb +16 -0
- data/sub/avm-git/lib/avm/git/scms/git/changed_files.rb +24 -0
- data/sub/avm-git/lib/avm/git/scms/git/commit/deploy.rb +43 -0
- data/sub/avm-git/lib/avm/git/scms/git/commit/deploy_methods.rb +30 -0
- data/sub/avm-git/lib/avm/git/scms/git/commit.rb +67 -0
- data/sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb +36 -0
- data/sub/avm-git/lib/avm/git/scms/git/commits.rb +47 -0
- data/sub/avm-git/lib/avm/git/scms/git/interval.rb +31 -0
- data/sub/avm-git/lib/avm/git/scms/git/milestones.rb +21 -0
- data/sub/avm-git/lib/avm/git/scms/git/remote.rb +21 -0
- data/sub/avm-git/lib/avm/git/scms/git/remotes.rb +32 -0
- data/sub/avm-git/lib/avm/git/scms/git/run_commit.rb +57 -0
- data/sub/avm-git/lib/avm/git/scms/git.rb +51 -0
- data/sub/avm-git/lib/avm/git/scms/git_sub_base/changed_file.rb +21 -0
- data/sub/avm-git/lib/avm/git/scms/git_sub_base/commit.rb +27 -0
- data/sub/avm-git/lib/avm/git/scms/git_sub_base/interval.rb +28 -0
- data/sub/avm-git/lib/avm/git/scms/git_sub_base.rb +33 -0
- data/sub/avm-git/lib/avm/git/scms/git_subrepo.rb +37 -0
- data/sub/avm-git/lib/avm/git/scms/git_subtree.rb +34 -0
- data/sub/avm-git/lib/avm/git/scms/provider.rb +21 -0
- data/sub/avm-git/lib/avm/git/scms.rb +11 -0
- data/sub/avm-git/lib/avm/git/subrepo_check/parent.rb +51 -0
- data/sub/avm-git/lib/avm/git/subrepo_check/remote.rb +89 -0
- data/sub/avm-git/lib/avm/git/subrepo_check/show_result.rb +32 -0
- data/sub/avm-git/lib/avm/git/subrepo_check.rb +38 -0
- data/sub/avm-git/lib/avm/git/subrepo_checks.rb +60 -0
- data/sub/avm-git/lib/avm/git/vendor/github.rb +20 -0
- data/sub/avm-git/lib/avm/git/vendor.rb +11 -0
- data/sub/avm-git/lib/avm/git/version.rb +7 -0
- data/sub/avm-git/lib/avm/git.rb +9 -0
- data/sub/avm-git/locale/en.yml +6 -0
- data/sub/avm-git/locale/pt-BR.yml +6 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec.rb +13 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.source.out +1 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.target.yaml +7 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/modify.source.out +1 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/modify.target.yaml +7 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/remove.source.out +1 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/remove.target.yaml +7 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename.source.out +2 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename.target.yaml +13 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename_modify.source.out +2 -0
- data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename_modify.target.yaml +13 -0
- data/sub/avm-git/spec/lib/avm/git/commit_spec.rb +56 -0
- data/sub/avm-git/spec/lib/avm/git/launcher/base_spec.rb +45 -0
- data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/publish_spec.rb +83 -0
- data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/publish_spec_files/config.yml +5 -0
- data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/publish_spec_settings.yml +6 -0
- data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/warp_spec.rb +53 -0
- data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/warp_spec_files/config.yml +3 -0
- data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/warp_spec_settings.yml +6 -0
- data/sub/avm-git/spec/lib/avm/git/runners/base/deploy_spec.rb +126 -0
- data/sub/avm-git/spec/lib/avm/git/runners/base/deploy_spec_files/append1/stub3.txt.template +1 -0
- data/sub/avm-git/spec/lib/avm/git/runners/base/deploy_spec_files/append2/stub4.txt +1 -0
- data/sub/avm-git/spec/lib/avm/git/scms/git/commit/deploy_spec.rb +92 -0
- data/sub/avm-git/spec/lib/avm/git/scms/git_spec.rb +8 -0
- data/sub/avm-git/spec/lib/avm/git/scms/git_subrepo_spec.rb +8 -0
- data/sub/avm-git/spec/lib/avm/git/vendor/github_spec.rb +23 -0
- data/sub/avm-git/spec/rubocop_spec.rb +3 -0
- data/sub/avm-git/spec/spec_helper.rb +4 -0
- data/sub/avm-tools/Gemfile +8 -0
- data/sub/avm-tools/README.textile +28 -0
- data/sub/avm-tools/avm-tools.gemspec +25 -0
- data/sub/avm-tools/exe/avm +6 -0
- data/sub/avm-tools/lib/avm/tools/core_ext.rb +3 -0
- data/sub/avm-tools/lib/avm/tools/rspec/helpers/runner.rb +20 -0
- data/sub/avm-tools/lib/avm/tools/rspec/helpers.rb +13 -0
- data/sub/avm-tools/lib/avm/tools/rspec/setup.rb +24 -0
- data/sub/avm-tools/lib/avm/tools/rspec.rb +11 -0
- data/sub/avm-tools/lib/avm/tools/runner/application/info.rb +36 -0
- data/sub/avm-tools/lib/avm/tools/runner/application.rb +26 -0
- data/sub/avm-tools/lib/avm/tools/runner/application_stereotypes/list.rb +31 -0
- data/sub/avm-tools/lib/avm/tools/runner/application_stereotypes.rb +16 -0
- data/sub/avm-tools/lib/avm/tools/runner/applications/list.rb +31 -0
- data/sub/avm-tools/lib/avm/tools/runner/applications.rb +16 -0
- data/sub/avm-tools/lib/avm/tools/runner/config/load_path.rb +52 -0
- data/sub/avm-tools/lib/avm/tools/runner/config.rb +17 -0
- data/sub/avm-tools/lib/avm/tools/runner/files/format.rb +50 -0
- data/sub/avm-tools/lib/avm/tools/runner/files/rotate.rb +31 -0
- data/sub/avm-tools/lib/avm/tools/runner/files.rb +17 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance/data/clear.rb +18 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance/data/dump.rb +20 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance/data/load.rb +25 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance/data/unit/clear.rb +20 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance/data/unit/dump.rb +20 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance/data/unit/load.rb +25 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance/data/unit.rb +44 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance/data.rb +27 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance/entry.rb +43 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance/info.rb +39 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance/system.rb +65 -0
- data/sub/avm-tools/lib/avm/tools/runner/instance.rb +16 -0
- data/sub/avm-tools/lib/avm/tools/runner/launcher/instances.rb +36 -0
- data/sub/avm-tools/lib/avm/tools/runner/launcher/projects.rb +40 -0
- data/sub/avm-tools/lib/avm/tools/runner/launcher/publish.rb +53 -0
- data/sub/avm-tools/lib/avm/tools/runner/launcher.rb +17 -0
- data/sub/avm-tools/lib/avm/tools/runner/launcher_stereotypes/list.rb +41 -0
- data/sub/avm-tools/lib/avm/tools/runner/launcher_stereotypes.rb +16 -0
- data/sub/avm-tools/lib/avm/tools/runner/self/docker.rb +14 -0
- data/sub/avm-tools/lib/avm/tools/runner/self/registry.rb +25 -0
- data/sub/avm-tools/lib/avm/tools/runner/self.rb +22 -0
- data/sub/avm-tools/lib/avm/tools/runner/source/auto_commit.rb +72 -0
- data/sub/avm-tools/lib/avm/tools/runner/source/info.rb +55 -0
- data/sub/avm-tools/lib/avm/tools/runner/source/issue/complete.rb +86 -0
- data/sub/avm-tools/lib/avm/tools/runner/source/issue/deliver.rb +35 -0
- data/sub/avm-tools/lib/avm/tools/runner/source/issue.rb +19 -0
- data/sub/avm-tools/lib/avm/tools/runner/source/sub/remove.rb +22 -0
- data/sub/avm-tools/lib/avm/tools/runner/source/sub.rb +29 -0
- data/sub/avm-tools/lib/avm/tools/runner/source/subs.rb +72 -0
- data/sub/avm-tools/lib/avm/tools/runner/source/test.rb +93 -0
- data/sub/avm-tools/lib/avm/tools/runner/source/update.rb +22 -0
- data/sub/avm-tools/lib/avm/tools/runner/source/version_bump.rb +81 -0
- data/sub/avm-tools/lib/avm/tools/runner/source.rb +18 -0
- data/sub/avm-tools/lib/avm/tools/runner/source_generate.rb +12 -0
- data/sub/avm-tools/lib/avm/tools/runner.rb +27 -0
- data/sub/avm-tools/lib/avm/tools/runner_with/include_exclude.rb +23 -0
- data/sub/avm-tools/lib/avm/tools/runner_with/instance_data_clear.rb +23 -0
- data/sub/avm-tools/lib/avm/tools/runner_with/instance_data_dump.rb +59 -0
- data/sub/avm-tools/lib/avm/tools/runner_with/instance_data_load.rb +69 -0
- data/sub/avm-tools/lib/avm/tools/runner_with/instance_data_performer.rb +40 -0
- data/sub/avm-tools/lib/avm/tools/runner_with.rb +11 -0
- data/sub/avm-tools/lib/avm/tools/self.rb +23 -0
- data/sub/avm-tools/lib/avm/tools/version.rb +7 -0
- data/sub/avm-tools/lib/avm/tools.rb +9 -0
- data/sub/avm-tools/lib/avm.rb +7 -0
- data/sub/avm-tools/spec/lib/avm/tools/runner/files/rotate_spec.rb +72 -0
- data/sub/avm-tools/spec/lib/avm/tools/runner/launcher_stereotypes/list_spec.rb +17 -0
- data/sub/avm-tools/spec/lib/avm/tools/runner/source/issue/complete_spec.rb +49 -0
- data/sub/avm-tools/spec/lib/avm/tools/runner_spec.rb +15 -0
- data/sub/avm-tools/spec/rubocop_spec.rb +3 -0
- data/sub/avm-tools/spec/spec_helper.rb +4 -0
- metadata +284 -25
- data/sub/avm/spec/spec_helper/launcher_context.rb +0 -75
- /data/sub/avm/{spec → template/avm/rspec/launcher_controller}/dummy/avm-tools_stub/avm-tools.gemspec +0 -0
- /data/sub/avm/{spec → template/avm/rspec/launcher_controller}/dummy/avm-tools_stub/lib/avm/tools/version.rb +0 -0
- /data/sub/avm/{spec → template/avm/rspec/launcher_controller}/dummy/avm-tools_stub/lib/avm/tools.rb +0 -0
- /data/sub/avm/{spec → template/avm/rspec/launcher_controller}/dummy/ruby_gem_stub/lib/ruby_gem_stub/version.rb +0 -0
- /data/sub/avm/{spec → template/avm/rspec/launcher_controller}/dummy/ruby_gem_stub/lib/ruby_gem_stub.rb +0 -0
- /data/sub/avm/{spec → template/avm/rspec/launcher_controller}/dummy/ruby_gem_stub/ruby_gem_stub.gemspec +0 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/tools/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Tools
|
7
|
+
class Runner
|
8
|
+
class Source < ::Avm::Sources::Runner
|
9
|
+
class Subs
|
10
|
+
PADDING = ' '
|
11
|
+
|
12
|
+
runner_with :help, :output do
|
13
|
+
desc 'Output source\'s subs.'
|
14
|
+
bool_opt '-i', '--info'
|
15
|
+
bool_opt '-R', '--recursive'
|
16
|
+
bool_opt '-t', '--tree'
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
start_banner
|
21
|
+
run_output
|
22
|
+
end
|
23
|
+
|
24
|
+
def start_banner
|
25
|
+
infov 'Include PATH', runner_context.call(:subject).subs_include_path
|
26
|
+
infov 'Exclude PATH', runner_context.call(:subject).subs_exclude_path
|
27
|
+
infov 'Count', runner_context.call(:subject).subs.count
|
28
|
+
end
|
29
|
+
|
30
|
+
def output_content
|
31
|
+
b = []
|
32
|
+
runner_context.call(:subject).subs.each do |sub|
|
33
|
+
b += sub_output_content_lines(sub, 0)
|
34
|
+
end
|
35
|
+
b.map { |line| "#{line}\n" }.join
|
36
|
+
end
|
37
|
+
|
38
|
+
def sub_info_label(sub)
|
39
|
+
return '' unless parsed.info?
|
40
|
+
|
41
|
+
' [' + { # rubocop:disable Style/StringConcatenation
|
42
|
+
'CLASS' => sub.class.name,
|
43
|
+
'SCM' => sub.scm.class.name
|
44
|
+
}.map { |k, v| "#{k}: #{v}" }.join(', ') + ']'
|
45
|
+
end
|
46
|
+
|
47
|
+
def sub_label(sub, level)
|
48
|
+
sub_self_label(sub, level) + sub_info_label(sub)
|
49
|
+
end
|
50
|
+
|
51
|
+
def sub_self_label(sub, level)
|
52
|
+
if parsed.tree?
|
53
|
+
(PADDING * level) + sub.relative_path.to_s
|
54
|
+
else
|
55
|
+
sub.path.relative_path_from(runner_context.call(:subject).path).to_s
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def sub_output_content_lines(sub, level)
|
60
|
+
[sub_label(sub, level)] + sub_subs_output_content_lines(sub, level)
|
61
|
+
end
|
62
|
+
|
63
|
+
def sub_subs_output_content_lines(sub, level)
|
64
|
+
return [] unless parsed.recursive?
|
65
|
+
|
66
|
+
sub.subs.flat_map { |sub_sub| sub_output_content_lines(sub_sub, level + 1) }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/tools/core_ext'
|
4
|
+
require 'avm/sources/tests/builder'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Tools
|
8
|
+
class Runner
|
9
|
+
class Source < ::Avm::Sources::Runner
|
10
|
+
class Test
|
11
|
+
runner_with :help do
|
12
|
+
desc 'Test local project.'
|
13
|
+
bool_opt '-a', '--all', 'Same as "--self --subs".'
|
14
|
+
bool_opt '-f', '--fail-fast', 'Abort after first failure.'
|
15
|
+
bool_opt '-m', '--main', 'Test main source.'
|
16
|
+
bool_opt '-s', '--subs', 'Test subs\' sources.'
|
17
|
+
pos_arg :source_id, repeat: true, optional: true
|
18
|
+
end
|
19
|
+
|
20
|
+
def run
|
21
|
+
reset_tested_units
|
22
|
+
start_banner
|
23
|
+
show_units_results
|
24
|
+
final_result
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
attr_accessor :tested_units
|
30
|
+
|
31
|
+
def failed_units
|
32
|
+
tested_units.select(&:failed?)
|
33
|
+
end
|
34
|
+
|
35
|
+
def final_result
|
36
|
+
if failed_units.any?
|
37
|
+
failed_units.each do |unit|
|
38
|
+
infov ' * Source', unit
|
39
|
+
info unit.logs.truncate_all
|
40
|
+
end
|
41
|
+
fatal_error 'Some test did not pass'
|
42
|
+
else
|
43
|
+
success 'None test failed'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def include_main?
|
48
|
+
parsed.main? || parsed.all?
|
49
|
+
end
|
50
|
+
|
51
|
+
def include_subs?
|
52
|
+
parsed.subs? || parsed.all?
|
53
|
+
end
|
54
|
+
|
55
|
+
def reset_tested_units
|
56
|
+
self.tested_units = []
|
57
|
+
end
|
58
|
+
|
59
|
+
def show_units_results
|
60
|
+
test_performer.units.each do |unit|
|
61
|
+
infov unit, unit_result(unit)
|
62
|
+
tested_units << unit
|
63
|
+
break if unit.failed? && parsed.fail_fast?
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def start_banner
|
68
|
+
runner_context.call(:source_banner)
|
69
|
+
infov 'Selected units', test_performer.units.count
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_builder
|
73
|
+
r = ::Avm::Sources::Tests::Builder.new(runner_context.call(:subject))
|
74
|
+
.include_main(include_main?)
|
75
|
+
.include_subs(include_subs?)
|
76
|
+
parsed.source_id.inject(r) { |a, e| a.include_id(e) }
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_performer_uncached
|
80
|
+
test_builder.performer
|
81
|
+
end
|
82
|
+
|
83
|
+
def unit_result(unit)
|
84
|
+
(
|
85
|
+
[unit.result.to_label] +
|
86
|
+
%i[stdout stderr].map { |label| "#{label.to_s.upcase}: #{unit.logs[label]}" }
|
87
|
+
).join(' | '.blue)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/tools/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Tools
|
7
|
+
class Runner
|
8
|
+
class Source < ::Avm::Sources::Runner
|
9
|
+
class Update
|
10
|
+
runner_with :help do
|
11
|
+
desc 'Update local project.'
|
12
|
+
end
|
13
|
+
|
14
|
+
def run
|
15
|
+
infov 'Path', runner_context.call(:subject).path
|
16
|
+
runner_context.call(:subject).update
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/version_number'
|
4
|
+
require 'eac_cli/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Tools
|
8
|
+
class Runner
|
9
|
+
class Source < ::Avm::Sources::Runner
|
10
|
+
class VersionBump
|
11
|
+
runner_with :help, :confirmation do
|
12
|
+
desc 'Bump version of a local project.'
|
13
|
+
arg_opt '-n', '--new', 'Set new version.'
|
14
|
+
arg_opt '-s', '--segment', 'Increment de <segment>-th segment (Left-most is 0)'
|
15
|
+
bool_opt '-M', '--major', 'Same as --segment=0.'
|
16
|
+
bool_opt '-m', '--minor', 'Same as --segment=1.'
|
17
|
+
bool_opt '-p', '--patch', 'Same as --segment=2.'
|
18
|
+
end
|
19
|
+
|
20
|
+
def run
|
21
|
+
start_banner
|
22
|
+
version_changed? ? run_version_changed : run_version_unchanged
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_version_changed
|
26
|
+
infom 'Version changed'
|
27
|
+
if confirm?
|
28
|
+
runner_context.call(:subject).version_bump(target_version)
|
29
|
+
success 'Bumped'
|
30
|
+
else
|
31
|
+
fatal_error 'Bump unconfirmed'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def run_version_unchanged
|
36
|
+
success 'Version unchanged'
|
37
|
+
end
|
38
|
+
|
39
|
+
def start_banner
|
40
|
+
infov 'Instance', runner_context.call(:subject)
|
41
|
+
infov 'Current version', current_version.if_present('-')
|
42
|
+
infov 'Target version', target_version.if_present('-')
|
43
|
+
end
|
44
|
+
|
45
|
+
def current_version_uncached
|
46
|
+
runner_context.call(:subject).if_respond('version')
|
47
|
+
end
|
48
|
+
|
49
|
+
def target_version_uncached
|
50
|
+
r = current_version
|
51
|
+
%w[new segment major minor patch].each do |option|
|
52
|
+
option_value = parsed[option]
|
53
|
+
next if option_value.blank?
|
54
|
+
|
55
|
+
r = send("target_version_from_#{option}", r, option_value)
|
56
|
+
end
|
57
|
+
r
|
58
|
+
end
|
59
|
+
|
60
|
+
def target_version_from_new(_current, option_value)
|
61
|
+
::Avm::VersionNumber.new(option_value)
|
62
|
+
end
|
63
|
+
|
64
|
+
def target_version_from_segment(current, option_value)
|
65
|
+
current.increment_segment(option_value.to_i)
|
66
|
+
end
|
67
|
+
|
68
|
+
%w[major minor patch].each_with_index do |segment, segment_index|
|
69
|
+
define_method "target_version_from_#{segment}" do |current, _option_value|
|
70
|
+
target_version_from_segment(current, segment_index)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def version_changed?
|
75
|
+
target_version != current_version
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/sources/runner'
|
4
|
+
require 'eac_cli/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Tools
|
8
|
+
class Runner
|
9
|
+
class Source < ::Avm::Sources::Runner
|
10
|
+
require_sub __FILE__
|
11
|
+
|
12
|
+
def subject
|
13
|
+
source
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/tools/self'
|
4
|
+
require 'avm/registry'
|
5
|
+
require 'avm/tools/version'
|
6
|
+
require 'eac_ruby_base0/runner'
|
7
|
+
|
8
|
+
module Avm
|
9
|
+
module Tools
|
10
|
+
class Runner
|
11
|
+
require_sub __FILE__
|
12
|
+
include ::EacRubyBase0::Runner
|
13
|
+
|
14
|
+
runner_definition do
|
15
|
+
desc 'Tools for AVM.'
|
16
|
+
end
|
17
|
+
|
18
|
+
def application
|
19
|
+
::Avm::Tools::Self.application
|
20
|
+
end
|
21
|
+
|
22
|
+
def extra_available_subcommands
|
23
|
+
::Avm::Registry.runners.registered_modules.index_by(&:command_argument)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
require 'eac_cli/runner'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Tools
|
8
|
+
module RunnerWith
|
9
|
+
module IncludeExclude
|
10
|
+
common_concern do
|
11
|
+
include ::EacCli::Runner
|
12
|
+
|
13
|
+
runner_definition do
|
14
|
+
arg_opt '-I', '--include', repeat: true
|
15
|
+
arg_opt '-E', '--exclude', repeat: true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
delegate :include, :exclude, to: :parsed
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/data/clearer'
|
4
|
+
require 'eac_cli/core_ext'
|
5
|
+
require 'avm/tools/runner_with/instance_data_performer'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Tools
|
9
|
+
module RunnerWith
|
10
|
+
module InstanceDataClear
|
11
|
+
common_concern do
|
12
|
+
enable_simple_cache
|
13
|
+
include ::Avm::Tools::RunnerWith::InstanceDataPerformer
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [Class]
|
17
|
+
def data_performer_class
|
18
|
+
::Avm::Data::Clearer
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/data/dumper'
|
4
|
+
require 'eac_cli/core_ext'
|
5
|
+
require 'avm/tools/runner_with/instance_data_performer'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Tools
|
9
|
+
module RunnerWith
|
10
|
+
module InstanceDataDump
|
11
|
+
common_concern do
|
12
|
+
enable_simple_cache
|
13
|
+
runner_definition do
|
14
|
+
bool_opt '-w', '--rewrite', 'Forces dump overwrite.'
|
15
|
+
pos_arg :dump_path, optional: true
|
16
|
+
end
|
17
|
+
|
18
|
+
set_callback :run, :after do
|
19
|
+
success("Dump path: \"#{dump_path}\"")
|
20
|
+
dump_path
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
include ::Avm::Tools::RunnerWith::InstanceDataPerformer
|
25
|
+
|
26
|
+
DUMP_EXPIRE_TIME = 1.day
|
27
|
+
NO_DUMP_MESSAGE = 'Dump "%s" already exist and rewrite options was no setted nor ' \
|
28
|
+
'dump was expired.'
|
29
|
+
|
30
|
+
# @return [Class]
|
31
|
+
def data_performer_class
|
32
|
+
::Avm::Data::Dumper
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [String]
|
36
|
+
def help_extra_text
|
37
|
+
"Default dump path: \"#{default_dump_path}\""
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
# @return [Avm::Data::Dumper]
|
43
|
+
def data_performer_uncached
|
44
|
+
r = super.overwrite(parsed.rewrite?)
|
45
|
+
parsed.dump_path.if_present(r) { |v| r.target_path(v.to_pathname) }
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [Pathname]
|
49
|
+
def dump_path
|
50
|
+
data_performer.target_path
|
51
|
+
end
|
52
|
+
|
53
|
+
def default_dump_path
|
54
|
+
data_performer.default_dump_path
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/data/dumper'
|
4
|
+
require 'avm/data/loader'
|
5
|
+
require 'eac_cli/core_ext'
|
6
|
+
require 'avm/tools/runner_with/instance_data_performer'
|
7
|
+
|
8
|
+
module Avm
|
9
|
+
module Tools
|
10
|
+
module RunnerWith
|
11
|
+
module InstanceDataLoad
|
12
|
+
common_concern do
|
13
|
+
enable_simple_cache
|
14
|
+
|
15
|
+
runner_definition do
|
16
|
+
arg_opt '-S', '--source-instance', 'Informa a instância a ser extraída o dump.'
|
17
|
+
bool_opt '-w', '--rewrite'
|
18
|
+
pos_arg :dump_path, optional: true
|
19
|
+
end
|
20
|
+
|
21
|
+
set_callback :run, :after do
|
22
|
+
success("Dump loaded from \"#{dump_path}\"")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
include ::Avm::Tools::RunnerWith::InstanceDataPerformer
|
27
|
+
|
28
|
+
# @return [Class]
|
29
|
+
def data_performer_class
|
30
|
+
::Avm::Data::Loader
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
# @return [Avm::Data::Loader]
|
36
|
+
def data_performer_uncached
|
37
|
+
super.source_path(dump_path)
|
38
|
+
end
|
39
|
+
|
40
|
+
# @return [Pathname]
|
41
|
+
def dump_path_uncached
|
42
|
+
return parsed.dump_path.to_pathname if parsed.dump_path.present?
|
43
|
+
return source_instance_dump_path if parsed.source_instance.present?
|
44
|
+
|
45
|
+
fatal_error "Dump path not set (Options: #{parsed})"
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [Avm::Instances::Base]
|
49
|
+
def source_instance
|
50
|
+
runner_context.call(:instance).class.by_id(parsed.source_instance)
|
51
|
+
end
|
52
|
+
|
53
|
+
# @return [Avm::Data::Dumper]
|
54
|
+
def source_instance_dumper
|
55
|
+
data_performer_set_includes_excludes(
|
56
|
+
::Avm::Data::Dumper.new(source_instance_data_owner).overwrite(parsed.rewrite?)
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
# @return [Pathname]
|
61
|
+
def source_instance_dump_path
|
62
|
+
r = source_instance_dumper
|
63
|
+
r.perform
|
64
|
+
r.target_path
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
require 'eac_cli/runner'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Tools
|
8
|
+
module RunnerWith
|
9
|
+
module InstanceDataPerformer
|
10
|
+
acts_as_abstract :data_performer_class
|
11
|
+
common_concern do
|
12
|
+
enable_simple_cache
|
13
|
+
include ::EacCli::Runner
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
if data_performer.performable?
|
18
|
+
data_performer.perform
|
19
|
+
else
|
20
|
+
fatal_error("Cannot perform: #{data_performer.cannot_perform_reason}")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
# @return [Avm::Data::Performer]
|
27
|
+
def data_performer_uncached
|
28
|
+
data_performer_set_includes_excludes(data_performer_class.new(data_owner))
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Avm::Data::Performer]
|
32
|
+
def data_performer_set_includes_excludes(data_performer)
|
33
|
+
%i[include exclude].inject(data_performer) do |a1, e1|
|
34
|
+
if_respond(e1, []).inject(a1) { |a2, e2| a2.send(e1, e2) }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_base0/application'
|
4
|
+
require 'eac_ruby_utils/require_sub'
|
5
|
+
require 'avm/instances/base'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Tools
|
9
|
+
module Self
|
10
|
+
::EacRubyUtils.require_sub(__FILE__)
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def application
|
14
|
+
@application ||= ::EacRubyBase0::Application.new(root.to_path)
|
15
|
+
end
|
16
|
+
|
17
|
+
def root
|
18
|
+
::Pathname.new('../../..').expand_path(__dir__)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/tools/runner'
|
4
|
+
require 'tmpdir'
|
5
|
+
require 'fileutils'
|
6
|
+
|
7
|
+
class StubClock
|
8
|
+
attr_reader :current
|
9
|
+
|
10
|
+
def initialize(year, month, day)
|
11
|
+
@current = ::Time.new(year, month, day)
|
12
|
+
end
|
13
|
+
|
14
|
+
def tick
|
15
|
+
@current += 1.day
|
16
|
+
@current
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
RSpec.describe Avm::Tools::Runner::Files::Rotate do
|
21
|
+
let(:workdir) { Dir.mktmpdir }
|
22
|
+
let(:source_basename) { 'myfile.tar.gz' }
|
23
|
+
let(:source_path) { File.join(workdir, source_basename) }
|
24
|
+
|
25
|
+
before do
|
26
|
+
FileUtils.touch(source_path)
|
27
|
+
end
|
28
|
+
|
29
|
+
it { expect(File.exist?(source_path)).to be(true) }
|
30
|
+
|
31
|
+
context 'when run' do
|
32
|
+
let(:files_with_prefix) { Dir["#{workdir}/myfile_*.tar.gz"] }
|
33
|
+
|
34
|
+
before do
|
35
|
+
Avm::Tools::Runner.run(argv: ['files', 'rotate', source_path])
|
36
|
+
end
|
37
|
+
|
38
|
+
it { expect(File.exist?(source_path)).to be(false) }
|
39
|
+
it { expect(files_with_prefix.count).to eq(1) }
|
40
|
+
end
|
41
|
+
|
42
|
+
describe 'space limit' do
|
43
|
+
let(:tempdir) { Dir.mktmpdir }
|
44
|
+
let(:clock) { StubClock.new(2000, 1, 1) }
|
45
|
+
|
46
|
+
it 'limit space used by rotated files' do # rubocop:disable RSpec/NoExpectationExample
|
47
|
+
file1 = create_and_rotate_stub_file([], [])
|
48
|
+
file2 = create_and_rotate_stub_file([file1], [])
|
49
|
+
file3 = create_and_rotate_stub_file([file2], [file1])
|
50
|
+
create_and_rotate_stub_file([file3], [file1, file2])
|
51
|
+
end
|
52
|
+
|
53
|
+
def create_and_rotate_stub_file(expect_exist, expect_not_exist)
|
54
|
+
rotate_runner = described_class.create(argv: [create_stub_file, '--space-limit=32'])
|
55
|
+
rotate_runner.run
|
56
|
+
test_files(rotate_runner.rotate, expect_exist, expect_not_exist)
|
57
|
+
rotate_runner.rotate.target_path
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_files(rotate, expect_exist, expect_not_exist)
|
61
|
+
(expect_exist + [rotate.target_path]).each { |path| expect(File).to exist(path) }
|
62
|
+
expect_not_exist.each { |path| expect(File).not_to exist(path) }
|
63
|
+
end
|
64
|
+
|
65
|
+
def create_stub_file
|
66
|
+
stub_path = File.join(tempdir, 'stub.ext')
|
67
|
+
File.write(stub_path, 'A' * 16)
|
68
|
+
FileUtils.touch(stub_path, mtime: clock.tick)
|
69
|
+
stub_path
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|