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,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/ruby'
|
4
|
+
|
5
|
+
RSpec.describe EacRubyUtils::Ruby, '#on_clean_environment' do
|
6
|
+
let(:envvar_name) { 'BUNDLE_NOT_EXISTENT_ENV_VAR' }
|
7
|
+
let(:envvar_value) { 'any value' }
|
8
|
+
let(:noruby_envvar_name) { 'ANY_ENVIRONMENT_VARIABLE' }
|
9
|
+
let(:noruby_envvar_value) { 'another any value' }
|
10
|
+
|
11
|
+
before do
|
12
|
+
ENV[envvar_name] = envvar_value
|
13
|
+
ENV[noruby_envvar_name] = noruby_envvar_value
|
14
|
+
end
|
15
|
+
|
16
|
+
it do # rubocop:disable RSpec/MultipleExpectations
|
17
|
+
expect(ENV.fetch(envvar_name, nil)).to eq(envvar_value)
|
18
|
+
described_class.on_clean_environment do
|
19
|
+
expect(ENV.fetch(envvar_name, nil)).to be_nil
|
20
|
+
end
|
21
|
+
expect(ENV.fetch(envvar_name, nil)).to eq(envvar_value)
|
22
|
+
end
|
23
|
+
|
24
|
+
it do # rubocop:disable RSpec/MultipleExpectations
|
25
|
+
expect(ENV.fetch(noruby_envvar_name, nil)).to eq(noruby_envvar_value)
|
26
|
+
described_class.on_clean_environment do
|
27
|
+
expect(ENV.fetch(noruby_envvar_name, nil)).to eq(noruby_envvar_value)
|
28
|
+
end
|
29
|
+
expect(ENV.fetch(noruby_envvar_name, nil)).to eq(noruby_envvar_value)
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/ruby'
|
4
|
+
|
5
|
+
RSpec.describe EacRubyUtils::Ruby, '#on_replace_objects' do
|
6
|
+
let(:stub_class) do
|
7
|
+
Class.new do
|
8
|
+
def self.my_class_method
|
9
|
+
'Original'
|
10
|
+
end
|
11
|
+
|
12
|
+
def my_instance_method
|
13
|
+
'Original'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:stub_instance) { stub_class.new }
|
19
|
+
|
20
|
+
let(:replace_block) do
|
21
|
+
proc { 'Replaced' }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#my_instance_method' do
|
25
|
+
let(:before) { stub_instance.my_instance_method }
|
26
|
+
let(:inside) do
|
27
|
+
described_class.on_replace_objects do |replacer|
|
28
|
+
replacer.replace_instance_method(stub_class, :my_instance_method, &replace_block)
|
29
|
+
stub_instance.my_instance_method
|
30
|
+
end
|
31
|
+
end
|
32
|
+
let(:after) { stub_instance.my_instance_method }
|
33
|
+
|
34
|
+
before do
|
35
|
+
before
|
36
|
+
inside
|
37
|
+
after
|
38
|
+
end
|
39
|
+
|
40
|
+
it { expect(before).to eq('Original') }
|
41
|
+
it { expect(inside).to eq('Replaced') }
|
42
|
+
it { expect(after).to eq('Original') }
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#replace_self_method' do
|
46
|
+
let(:before) { stub_class.my_class_method }
|
47
|
+
let(:inside) do
|
48
|
+
described_class.on_replace_objects do |replacer|
|
49
|
+
replacer.replace_self_method(stub_class, :my_class_method, &replace_block)
|
50
|
+
stub_class.my_class_method
|
51
|
+
end
|
52
|
+
end
|
53
|
+
let(:after) { stub_class.my_class_method }
|
54
|
+
|
55
|
+
before do
|
56
|
+
before
|
57
|
+
inside
|
58
|
+
after
|
59
|
+
end
|
60
|
+
|
61
|
+
it { expect(before).to eq('Original') }
|
62
|
+
it { expect(inside).to eq('Replaced') }
|
63
|
+
it { expect(after).to eq('Original') }
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/settings_provider'
|
4
|
+
|
5
|
+
RSpec.describe EacRubyUtils::SettingsProvider do
|
6
|
+
let(:stub_class) do
|
7
|
+
the_described_class = described_class
|
8
|
+
r = Class.new do
|
9
|
+
include the_described_class
|
10
|
+
|
11
|
+
def key_a
|
12
|
+
'method_a'
|
13
|
+
end
|
14
|
+
|
15
|
+
def key_b
|
16
|
+
'method_b'
|
17
|
+
end
|
18
|
+
|
19
|
+
def key_f
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def settings
|
24
|
+
{ 'key_b' => 'setting_b', key_c: 'setting_c' }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
r.const_set(:KEY_A, 'constant_a')
|
28
|
+
r.const_set(:KEY_D, 'constant_d')
|
29
|
+
r
|
30
|
+
end
|
31
|
+
|
32
|
+
let(:stub) { stub_class.new }
|
33
|
+
|
34
|
+
describe '#setting_value' do
|
35
|
+
{
|
36
|
+
['key_a'] => 'method_a',
|
37
|
+
[:key_b] => 'setting_b',
|
38
|
+
['key_b', { order: %w[constant method settings_object] }] => 'method_b',
|
39
|
+
['key_c'] => 'setting_c',
|
40
|
+
['key_d'] => 'constant_d',
|
41
|
+
['key_f'] => nil
|
42
|
+
}.each do |args, expected_value|
|
43
|
+
context "when args are \"#{args}\"" do
|
44
|
+
it { expect(stub.setting_value(*args)).to eq(expected_value) }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it do
|
49
|
+
expect { stub.setting_value('key_e') }.to raise_error(StandardError)
|
50
|
+
end
|
51
|
+
|
52
|
+
it do
|
53
|
+
expect(stub.setting_value('key_e', required: false)).to be_nil
|
54
|
+
end
|
55
|
+
|
56
|
+
it do
|
57
|
+
expect(stub.setting_value('key_e', default: nil)).to be_nil
|
58
|
+
end
|
59
|
+
|
60
|
+
it do
|
61
|
+
expect(stub.setting_value('key_e', default: 'default_e')).to eq('default_e')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/simple_cache'
|
4
|
+
|
5
|
+
class CacheableObject
|
6
|
+
include ::EacRubyUtils::SimpleCache
|
7
|
+
|
8
|
+
def my_method_uncached
|
9
|
+
@counter ||= 0
|
10
|
+
@counter += 1
|
11
|
+
end
|
12
|
+
|
13
|
+
def method_with_question_uncached?
|
14
|
+
'question'
|
15
|
+
end
|
16
|
+
|
17
|
+
def method_with_exclamation_uncached!
|
18
|
+
'exclamation'
|
19
|
+
end
|
20
|
+
|
21
|
+
def method_with_args_uncached(arg1)
|
22
|
+
@counter2 ||= 0
|
23
|
+
@counter2 += 1
|
24
|
+
"#{arg1}/#{@counter2}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def method_with_reset_uncached
|
28
|
+
reset_cache
|
29
|
+
'result'
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def private_method_uncached
|
35
|
+
@counter3 ||= 0
|
36
|
+
@counter3 += 1
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
RSpec.describe EacRubyUtils::SimpleCache do
|
41
|
+
let(:instance) { CacheableObject.new }
|
42
|
+
|
43
|
+
describe 'cached value' do
|
44
|
+
it 'uncached method return value should update at each call' do
|
45
|
+
expect(instance.my_method_uncached).not_to eq(instance.my_method_uncached)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'cached method should return same values at each call' do
|
49
|
+
expect(instance.my_method).to eq(instance.my_method) # rubocop:disable RSpec/IdenticalEqualityAssertion
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'is able to call private uncached as cached' do
|
53
|
+
expect(instance.private_method).to eq(instance.private_method) # rubocop:disable RSpec/IdenticalEqualityAssertion
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'return value even if reset cache' do
|
57
|
+
expect(instance.method_with_reset).to eq('result')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe 'cache value with args' do
|
62
|
+
it do
|
63
|
+
expect(instance.method_with_args_uncached('123'))
|
64
|
+
.not_to eq(instance.method_with_args_uncached('123'))
|
65
|
+
end
|
66
|
+
|
67
|
+
it do
|
68
|
+
expect(instance.method_with_args_uncached('456'))
|
69
|
+
.not_to eq(instance.method_with_args_uncached('456'))
|
70
|
+
end
|
71
|
+
|
72
|
+
it do
|
73
|
+
expect(instance.method_with_args('123')).to eq(instance.method_with_args('123')) # rubocop:disable RSpec/IdenticalEqualityAssertion
|
74
|
+
end
|
75
|
+
|
76
|
+
it do
|
77
|
+
expect(instance.method_with_args('456')).to eq(instance.method_with_args('456')) # rubocop:disable RSpec/IdenticalEqualityAssertion
|
78
|
+
end
|
79
|
+
|
80
|
+
it do
|
81
|
+
expect(instance.method_with_args('456')).not_to eq(instance.method_with_args('123'))
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe 'method with marks' do
|
86
|
+
it 'found uncached method with exclamation mark' do
|
87
|
+
expect(instance.method_with_exclamation!).to eq('exclamation')
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'found uncached method with question mark' do
|
91
|
+
expect(instance.method_with_question?).to eq('question')
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe '#respond_to?' do
|
96
|
+
it 'responds to cached method without args' do
|
97
|
+
expect(instance.respond_to?(:my_method)).to be(true)
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'responds to cached method with args' do
|
101
|
+
expect(instance.respond_to?(:method_with_args)).to be(true)
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'responds to cached method of uncached private method' do
|
105
|
+
expect(instance.respond_to?(:private_method)).to be(true)
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'not respond to not existent method' do
|
109
|
+
expect(instance.respond_to?(:not_exist)).to be(false)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe '#reset_cache' do
|
114
|
+
let(:instance) { CacheableObject.new }
|
115
|
+
let(:cached_value) { instance.my_method }
|
116
|
+
|
117
|
+
it 'cached method return should return cached value' do
|
118
|
+
expect(instance.my_method).to eq(cached_value)
|
119
|
+
end
|
120
|
+
|
121
|
+
context 'when reset_cache method is called' do
|
122
|
+
it 'cached method return should return new cached value' do
|
123
|
+
cached_value
|
124
|
+
instance.reset_cache
|
125
|
+
expect(instance.my_method).not_to eq(cached_value)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/static_method_class'
|
4
|
+
|
5
|
+
RSpec.describe EacRubyUtils::StaticMethodClass do
|
6
|
+
let(:sender_class) do
|
7
|
+
Class.new do
|
8
|
+
class << self
|
9
|
+
def sender_value
|
10
|
+
'AAA'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:method_class) do
|
17
|
+
the_described_class = described_class
|
18
|
+
Class.new do
|
19
|
+
def self.name
|
20
|
+
'TheSender::PerformX'
|
21
|
+
end
|
22
|
+
|
23
|
+
include the_described_class
|
24
|
+
attr_accessor :sender, :method_param
|
25
|
+
|
26
|
+
def initialize(sender, method_param)
|
27
|
+
self.sender = sender
|
28
|
+
self.method_param = method_param
|
29
|
+
end
|
30
|
+
|
31
|
+
def result
|
32
|
+
"#{sender.sender_value},#{method_param}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
before do
|
38
|
+
Object.const_set('TheSender', sender_class)
|
39
|
+
sender_class.const_set('PerformX', method_class)
|
40
|
+
end
|
41
|
+
|
42
|
+
it { expect(sender_class).to respond_to(:perform_x) }
|
43
|
+
it { expect(sender_class.perform_x('BBB')).to eq('AAA,BBB') }
|
44
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/struct'
|
4
|
+
|
5
|
+
RSpec.describe EacRubyUtils::Struct do
|
6
|
+
let(:instance) { described_class.new('a' => 1, b: '') }
|
7
|
+
let(:other) { described_class.new('a' => 'm1', c: 'm2') }
|
8
|
+
|
9
|
+
describe '#[]' do
|
10
|
+
it { expect(instance[:a]).to eq(1) }
|
11
|
+
it { expect(instance['a']).to eq(1) }
|
12
|
+
it { expect(instance[:a?]).to be(true) }
|
13
|
+
it { expect(instance['a?']).to be(true) }
|
14
|
+
it { expect(instance[:b]).to eq('') }
|
15
|
+
it { expect(instance['b']).to eq('') }
|
16
|
+
it { expect(instance[:b?]).to be(false) }
|
17
|
+
it { expect(instance['b?']).to be(false) }
|
18
|
+
it { expect(instance[:c]).to be_nil }
|
19
|
+
it { expect(instance['c']).to be_nil }
|
20
|
+
it { expect(instance[:c?]).to be(false) }
|
21
|
+
it { expect(instance['c?']).to be(false) }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#fetch' do
|
25
|
+
it { expect(instance.fetch(:a)).to eq(1) }
|
26
|
+
it { expect(instance.fetch('a')).to eq(1) }
|
27
|
+
it { expect(instance.fetch(:a?)).to be(true) }
|
28
|
+
it { expect(instance.fetch('a?')).to be(true) }
|
29
|
+
it { expect(instance.fetch(:b)).to eq('') }
|
30
|
+
it { expect(instance.fetch('b')).to eq('') }
|
31
|
+
it { expect(instance.fetch(:b?)).to be(false) }
|
32
|
+
it { expect(instance.fetch('b?')).to be(false) }
|
33
|
+
it { expect { instance.fetch(:c) }.to raise_error(KeyError) }
|
34
|
+
it { expect { instance.fetch('c') }.to raise_error(KeyError) }
|
35
|
+
it { expect { instance.fetch(:c?) }.to raise_error(KeyError) }
|
36
|
+
it { expect { instance.fetch('c?') }.to raise_error(KeyError) }
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '#merge' do
|
40
|
+
let(:merged) { instance.merge(other) }
|
41
|
+
|
42
|
+
it { expect(merged.to_h).to eq(a: 'm1', b: '', c: 'm2') }
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#property_method' do
|
46
|
+
it { expect(instance.a).to eq(1) }
|
47
|
+
it { expect(instance.a?).to be(true) }
|
48
|
+
it { expect(instance.b).to eq('') }
|
49
|
+
it { expect(instance.b?).to be(false) }
|
50
|
+
it { expect { instance.c }.to raise_error(NoMethodError) }
|
51
|
+
it { expect { instance.c? }.to raise_error(NoMethodError) }
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#to_h' do
|
55
|
+
it { expect(instance.to_h).to eq(a: 1, b: '') }
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/wildcards'
|
4
|
+
|
5
|
+
RSpec.describe EacRubyUtils::Wildcards do
|
6
|
+
describe '#match' do
|
7
|
+
{
|
8
|
+
'h*llo' => { 'hello' => true, 'hallo' => true, 'hxllo' => true, 'hillo' => true },
|
9
|
+
'w?rld' => { 'world' => true, 'warld' => true, 'wzzrld' => false },
|
10
|
+
'h*l?o' => { 'hello' => true, 'hallo' => true, 'hxxllo' => true, 'hilbbo' => false },
|
11
|
+
'' => { '' => true, 'hello' => false },
|
12
|
+
'hello' => { '' => false, 'hello' => true }
|
13
|
+
}.each do |pattern, examples|
|
14
|
+
context "when pattern is '#{pattern}'" do
|
15
|
+
let(:instance) { described_class.new(pattern) }
|
16
|
+
|
17
|
+
examples.each do |string, expected_result|
|
18
|
+
context "when string is \"#{string}\"" do
|
19
|
+
it do
|
20
|
+
expect(instance.match?(string)).to eq(expected_result)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/hash_with_indifferent_access'
|
4
|
+
require 'eac_ruby_utils/yaml'
|
5
|
+
|
6
|
+
RSpec.describe EacRubyUtils::Yaml do
|
7
|
+
let(:unpermitted_class) do
|
8
|
+
Class.new do
|
9
|
+
def initialize(value)
|
10
|
+
@value = value
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_s
|
14
|
+
@value.to_s
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:arrayliable_class) do
|
20
|
+
Class.new do
|
21
|
+
def initialize(value)
|
22
|
+
@value = value
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_a
|
26
|
+
[@value]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
let(:source) do
|
32
|
+
{
|
33
|
+
a: 'a', b: :b, c: false, d: true, e: nil,
|
34
|
+
f: [
|
35
|
+
'f',
|
36
|
+
{
|
37
|
+
g: 'g',
|
38
|
+
h: ActiveSupport::HashWithIndifferentAccess.new(
|
39
|
+
'i' => ['i', unpermitted_class.new('j')],
|
40
|
+
k: arrayliable_class.new('k')
|
41
|
+
)
|
42
|
+
}
|
43
|
+
]
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
let(:target) do
|
48
|
+
{
|
49
|
+
a: 'a', b: :b, c: false, d: true, e: nil,
|
50
|
+
f: ['f', { g: 'g', h: { i: %w[i j], k: ['k'] } }]
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#dump' do
|
55
|
+
it { expect(described_class.load(described_class.dump(source))).to eq(target) }
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '#sanitize' do
|
59
|
+
it { expect(described_class.sanitize(target)).to eq(target) }
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '#yaml' do
|
63
|
+
{
|
64
|
+
['text'] => false,
|
65
|
+
'text' => false,
|
66
|
+
"--- Text\n\n" => true,
|
67
|
+
"---\n:index: 0\n:codec_name: h264\n:codec_type: video\n" => true,
|
68
|
+
'--- - \n bla bla bla' => false,
|
69
|
+
"---\n*STRING" => false
|
70
|
+
}.each do |source, result|
|
71
|
+
it "return #{result} to source \"#{source}\"" do
|
72
|
+
expect(described_class.yaml?(source)).to eq(result)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
pt-BR:
|
2
|
+
eac_ruby_utils:
|
3
|
+
listable:
|
4
|
+
stub:
|
5
|
+
inteiro:
|
6
|
+
a:
|
7
|
+
label: Inteiro A
|
8
|
+
description: Inteiro A Descr.
|
9
|
+
b:
|
10
|
+
label: Inteiro BB
|
11
|
+
description: Inteiro BB Descr.
|
12
|
+
c:
|
13
|
+
label: Inteiro CCC
|
14
|
+
description: Inteiro CCC Descr.
|
15
|
+
__blank:
|
16
|
+
label: Inteiro em branco
|
17
|
+
description: Inteiro em branco Descr.
|
18
|
+
cadeia:
|
19
|
+
a:
|
20
|
+
label: Cadeia AAA
|
21
|
+
description: Cadeia AAA Descr.
|
22
|
+
b:
|
23
|
+
label: Cadeia BB
|
24
|
+
description: Cadeia BB Descr.
|
25
|
+
c:
|
26
|
+
label: Cadeia C
|
27
|
+
description: Cadeia C Descr.
|
28
|
+
code:
|
29
|
+
a:
|
30
|
+
label: Código A
|
31
|
+
description: Código A Descr.
|
32
|
+
b:
|
33
|
+
label: Código B
|
34
|
+
description: Código B Descr.
|
35
|
+
type:
|
36
|
+
a:
|
37
|
+
label: Tipo A
|
38
|
+
description: Tipo A Descr.
|
39
|
+
b:
|
40
|
+
label: Tipo B
|
41
|
+
description: Tipo B Descr.
|
42
|
+
simbolo:
|
43
|
+
a:
|
44
|
+
label: Simbolo A
|
45
|
+
description: Simbolo A Descr.
|
46
|
+
b:
|
47
|
+
label: Simbolo B
|
48
|
+
description: Simbolo B Descr.
|
49
|
+
c:
|
50
|
+
label: Simbolo C
|
51
|
+
description: Simbolo C Descr.
|
52
|
+
tipado:
|
53
|
+
a:
|
54
|
+
label: Tipado A
|
55
|
+
description: Tipado A Descr.
|
56
|
+
b:
|
57
|
+
label: Tipado B
|
58
|
+
description: Tipado B Descr.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('../lib', __dir__)
|
4
|
+
require 'tmpdir'
|
5
|
+
|
6
|
+
require 'i18n'
|
7
|
+
I18n.load_path << File.join(__dir__, 'locales/pt-BR.yml')
|
8
|
+
I18n.locale = 'pt-BR' # rubocop:disable Rails/I18nLocaleAssignment
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.example_status_persistence_file_path = File.join(Dir.tmpdir, 'eac_ruby_utils_rspec')
|
12
|
+
|
13
|
+
require 'eac_ruby_utils/rspec/default_setup'
|
14
|
+
EacRubyUtils::Rspec.default_setup_create(File.expand_path('..', __dir__), config)
|
15
|
+
end
|