eac_tools 0.97.0 → 0.97.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +35 -30
- data/lib/eac_tools/version.rb +1 -1
- data/sub/eac_config/eac_config.gemspec +20 -0
- data/sub/eac_config/lib/eac_config/entries.rb +35 -0
- data/sub/eac_config/lib/eac_config/entry/not_found_error.rb +13 -0
- data/sub/eac_config/lib/eac_config/entry.rb +64 -0
- data/sub/eac_config/lib/eac_config/entry_path.rb +89 -0
- data/sub/eac_config/lib/eac_config/envvars_node/entry.rb +54 -0
- data/sub/eac_config/lib/eac_config/envvars_node.rb +35 -0
- data/sub/eac_config/lib/eac_config/load_nodes_search.rb +39 -0
- data/sub/eac_config/lib/eac_config/load_path.rb +28 -0
- data/sub/eac_config/lib/eac_config/node.rb +81 -0
- data/sub/eac_config/lib/eac_config/node_entry.rb +28 -0
- data/sub/eac_config/lib/eac_config/node_uri/instanciate_single.rb +29 -0
- data/sub/eac_config/lib/eac_config/node_uri.rb +45 -0
- data/sub/eac_config/lib/eac_config/old_configs/base.rb +43 -0
- data/sub/eac_config/lib/eac_config/old_configs/file.rb +47 -0
- data/sub/eac_config/lib/eac_config/old_configs.rb +75 -0
- data/sub/eac_config/lib/eac_config/paths_hash/entry_key_error.rb +8 -0
- data/sub/eac_config/lib/eac_config/paths_hash/node.rb +67 -0
- data/sub/eac_config/lib/eac_config/paths_hash/path_search.rb +39 -0
- data/sub/eac_config/lib/eac_config/paths_hash.rb +63 -0
- data/sub/eac_config/lib/eac_config/prefixed_path_node/entry.rb +25 -0
- data/sub/eac_config/lib/eac_config/prefixed_path_node.rb +19 -0
- data/sub/eac_config/lib/eac_config/rspec/setup.rb +65 -0
- data/sub/{avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0.rb → eac_config/lib/eac_config/rspec.rb} +2 -2
- data/sub/eac_config/lib/eac_config/version.rb +5 -0
- data/sub/eac_config/lib/eac_config/yaml_file_node/entry.rb +36 -0
- data/sub/eac_config/lib/eac_config/yaml_file_node/self_entries.rb +72 -0
- data/sub/eac_config/lib/eac_config/yaml_file_node.rb +54 -0
- data/sub/eac_config/lib/eac_config.rb +7 -0
- data/sub/eac_config/spec/lib/eac_config/entry_path_spec.rb +30 -0
- data/sub/eac_config/spec/lib/eac_config/envvars_node/entry_spec.rb +14 -0
- data/sub/eac_config/spec/lib/eac_config/envvars_node_spec.rb +51 -0
- data/sub/eac_config/spec/lib/eac_config/old_configs_spec.rb +46 -0
- data/sub/eac_config/spec/lib/eac_config/paths_hash_spec.rb +63 -0
- data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec.rb +88 -0
- data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1.yaml +10 -0
- data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_1.yaml +4 -0
- data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2/storage1_2_1.yaml +4 -0
- data/sub/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2.yaml +10 -0
- data/sub/{avm-eac_asciidoctor_base0 → eac_config}/spec/spec_helper.rb +0 -4
- data/sub/eac_ruby_utils/Gemfile +8 -0
- data/sub/eac_ruby_utils/MIT-LICENCE +16 -0
- data/sub/eac_ruby_utils/README.rdoc +3 -0
- data/sub/eac_ruby_utils/eac_ruby_utils.gemspec +26 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/acts_as_abstract.rb +100 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/acts_as_immutable/array_accessor.rb +25 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/acts_as_immutable/base_accessor.rb +57 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/acts_as_immutable/boolean_accessor.rb +16 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/acts_as_immutable/class_methods.rb +20 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/acts_as_immutable/common_accessor.rb +30 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/acts_as_immutable/enumerable_accessor.rb +52 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/acts_as_immutable/hash_accessor.rb +57 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/acts_as_immutable/instance_methods.rb +21 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/acts_as_immutable/set_accessor.rb +25 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/acts_as_immutable.rb +15 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/acts_as_instance_method.rb +34 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/arguments_consumer.rb +80 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/bit.rb +47 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/bit_array.rb +81 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/blank_not_blank.rb +19 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/boolean.rb +31 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/by_reference.rb +23 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/byte.rb +106 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/byte_array.rb +36 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/common_concern/class_setup.rb +52 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/common_concern/module_setup.rb +41 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb +20 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/class_accessors.rb +36 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/class_initialize.rb +39 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/instance_initialize.rb +64 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/super_args.rb +55 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb +93 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/compact.rb +32 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/compare_by.rb +28 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/context.rb +33 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/contextualizable.rb +21 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/core_ext.rb +7 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/custom_format.rb +53 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/enum.rb +102 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/enumerables_methods.rb +42 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/append_command_options.rb +38 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/concat.rb +41 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/debugging.rb +19 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/execution.rb +52 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/extra_options.rb +28 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command.rb +45 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_env.rb +28 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/envvars.rb +27 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb +23 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb +67 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/composite_command.rb +45 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/executable.rb +93 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/execution_error.rb +8 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/execution_result.rb +45 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/file.rb +22 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/local_env.rb +17 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/process.rb +27 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/spawn.rb +32 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/dasho_options.rb +53 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/identity_file.rb +25 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/quiet.rb +24 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb +34 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env.rb +74 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs.rb +23 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/fs/clearable_directory.rb +57 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/fs/extname.rb +30 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/fs/temp/directory.rb +16 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/fs/temp/file.rb +34 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/fs/temp.rb +52 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/fs.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/gems_registry/gem.rb +80 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb +34 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +29 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/class_methods.rb +14 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/instance_methods.rb +30 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/integer_list.rb +23 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/item.rb +48 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +129 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/lists.rb +51 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/string_list.rb +19 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/symbol_list.rb +19 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable.rb +17 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +48 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales/from_all_gems.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales/from_gem.rb +47 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales/module_i18n_translate.rb +74 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb +30 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/module_ancestors_variable/base.rb +34 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/module_ancestors_variable/hash.rb +20 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/module_ancestors_variable/set.rb +19 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/module_ancestors_variable.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/options_consumer.rb +62 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patch.rb +11 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable/uri/query_value.rb +37 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable/uri.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/class/abstract.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/class/common_constructor.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/class/method_class.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/class/self_included_modules.rb +7 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/class/settings_provider.rb +10 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/class/static_method_class.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/class.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerable/boolean_combinations.rb +45 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerable.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/current.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/stopped.rb +14 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/hash/if_key.rb +12 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/hash/options_consumer.rb +10 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/hash/sym_keys_hash.rb +10 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/hash/to_struct.rb +10 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/hash.rb +5 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel/ibr.rb +10 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel/nyi.rb +10 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/abstract_methods.rb +10 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/acts_as_abstract.rb +14 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/acts_as_immutable.rb +10 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/acts_as_instance_method.rb +10 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/common_concern.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/compare_by.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/context.rb +11 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/i18n_translate.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/immutable.rb +11 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/listable.rb +10 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/module_parent.rb +5 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/patch.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/require_sub.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/simple_cache.rb +10 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/speaker.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/asserts.rb +25 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/call_if_proc.rb +11 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/compact.rb +20 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/debug.rb +55 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/i18n_translate.rb +13 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_nil.rb +17 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_present.rb +19 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_respond.rb +22 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/recursive_build.rb +12 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/to_bool.rb +12 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/to_pathname.rb +15 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/to_sym_by_eac.rb +11 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/to_uri.rb +15 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object.rb +5 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/assert_parent.rb +12 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_noext.rb +10 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_sub.rb +13 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/child_of.rb +16 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/if_exist.rb +10 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/mkpath_s.rb +12 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/parent_n.rb +11 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/readlink_r.rb +11 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/reqdir_glob.rb +13 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp/if_match.rb +16 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp/to_parser.rb +10 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/string/delimited.rb +16 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +11 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/string.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/time/required_zone.rb +11 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/time.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/recursive_builder.rb +51 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/regexp_parser.rb +39 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/base.rb +80 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/sub_file.rb +59 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb +11 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/rspec/default_setup.rb +20 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup/conditionals.rb +17 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup/setup_manager.rb +17 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup.rb +27 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup_manager.rb +49 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/rspec/stub_speaker.rb +39 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/rspec.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/ruby/command.rb +32 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/ruby/on_clean_environment.rb +71 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/ruby/on_replace_objects/replace_instance_method.rb +36 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/ruby/on_replace_objects.rb +52 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/ruby.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb +79 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb +50 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +77 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/speaker/receiver.rb +64 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/speaker/sender.rb +37 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/speaker.rb +16 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/static_method_class.rb +12 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/string_delimited.rb +70 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +63 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/unimplemented_method_error.rb +6 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +5 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/wildcards.rb +26 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb +107 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils.rb +6 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/acts_as_abstract_spec.rb +94 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/acts_as_immutable/array_accessor_spec.rb +43 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/acts_as_immutable/common_accessor_spec.rb +57 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/acts_as_immutable/hash_accessor_spec.rb +42 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/acts_as_immutable/set_accessor_spec.rb +43 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/arguments_consumer_spec.rb +17 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/bit_array_spec.rb +22 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/blank_not_blank_spec.rb +16 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/byte_spec.rb +54 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/common_concern_spec.rb +65 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/common_constructor_spec.rb +151 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/compact_spec.rb +21 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/compare_by_spec.rb +39 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/custom_format_spec.rb +60 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/enum_spec.rb +44 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/enumerables_methods_spec.rb +50 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/command/base_example.rb +97 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/command/local_env_spec.rb +11 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/command/ssh_env_spec.rb +17 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb +37 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/ssh_env_spec.rb +25 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/extname_spec.rb +18 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp/directory_spec.rb +12 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb +52 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/inflector_spec.rb +16 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/listable_spec.rb +225 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/local_time_zone_spec.rb +17 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/method_class_spec.rb +46 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/module_ancestors_variable/hash_spec.rb +57 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/module_ancestors_variable/set_spec.rb +57 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/options_consumer_spec.rb +80 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/addressable/uri/query_value_spec.rb +25 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/class/abstract_spec.rb +25 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/class/acts_as_abstract_spec.rb +14 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/class/method_class_spec.rb +20 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/class/self_included_modules_spec.rb +30 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/class/static_method_class_spec.rb +20 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerable/boolean_combinations_spec.rb +39 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/current_spec.rb +26 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/stopped_spec.rb +32 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/hash/if_key_spec.rb +23 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/hash/options_consumer_spec.rb +17 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/hash/sym_keys_hash_spec.rb +13 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/compare_by_spec.rb +37 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/listable_spec.rb +15 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/simple_cache_spec.rb +15 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/speaker_spec.rb +15 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/call_if_proc_spec.rb +11 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/compact_spec.rb +20 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb +13 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/recursive_build_spec.rb +62 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/template_spec_files/path/my_stub_with_template +1 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/assert_parent_spec.rb +21 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/basename_noext_spec.rb +26 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/basename_sub_spec.rb +17 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb +26 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb +33 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/string/delimited_spec.rb +34 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/recursive_builder_spec.rb +65 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub/base_spec/stubbed_module_a.rb +6 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub/base_spec/stubbed_not_module.rb +6 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub/base_spec.rb +19 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/rspec/setup/setup_manager_spec.rb +17 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/ruby/on_clean_environment_spec.rb +31 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/ruby/on_replace_objects_spec.rb +65 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +64 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb +129 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb +44 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/struct_spec.rb +57 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/wildcards_spec.rb +27 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/yaml_spec.rb +76 -0
- data/sub/eac_ruby_utils/spec/locales/pt-BR.yml +58 -0
- data/sub/eac_ruby_utils/spec/rubocop_check_spec.rb +3 -0
- data/sub/eac_ruby_utils/spec/spec_helper.rb +15 -0
- metadata +319 -81
- data/sub/avm-eac_asciidoctor_base0/avm-eac_asciidoctor_base0.gemspec +0 -24
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/documents_owner.rb +0 -30
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/file_formats/base/file_resource_name.rb +0 -37
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/file_formats/base.rb +0 -17
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/apache_host.rb +0 -19
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/apache_path.rb +0 -12
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/base.rb +0 -33
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/body_target.rb +0 -37
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb +0 -92
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/media.rb +0 -28
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/pre_process_line.rb +0 -64
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document.rb +0 -101
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/theme.rb +0 -41
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build.rb +0 -60
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/deploy.rb +0 -28
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/macros/base.rb +0 -21
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/macros/breadcrumbs.rb +0 -55
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/macros/child_docs/document_builder.rb +0 -63
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/macros/child_docs.rb +0 -35
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/macros/default_body.rb +0 -21
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/macros.rb +0 -13
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances.rb +0 -11
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/logging/catcher.rb +0 -47
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/logging/error.rb +0 -18
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/logging.rb +0 -11
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/source_generators/base.rb +0 -28
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/source_generators.rb +0 -11
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/instance_to_build.rb +0 -45
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/theme.rb +0 -46
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base.rb +0 -49
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/document/media.rb +0 -28
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/document/title.rb +0 -31
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/document.rb +0 -56
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/build.rb +0 -58
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/document/build.rb +0 -51
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/document.rb +0 -30
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/documents.rb +0 -28
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/ignore_errors_option.rb +0 -44
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners.rb +0 -13
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources.rb +0 -11
- data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +0 -7
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/file_formats/base_spec.rb +0 -13
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build/document_spec.rb +0 -81
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build/document_spec_files/pre_processed_root_body.adoc +0 -25
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec.rb +0 -22
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/_media/a_media_file +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc1/_media/a_media_file +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc1/body.adoc +0 -11
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc1/title +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc2/body.adoc +0 -11
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc2/doc2_1/_media/a_media_file +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc2/doc2_1/body.adoc +0 -11
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc2/doc2_1/title +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc2/title +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/_media/a_media_file +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/_theme/main.css +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/doc1/_media/a_media_file +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/doc1/index.html +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/doc2/doc2_1/_media/a_media_file +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/doc2/doc2_1/index.html +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/doc2/index.html +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/index.html +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec.rb +0 -8
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/content/body.adoc +0 -11
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/content/title +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/theme/main.css +0 -1
- data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/sources/base_spec.rb +0 -16
- data/sub/avm-eac_asciidoctor_base0/spec/spec_helper/eac_asciidoctor_base0_stubs.rb +0 -55
- data/sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/content/body.adoc +0 -11
- data/sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/content/title +0 -1
- data/sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/theme/main.css +0 -1
- /data/sub/{avm-eac_asciidoctor_base0 → eac_config}/Gemfile +0 -0
- /data/sub/{avm-eac_asciidoctor_base0 → eac_config}/spec/rubocop_spec.rb +0 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'shellwords'
|
5
|
+
|
6
|
+
module EacRubyUtils
|
7
|
+
module Envs
|
8
|
+
module BaseCommand
|
9
|
+
class AppendCommandOptions
|
10
|
+
enable_method_class
|
11
|
+
common_constructor :command, :command_line, :options
|
12
|
+
|
13
|
+
def result
|
14
|
+
r = command_line
|
15
|
+
r = "#{input.command} | #{r}" if input
|
16
|
+
r = "cat #{Shellwords.escape(input_file)} | #{r}" if input_file
|
17
|
+
r += " > #{Shellwords.escape(output_file)}" if output_file
|
18
|
+
r
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [EacRubyUtils::Envs::Command, nil]
|
22
|
+
def input
|
23
|
+
options[:input]
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Pathname, nil]
|
27
|
+
def input_file
|
28
|
+
options[:input_file].if_present(&:to_pathname)
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Pathname, nil]
|
32
|
+
def output_file
|
33
|
+
options[:output_file].if_present(&:to_pathname)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/struct'
|
4
|
+
|
5
|
+
module EacRubyUtils
|
6
|
+
module Envs
|
7
|
+
module BaseCommand
|
8
|
+
module Concat
|
9
|
+
AND_OPERATOR = '&&'
|
10
|
+
BEFORE_OPERATOR = ';'
|
11
|
+
OR_OPERATOR = '||'
|
12
|
+
PIPE_OPERATOR = '|'
|
13
|
+
|
14
|
+
# @param operator [Symbol]
|
15
|
+
# @return [EacRubyUtils::Envs::CompositeCommand]
|
16
|
+
def concat(operator, other_command)
|
17
|
+
require 'eac_ruby_utils/envs/composite_command'
|
18
|
+
::EacRubyUtils::Envs::CompositeCommand.new(operator, self, other_command)
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [EacRubyUtils::Envs::Command]
|
22
|
+
def and(other_command)
|
23
|
+
concat(AND_OPERATOR, other_command)
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [EacRubyUtils::Envs::Command]
|
27
|
+
def before(other_command)
|
28
|
+
concat(BEFORE_OPERATOR, other_command)
|
29
|
+
end
|
30
|
+
|
31
|
+
def or(other_command)
|
32
|
+
concat(OR_OPERATOR, other_command)
|
33
|
+
end
|
34
|
+
|
35
|
+
def pipe(other_command)
|
36
|
+
concat(PIPE_OPERATOR, other_command)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacRubyUtils
|
4
|
+
module Envs
|
5
|
+
module BaseCommand
|
6
|
+
module Debugging
|
7
|
+
def debug?
|
8
|
+
ENV['DEBUG'].to_s.strip != ''
|
9
|
+
end
|
10
|
+
|
11
|
+
# Print a message if debugging is enabled.
|
12
|
+
def debug_print(message)
|
13
|
+
message = message.to_s
|
14
|
+
puts message.if_respond(:light_red, message) if debug?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/envs/execution_error'
|
4
|
+
require 'eac_ruby_utils/envs/execution_result'
|
5
|
+
require 'eac_ruby_utils/envs/process'
|
6
|
+
require 'eac_ruby_utils/envs/spawn'
|
7
|
+
require 'pp'
|
8
|
+
|
9
|
+
module EacRubyUtils
|
10
|
+
module Envs
|
11
|
+
module BaseCommand
|
12
|
+
module Execution
|
13
|
+
def execute!(options = {})
|
14
|
+
options[:exit_outputs] = status_results.merge(options[:exit_outputs].presence || {})
|
15
|
+
er = ::EacRubyUtils::Envs::ExecutionResult.new(execute(options), options)
|
16
|
+
return er.result if er.success?
|
17
|
+
|
18
|
+
raise ::EacRubyUtils::Envs::ExecutionError,
|
19
|
+
"execute! command failed: #{self}\n#{er.r.pretty_inspect}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def execute(options = {})
|
23
|
+
c = command(options)
|
24
|
+
debug_print("BEFORE: #{c}")
|
25
|
+
t1 = Time.now
|
26
|
+
r = ::EacRubyUtils::Envs::Process.new(c).to_h
|
27
|
+
i = Time.now - t1
|
28
|
+
debug_print("AFTER [#{i}]: #{c}")
|
29
|
+
r
|
30
|
+
end
|
31
|
+
|
32
|
+
def spawn(options = {})
|
33
|
+
c = command(options)
|
34
|
+
debug_print("SPAWN: #{c}")
|
35
|
+
::EacRubyUtils::Envs::Spawn.new(c)
|
36
|
+
end
|
37
|
+
|
38
|
+
def system!(options = {})
|
39
|
+
return if system(options)
|
40
|
+
|
41
|
+
raise ::EacRubyUtils::Envs::ExecutionError, "system! command failed: #{self}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def system(options = {})
|
45
|
+
c = command(options)
|
46
|
+
debug_print(c)
|
47
|
+
Kernel.system(c)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
4
|
+
require 'active_support/core_ext/object/blank'
|
5
|
+
require 'shellwords'
|
6
|
+
|
7
|
+
module EacRubyUtils
|
8
|
+
module Envs
|
9
|
+
module BaseCommand
|
10
|
+
module ExtraOptions
|
11
|
+
# @return [ActiveSupport::HashWithIndifferentAccess]
|
12
|
+
def extra_options
|
13
|
+
@extra_options ||= {}.with_indifferent_access
|
14
|
+
end
|
15
|
+
|
16
|
+
def status_result(status_code, result)
|
17
|
+
duplicate_by_extra_options(status_results: status_results.merge(status_code => result))
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def status_results
|
23
|
+
extra_options[:status_results] ||= {}.with_indifferent_access
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'shellwords'
|
5
|
+
|
6
|
+
module EacRubyUtils
|
7
|
+
module Envs
|
8
|
+
module BaseCommand
|
9
|
+
require_sub __FILE__
|
10
|
+
|
11
|
+
common_concern do
|
12
|
+
enable_abstract_methods
|
13
|
+
include ::EacRubyUtils::Envs::BaseCommand::Concat
|
14
|
+
include ::EacRubyUtils::Envs::BaseCommand::Debugging
|
15
|
+
include ::EacRubyUtils::Envs::BaseCommand::Execution
|
16
|
+
include ::EacRubyUtils::Envs::BaseCommand::ExtraOptions
|
17
|
+
end
|
18
|
+
|
19
|
+
# @return [EacRubyUtils::Envs::BaseEnv]
|
20
|
+
def env
|
21
|
+
raise_abstract_method __method__
|
22
|
+
end
|
23
|
+
|
24
|
+
def command(options = {})
|
25
|
+
append_command_options(
|
26
|
+
env.command_line(command_line_without_env),
|
27
|
+
options
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [String]
|
32
|
+
def command_line_without_env(_options = {})
|
33
|
+
raise_abstract_method __method__
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def escape(arg)
|
39
|
+
arg = arg.to_s
|
40
|
+
m = /^@ESC_(.+)$/.match(arg)
|
41
|
+
m ? m[1] : Shellwords.escape(arg)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/envs/command'
|
4
|
+
require 'eac_ruby_utils/envs/executable'
|
5
|
+
require 'eac_ruby_utils/envs/file'
|
6
|
+
|
7
|
+
module EacRubyUtils
|
8
|
+
module Envs
|
9
|
+
class BaseEnv
|
10
|
+
def command(*args)
|
11
|
+
::EacRubyUtils::Envs::Command.new(self, args)
|
12
|
+
end
|
13
|
+
|
14
|
+
# <b>DEPRECATED:</b> Please use <tt>file(file).exist?</tt> instead.
|
15
|
+
def file_exist?(file)
|
16
|
+
self.file(file).exist?
|
17
|
+
end
|
18
|
+
|
19
|
+
def executable(*executable_new_args)
|
20
|
+
::EacRubyUtils::Envs::Executable.new(self, *executable_new_args)
|
21
|
+
end
|
22
|
+
|
23
|
+
def file(path)
|
24
|
+
::EacRubyUtils::Envs::File.new(self, path)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'shellwords'
|
5
|
+
|
6
|
+
module EacRubyUtils
|
7
|
+
module Envs
|
8
|
+
class Command
|
9
|
+
module Envvars
|
10
|
+
def envvar(name, value)
|
11
|
+
duplicate_by_extra_options(envvars: envvars.merge(name => value))
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def append_envvars(command)
|
17
|
+
e = envvars.map { |k, v| "#{Shellwords.escape(k)}=#{Shellwords.escape(v)}" }.join(' ')
|
18
|
+
e.present? ? "#{e} #{command}" : command
|
19
|
+
end
|
20
|
+
|
21
|
+
def envvars
|
22
|
+
extra_options[:envvars] ||= {}.with_indifferent_access
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
4
|
+
require 'active_support/core_ext/object/blank'
|
5
|
+
require 'shellwords'
|
6
|
+
|
7
|
+
module EacRubyUtils
|
8
|
+
module Envs
|
9
|
+
class Command
|
10
|
+
module ExtraOptions
|
11
|
+
def chdir(dir)
|
12
|
+
duplicate_by_extra_options(chdir: dir)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def append_chdir(command)
|
18
|
+
extra_options[:chdir].present? ? "(cd '#{extra_options[:chdir]}' ; #{command} )" : command
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_ruby_utils/envs/base_command'
|
5
|
+
|
6
|
+
module EacRubyUtils
|
7
|
+
module Envs
|
8
|
+
class Command
|
9
|
+
require_sub __FILE__, include_modules: true, require_dependency: true
|
10
|
+
include ::EacRubyUtils::Envs::BaseCommand
|
11
|
+
|
12
|
+
class << self
|
13
|
+
# @param command [Array]
|
14
|
+
# @return [Array]
|
15
|
+
def sanitize_initialize_arguments(arguments)
|
16
|
+
if arguments.count == 1 && arguments.first.is_a?(Array)
|
17
|
+
arguments.first
|
18
|
+
elsif arguments.is_a?(Array)
|
19
|
+
arguments
|
20
|
+
else
|
21
|
+
raise "Invalid argument command: #{arguments}|#{arguments.class}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
common_constructor :env, :args, :extra_options, default: [{}] do
|
27
|
+
self.extra_options = extra_options.with_indifferent_access
|
28
|
+
self.args = self.class.sanitize_initialize_arguments(args)
|
29
|
+
end
|
30
|
+
|
31
|
+
def append(args)
|
32
|
+
duplicate_by_command(self.args + args)
|
33
|
+
end
|
34
|
+
|
35
|
+
def prepend(args)
|
36
|
+
duplicate_by_command(args + self.args)
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_s
|
40
|
+
"#{args} [ENV: #{env}]"
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [String]
|
44
|
+
def command_line_without_env
|
45
|
+
c = args
|
46
|
+
c = c.map { |x| escape(x) }.join(' ') if c.is_a?(Enumerable)
|
47
|
+
append_chdir(append_envvars(c))
|
48
|
+
end
|
49
|
+
|
50
|
+
protected
|
51
|
+
|
52
|
+
def duplicate(command, extra_options)
|
53
|
+
self.class.new(env, command, extra_options)
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def duplicate_by_command(new_command)
|
59
|
+
duplicate(new_command, extra_options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def duplicate_by_extra_options(set_extra_options)
|
63
|
+
duplicate(args, extra_options.merge(set_extra_options))
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_ruby_utils/envs/base_command'
|
5
|
+
|
6
|
+
module EacRubyUtils
|
7
|
+
module Envs
|
8
|
+
class CompositeCommand
|
9
|
+
include ::EacRubyUtils::Envs::BaseCommand
|
10
|
+
|
11
|
+
enable_listable
|
12
|
+
lists.add_string :operator, '&&' => :and, ';' => :before, '||' => :or, '|' => :pipe
|
13
|
+
|
14
|
+
common_constructor :operator, :left_command, :right_command do
|
15
|
+
self.operator = self.class.lists.operator.value_validate!(operator.to_s)
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [EacRubyUtils::Envs::BaseEnv]
|
19
|
+
delegate :env, to: :left_command
|
20
|
+
|
21
|
+
# @return [String]
|
22
|
+
def command_line_without_env(_options = {})
|
23
|
+
::Shellwords.join(['bash', '-c', bash_command])
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [String]
|
27
|
+
def bash_command
|
28
|
+
['set', '-euo', 'pipefail', OPERATOR_BEFORE, left_command_line, operator,
|
29
|
+
right_command_line].join(' ')
|
30
|
+
end
|
31
|
+
|
32
|
+
def left_command_line
|
33
|
+
left_command.command_line_without_env
|
34
|
+
end
|
35
|
+
|
36
|
+
def right_command_line
|
37
|
+
if right_command.env == left_command.env
|
38
|
+
right_command.command_line_without_env
|
39
|
+
else
|
40
|
+
right_command.command
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/listable'
|
4
|
+
require 'eac_ruby_utils/simple_cache'
|
5
|
+
|
6
|
+
module EacRubyUtils
|
7
|
+
module Envs
|
8
|
+
class Executable
|
9
|
+
include ::EacRubyUtils::Listable
|
10
|
+
include ::EacRubyUtils::SimpleCache
|
11
|
+
|
12
|
+
lists.add_symbol :option, :check_args, :exec_args, :auto_validate
|
13
|
+
|
14
|
+
DEFAULT_AUTO_VALIDATE = true
|
15
|
+
|
16
|
+
attr_reader :env, :name, :options
|
17
|
+
|
18
|
+
def initialize(env, name, *check_args)
|
19
|
+
@env = env
|
20
|
+
@name = name
|
21
|
+
self.options = self.class.lists.option.hash_keys_validate!(check_args.extract_options!)
|
22
|
+
options[OPTION_CHECK_ARGS] = check_args unless options.key?(OPTION_CHECK_ARGS)
|
23
|
+
options.freeze
|
24
|
+
end
|
25
|
+
|
26
|
+
def auto_validate?
|
27
|
+
options.key?(OPTION_AUTO_VALIDATE) ? options[OPTION_AUTO_VALIDATE] : DEFAULT_AUTO_VALIDATE
|
28
|
+
end
|
29
|
+
|
30
|
+
def check_args
|
31
|
+
options[OPTION_CHECK_ARGS]
|
32
|
+
end
|
33
|
+
|
34
|
+
def exist?
|
35
|
+
exist
|
36
|
+
end
|
37
|
+
|
38
|
+
def validate
|
39
|
+
return nil if exist?
|
40
|
+
|
41
|
+
"Program \"#{::Shellwords.join(executable_args)}\" not found in environment #{env}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def validate!
|
45
|
+
message = validate
|
46
|
+
|
47
|
+
raise ProgramNotFoundError, message if message
|
48
|
+
end
|
49
|
+
|
50
|
+
def command(*command_args)
|
51
|
+
validate! if auto_validate?
|
52
|
+
env.command(*executable_args, *command_args)
|
53
|
+
end
|
54
|
+
|
55
|
+
def executable_args
|
56
|
+
executable_args_from_envvar || executable_args_from_options || executable_args_from_name
|
57
|
+
end
|
58
|
+
|
59
|
+
def executable_args_envvar
|
60
|
+
"#{name}_command".variableize.upcase
|
61
|
+
end
|
62
|
+
|
63
|
+
def executable_args_from_envvar
|
64
|
+
ENV[executable_args_envvar].if_present { |v| ::Shellwords.split(v) }
|
65
|
+
end
|
66
|
+
|
67
|
+
# @return [Enumerable<String>]
|
68
|
+
def executable_args_from_name
|
69
|
+
::Shellwords.split(name)
|
70
|
+
end
|
71
|
+
|
72
|
+
# @return [Enumerable<String>]
|
73
|
+
def executable_args_from_options
|
74
|
+
options[OPTION_EXEC_ARGS].if_present do |v|
|
75
|
+
v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v.to_s)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
attr_writer :options
|
82
|
+
|
83
|
+
def exist_uncached
|
84
|
+
env.command(*executable_args, *check_args).execute!
|
85
|
+
true
|
86
|
+
rescue Errno::ENOENT
|
87
|
+
false
|
88
|
+
end
|
89
|
+
|
90
|
+
class ProgramNotFoundError < ::StandardError; end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/envs/execution_error'
|
4
|
+
|
5
|
+
module EacRubyUtils
|
6
|
+
module Envs
|
7
|
+
class ExecutionResult
|
8
|
+
attr_reader :r, :options
|
9
|
+
|
10
|
+
def initialize(result, options)
|
11
|
+
@r = result
|
12
|
+
@options = options
|
13
|
+
end
|
14
|
+
|
15
|
+
def result
|
16
|
+
return exit_code_zero_result if exit_code_zero?
|
17
|
+
return expected_error_result if expected_error?
|
18
|
+
|
19
|
+
raise ::EacRubyUtils::Envs::ExecutionError, 'Failed!'
|
20
|
+
end
|
21
|
+
|
22
|
+
def success?
|
23
|
+
exit_code_zero? || expected_error?
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def exit_code_zero?
|
29
|
+
r[:exit_code]&.zero?
|
30
|
+
end
|
31
|
+
|
32
|
+
def exit_code_zero_result
|
33
|
+
r[options[:output] || :stdout]
|
34
|
+
end
|
35
|
+
|
36
|
+
def expected_error_result
|
37
|
+
options[:exit_outputs][r[:exit_code]]
|
38
|
+
end
|
39
|
+
|
40
|
+
def expected_error?
|
41
|
+
options[:exit_outputs].is_a?(Hash) && options[:exit_outputs].key?(r[:exit_code])
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacRubyUtils
|
4
|
+
module Envs
|
5
|
+
class File
|
6
|
+
attr_reader :env, :path
|
7
|
+
|
8
|
+
def initialize(env, path)
|
9
|
+
@env = env
|
10
|
+
@path = path
|
11
|
+
end
|
12
|
+
|
13
|
+
def exist?
|
14
|
+
env.command('stat', path).execute[:exit_code].zero?
|
15
|
+
end
|
16
|
+
|
17
|
+
def read
|
18
|
+
env.command('cat', path).execute!
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/envs/base_env'
|
4
|
+
|
5
|
+
module EacRubyUtils
|
6
|
+
module Envs
|
7
|
+
class LocalEnv < ::EacRubyUtils::Envs::BaseEnv
|
8
|
+
def to_s
|
9
|
+
'LOCAL'
|
10
|
+
end
|
11
|
+
|
12
|
+
def command_line(line)
|
13
|
+
line
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'open3'
|
4
|
+
|
5
|
+
module EacRubyUtils
|
6
|
+
module Envs
|
7
|
+
class Process
|
8
|
+
EXIT_CODE_KEY = :exit_code
|
9
|
+
ERR_KEY = :stderr
|
10
|
+
OUT_KEY = :stdout
|
11
|
+
|
12
|
+
def initialize(command)
|
13
|
+
self.data = { command: command }
|
14
|
+
data[OUT_KEY], data[ERR_KEY], data[EXIT_CODE_KEY] = Open3.capture3(command)
|
15
|
+
data[EXIT_CODE_KEY] = data[EXIT_CODE_KEY].to_i
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_h
|
19
|
+
data.dup
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_accessor :data
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacRubyUtils
|
4
|
+
module Envs
|
5
|
+
class Spawn
|
6
|
+
attr_reader :command, :pid
|
7
|
+
|
8
|
+
def initialize(command)
|
9
|
+
@command = command
|
10
|
+
@pid = ::Process.spawn(command)
|
11
|
+
end
|
12
|
+
|
13
|
+
def kill(signal)
|
14
|
+
::Process.kill(signal, pid)
|
15
|
+
end
|
16
|
+
|
17
|
+
def kill_at_end(&block)
|
18
|
+
block.call(self)
|
19
|
+
ensure
|
20
|
+
kill('KILL')
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_h
|
24
|
+
{ command: command, pid: pid }
|
25
|
+
end
|
26
|
+
|
27
|
+
def wait
|
28
|
+
::Process.wait pid
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|