foobara 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +5 -0
- data/.rubocop.yml +20 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +10 -0
- data/DECISION_LOG.md +220 -0
- data/Guardfile +9 -0
- data/LICENSE-AGPL.txt +666 -0
- data/LICENSE.txt +4 -0
- data/README.md +50 -0
- data/Rakefile +10 -0
- data/concepts.md +153 -0
- data/projects/builtin_types/lib/foobara/builtin_types.rb +67 -0
- data/projects/builtin_types/src/README.md +140 -0
- data/projects/builtin_types/src/array/casters/arrayable.rb +22 -0
- data/projects/builtin_types/src/array/supported_processors/element_type_declaration.rb +41 -0
- data/projects/builtin_types/src/array/supported_validators/size.rb +43 -0
- data/projects/builtin_types/src/associative_array/casters/array.rb +22 -0
- data/projects/builtin_types/src/associative_array/supported_processors/key_type_declaration.rb +44 -0
- data/projects/builtin_types/src/associative_array/supported_processors/value_type_declaration.rb +44 -0
- data/projects/builtin_types/src/atomic_duck.rb +6 -0
- data/projects/builtin_types/src/attributes/casters/array.rb +33 -0
- data/projects/builtin_types/src/attributes/casters/hash.rb +28 -0
- data/projects/builtin_types/src/attributes/supported_processors/element_type_declarations.rb +89 -0
- data/projects/builtin_types/src/attributes/supported_transformers/defaults/type_declaration_extension/extend_attributes_type_declaration/desugarizers/move_defaults_from_element_types_to_root.rb +40 -0
- data/projects/builtin_types/src/attributes/supported_transformers/defaults/type_declaration_extension/extend_attributes_type_declaration/desugarizers/symbolize_defaults.rb +31 -0
- data/projects/builtin_types/src/attributes/supported_transformers/defaults/type_declaration_extension/extend_attributes_type_declaration/type_declaration_validators/hash_with_symbolic_keys.rb +37 -0
- data/projects/builtin_types/src/attributes/supported_transformers/defaults/type_declaration_extension/extend_attributes_type_declaration/type_declaration_validators/valid_attribute_names.rb +60 -0
- data/projects/builtin_types/src/attributes/supported_transformers/defaults.rb +41 -0
- data/projects/builtin_types/src/attributes/supported_validators/required/type_declaration_extension/extend_attributes_type_declaration/desugarizers/move_required_from_element_types_to_root.rb +55 -0
- data/projects/builtin_types/src/attributes/supported_validators/required/type_declaration_extension/extend_attributes_type_declaration/type_declaration_validators/array_of_symbols.rb +47 -0
- data/projects/builtin_types/src/attributes/supported_validators/required/type_declaration_extension/extend_attributes_type_declaration/type_declaration_validators/array_with_valid_attribute_names.rb +54 -0
- data/projects/builtin_types/src/attributes/supported_validators/required.rb +51 -0
- data/projects/builtin_types/src/big_decimal/casters/integer.rb +21 -0
- data/projects/builtin_types/src/big_decimal/casters/string.rb +24 -0
- data/projects/builtin_types/src/boolean/casters/numeric.rb +21 -0
- data/projects/builtin_types/src/boolean/casters/string_or_symbol.rb +27 -0
- data/projects/builtin_types/src/builtin_types.rb +189 -0
- data/projects/builtin_types/src/date/casters/hash.rb +23 -0
- data/projects/builtin_types/src/date/casters/string.rb +40 -0
- data/projects/builtin_types/src/datetime/casters/date.rb +21 -0
- data/projects/builtin_types/src/datetime/casters/hash.rb +77 -0
- data/projects/builtin_types/src/datetime/casters/seconds_since_epoch.rb +21 -0
- data/projects/builtin_types/src/datetime/casters/string.rb +31 -0
- data/projects/builtin_types/src/duck/supported_casters/allow_nil.rb +38 -0
- data/projects/builtin_types/src/duck/supported_validators/instance_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/class_desugarizer.rb +29 -0
- data/projects/builtin_types/src/duck/supported_validators/instance_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/instance_of_class_desugarizer.rb +31 -0
- data/projects/builtin_types/src/duck/supported_validators/instance_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/instance_of_symbol_desugarizer.rb +31 -0
- data/projects/builtin_types/src/duck/supported_validators/instance_of/type_declaration_extension/extend_registered_type_declaration/type_declaration_validators/is_valid_class.rb +43 -0
- data/projects/builtin_types/src/duck/supported_validators/instance_of.rb +42 -0
- data/projects/builtin_types/src/duck/supported_validators/one_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/cast_one_of.rb +37 -0
- data/projects/builtin_types/src/duck/supported_validators/one_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/module_desugarizer.rb +41 -0
- data/projects/builtin_types/src/duck/supported_validators/one_of.rb +41 -0
- data/projects/builtin_types/src/duck.rb +6 -0
- data/projects/builtin_types/src/duckture.rb +6 -0
- data/projects/builtin_types/src/email/transformers/downcase.rb +15 -0
- data/projects/builtin_types/src/email/validator_base.rb +94 -0
- data/projects/builtin_types/src/float/casters/integer.rb +21 -0
- data/projects/builtin_types/src/float/casters/string.rb +24 -0
- data/projects/builtin_types/src/integer/casters/string.rb +23 -0
- data/projects/builtin_types/src/number/supported_validators/max.rb +41 -0
- data/projects/builtin_types/src/number/supported_validators/min.rb +41 -0
- data/projects/builtin_types/src/string/casters/numeric.rb +21 -0
- data/projects/builtin_types/src/string/casters/symbol.rb +21 -0
- data/projects/builtin_types/src/string/supported_transformers/downcase.rb +11 -0
- data/projects/builtin_types/src/string/supported_validators/matches.rb +41 -0
- data/projects/builtin_types/src/string/supported_validators/max_length.rb +37 -0
- data/projects/builtin_types/src/symbol/casters/string.rb +21 -0
- data/projects/builtin_types/src/tuple/supported_processors/element_type_declarations/type_declaration_extension/extend_tuple_type_declaration/desugarizers/set_size.rb +32 -0
- data/projects/builtin_types/src/tuple/supported_processors/element_type_declarations/type_declaration_extension/extend_tuple_type_declaration/type_declaration_validators/size_matches.rb +50 -0
- data/projects/builtin_types/src/tuple/supported_processors/element_type_declarations.rb +59 -0
- data/projects/callback/lib/foobara/callback.rb +1 -0
- data/projects/callback/src/block/after.rb +10 -0
- data/projects/callback/src/block/around.rb +10 -0
- data/projects/callback/src/block/before.rb +10 -0
- data/projects/callback/src/block/concerns/block_parameter_not_allowed.rb +21 -0
- data/projects/callback/src/block/concerns/block_parameter_required.rb +21 -0
- data/projects/callback/src/block/concerns/keyword_argumentable_block.rb +31 -0
- data/projects/callback/src/block/concerns/single_argument_block.rb +22 -0
- data/projects/callback/src/block/concerns/type.rb +17 -0
- data/projects/callback/src/block/error.rb +10 -0
- data/projects/callback/src/block.rb +83 -0
- data/projects/callback/src/registry/base.rb +90 -0
- data/projects/callback/src/registry/chained_conditioned.rb +24 -0
- data/projects/callback/src/registry/chained_multiple_action.rb +24 -0
- data/projects/callback/src/registry/conditioned.rb +101 -0
- data/projects/callback/src/registry/multiple_action.rb +110 -0
- data/projects/callback/src/registry/single_action.rb +15 -0
- data/projects/callback/src/runner.rb +89 -0
- data/projects/callback/src/set.rb +56 -0
- data/projects/command/lib/foobara/command.rb +9 -0
- data/projects/command/src/command/entity_helpers.rb +145 -0
- data/projects/command/src/command.rb +36 -0
- data/projects/command/src/concerns/callbacks.rb +93 -0
- data/projects/command/src/concerns/description.rb +23 -0
- data/projects/command/src/concerns/domain_mappers.rb +35 -0
- data/projects/command/src/concerns/entities.rb +88 -0
- data/projects/command/src/concerns/errors.rb +181 -0
- data/projects/command/src/concerns/errors_type.rb +124 -0
- data/projects/command/src/concerns/inputs.rb +59 -0
- data/projects/command/src/concerns/inputs_type.rb +58 -0
- data/projects/command/src/concerns/namespace.rb +49 -0
- data/projects/command/src/concerns/reflection.rb +137 -0
- data/projects/command/src/concerns/result.rb +25 -0
- data/projects/command/src/concerns/result_type.rb +29 -0
- data/projects/command/src/concerns/runtime.rb +119 -0
- data/projects/command/src/concerns/state_machine.rb +12 -0
- data/projects/command/src/concerns/subcommands.rb +102 -0
- data/projects/command/src/concerns/transactions.rb +81 -0
- data/projects/command/src/state_machine.rb +57 -0
- data/projects/command/src/transformed_command.rb +459 -0
- data/projects/command_connectors/lib/foobara/command_connectors.rb +12 -0
- data/projects/command_connectors/src/command_connector.rb +401 -0
- data/projects/command_connectors/src/command_registry/allowed_rule.rb +29 -0
- data/projects/command_connectors/src/command_registry/exposed_command.rb +140 -0
- data/projects/command_connectors/src/command_registry/exposed_domain.rb +30 -0
- data/projects/command_connectors/src/command_registry/exposed_organization.rb +30 -0
- data/projects/command_connectors/src/command_registry.rb +257 -0
- data/projects/command_connectors/src/commands/describe.rb +36 -0
- data/projects/command_connectors/src/commands/list_commands.rb +51 -0
- data/projects/command_connectors/src/commands/ping.rb +21 -0
- data/projects/command_connectors/src/commands/query_git_commit_info.rb +81 -0
- data/projects/command_connectors/src/request.rb +99 -0
- data/projects/command_connectors/src/response.rb +17 -0
- data/projects/command_connectors/src/serializer.rb +25 -0
- data/projects/command_connectors/src/serializers/aggregate_serializer.rb +32 -0
- data/projects/command_connectors/src/serializers/atomic_serializer.rb +25 -0
- data/projects/command_connectors/src/serializers/entities_to_primary_keys_serializer.rb +28 -0
- data/projects/command_connectors/src/serializers/errors_serializer.rb +18 -0
- data/projects/command_connectors/src/serializers/json_serializer.rb +20 -0
- data/projects/command_connectors/src/serializers/noop_serializer.rb +20 -0
- data/projects/command_connectors/src/serializers/record_store_serializer.rb +31 -0
- data/projects/command_connectors/src/serializers/success_serializer.rb +14 -0
- data/projects/command_connectors/src/serializers/yaml_serializer.rb +20 -0
- data/projects/command_connectors/src/transformers/auth_errors_transformer.rb +35 -0
- data/projects/command_connectors/src/transformers/load_aggregates_pre_commit_transformer.rb +36 -0
- data/projects/command_connectors_http/lib/foobara/command_connectors_http.rb +6 -0
- data/projects/command_connectors_http/src/http/commands/get_options.rb +16 -0
- data/projects/command_connectors_http/src/http/commands/help/presenter/command.rb +14 -0
- data/projects/command_connectors_http/src/http/commands/help/presenter/domain.rb +14 -0
- data/projects/command_connectors_http/src/http/commands/help/presenter/entity.rb +14 -0
- data/projects/command_connectors_http/src/http/commands/help/presenter/error.rb +14 -0
- data/projects/command_connectors_http/src/http/commands/help/presenter/model.rb +14 -0
- data/projects/command_connectors_http/src/http/commands/help/presenter/organization.rb +14 -0
- data/projects/command_connectors_http/src/http/commands/help/presenter/processor.rb +14 -0
- data/projects/command_connectors_http/src/http/commands/help/presenter/processor_class.rb +14 -0
- data/projects/command_connectors_http/src/http/commands/help/presenter/root.rb +14 -0
- data/projects/command_connectors_http/src/http/commands/help/presenter/type.rb +14 -0
- data/projects/command_connectors_http/src/http/commands/help/presenter.rb +162 -0
- data/projects/command_connectors_http/src/http/commands/help/templates/command.html.erb +11 -0
- data/projects/command_connectors_http/src/http/commands/help/templates/domain.html.erb +1 -0
- data/projects/command_connectors_http/src/http/commands/help/templates/entity.html.erb +1 -0
- data/projects/command_connectors_http/src/http/commands/help/templates/error.html.erb +1 -0
- data/projects/command_connectors_http/src/http/commands/help/templates/model.html.erb +1 -0
- data/projects/command_connectors_http/src/http/commands/help/templates/organization.html.erb +1 -0
- data/projects/command_connectors_http/src/http/commands/help/templates/processor.html.erb +1 -0
- data/projects/command_connectors_http/src/http/commands/help/templates/processor_class.html.erb +1 -0
- data/projects/command_connectors_http/src/http/commands/help/templates/root.html.erb +3 -0
- data/projects/command_connectors_http/src/http/commands/help/templates/type.html.erb +1 -0
- data/projects/command_connectors_http/src/http/commands/help.rb +98 -0
- data/projects/command_connectors_http/src/http/request.rb +98 -0
- data/projects/command_connectors_http/src/http/response.rb +14 -0
- data/projects/command_connectors_http/src/http.rb +84 -0
- data/projects/common/lib/foobara/common.rb +11 -0
- data/projects/common/src/data_path.rb +272 -0
- data/projects/common/src/error.rb +215 -0
- data/projects/common/src/error_collection.rb +97 -0
- data/projects/common/src/error_key.rb +168 -0
- data/projects/common/src/outcome.rb +101 -0
- data/projects/common/src/possible_error.rb +80 -0
- data/projects/common/src/runtime_error.rb +24 -0
- data/projects/concerns/lib/foobara/concerns.rb +1 -0
- data/projects/concerns/src/concern.rb +93 -0
- data/projects/delegate/lib/foobara/delegate.rb +1 -0
- data/projects/delegate/src/extensions/module.rb +12 -0
- data/projects/domain/lib/foobara/domain.rb +25 -0
- data/projects/domain/src/domain.rb +65 -0
- data/projects/domain/src/domain_mapper/registry.rb +47 -0
- data/projects/domain/src/domain_mapper.rb +162 -0
- data/projects/domain/src/domain_module_extension.rb +510 -0
- data/projects/domain/src/extensions/foobara.rb +69 -0
- data/projects/domain/src/global_domain.rb +14 -0
- data/projects/domain/src/global_organization.rb +12 -0
- data/projects/domain/src/is_manifestable.rb +68 -0
- data/projects/domain/src/manifestable.rb +12 -0
- data/projects/domain/src/module_extension.rb +122 -0
- data/projects/domain/src/organization.rb +52 -0
- data/projects/domain/src/organization_module_extension.rb +50 -0
- data/projects/entity/lib/foobara/entity.rb +27 -0
- data/projects/entity/src/concerns/associations.rb +241 -0
- data/projects/entity/src/concerns/attributes.rb +170 -0
- data/projects/entity/src/concerns/callbacks.rb +97 -0
- data/projects/entity/src/concerns/initialization.rb +127 -0
- data/projects/entity/src/concerns/persistence.rb +142 -0
- data/projects/entity/src/concerns/primary_key.rb +43 -0
- data/projects/entity/src/concerns/queries.rb +96 -0
- data/projects/entity/src/concerns/reflection.rb +51 -0
- data/projects/entity/src/concerns/transactions.rb +31 -0
- data/projects/entity/src/concerns/types.rb +31 -0
- data/projects/entity/src/entity.rb +61 -0
- data/projects/entity/src/extensions/builtin_types/entity/casters/hash.rb +33 -0
- data/projects/entity/src/extensions/builtin_types/entity/validators/attributes_declaration.rb +32 -0
- data/projects/entity/src/extensions/builtin_types/entity.rb +6 -0
- data/projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/attributes_handler_desugarizer.rb +14 -0
- data/projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/hash_desugarizer.rb +43 -0
- data/projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/model_class_desugarizer.rb +21 -0
- data/projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/primary_key_desugarizer.rb +19 -0
- data/projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/to_type_transformer.rb +64 -0
- data/projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_is_symbol.rb +35 -0
- data/projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb +27 -0
- data/projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_references_attribute.rb +36 -0
- data/projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration.rb +11 -0
- data/projects/entity/src/new_prepend.rb +21 -0
- data/projects/entity/src/not_found_error.rb +72 -0
- data/projects/enumerated/lib/foobara/enumerated.rb +1 -0
- data/projects/enumerated/src/accessors.rb +61 -0
- data/projects/enumerated/src/values.rb +121 -0
- data/projects/foobara/lib/foobara/all.rb +44 -0
- data/projects/in_memory_crud_driver/lib/foobara/in_memory_crud_driver.rb +3 -0
- data/projects/in_memory_crud_driver/src/in_memory.rb +10 -0
- data/projects/in_memory_crud_driver_minimal/lib/foobara/in_memory_crud_driver_minimal.rb +1 -0
- data/projects/in_memory_crud_driver_minimal/src/in_memory_minimal.rb +113 -0
- data/projects/manifest/lib/foobara/manifest.rb +4 -0
- data/projects/manifest/src/foobara/manifest/array.rb +13 -0
- data/projects/manifest/src/foobara/manifest/attributes.rb +40 -0
- data/projects/manifest/src/foobara/manifest/base_manifest.rb +161 -0
- data/projects/manifest/src/foobara/manifest/command.rb +59 -0
- data/projects/manifest/src/foobara/manifest/domain.rb +43 -0
- data/projects/manifest/src/foobara/manifest/entity.rb +35 -0
- data/projects/manifest/src/foobara/manifest/error.rb +33 -0
- data/projects/manifest/src/foobara/manifest/model.rb +43 -0
- data/projects/manifest/src/foobara/manifest/organization.rb +45 -0
- data/projects/manifest/src/foobara/manifest/possible_error.rb +30 -0
- data/projects/manifest/src/foobara/manifest/processor.rb +11 -0
- data/projects/manifest/src/foobara/manifest/processor_class.rb +11 -0
- data/projects/manifest/src/foobara/manifest/root_manifest.rb +112 -0
- data/projects/manifest/src/foobara/manifest/type.rb +86 -0
- data/projects/manifest/src/foobara/manifest/type_declaration.rb +117 -0
- data/projects/model/lib/foobara/model.rb +23 -0
- data/projects/model/src/concerns/reflection.rb +22 -0
- data/projects/model/src/concerns/types.rb +104 -0
- data/projects/model/src/extensions/builtin_types/model/casters/hash.rb +23 -0
- data/projects/model/src/extensions/builtin_types/model/transformers/mutable.rb +26 -0
- data/projects/model/src/extensions/builtin_types/model/validators/attributes_declaration.rb +33 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/attributes_handler_desugarizer.rb +24 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb +32 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/model_class_desugarizer.rb +119 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/to_type_transformer.rb +57 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration.rb +21 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/hash_desugarizer.rb +37 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/model_class_type_desugarizer.rb +25 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/mutable_validator.rb +46 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/normalize_mutable_attributes_desugarizer.rb +28 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/to_type_transformer.rb +27 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration.rb +31 -0
- data/projects/model/src/extensions/type_declarations/handlers/registered_type_declaration/model_class_desugarizer.rb +23 -0
- data/projects/model/src/model.rb +320 -0
- data/projects/monorepo/lib/foobara/monorepo/project.rb +52 -0
- data/projects/monorepo/lib/foobara/monorepo.rb +63 -0
- data/projects/namespace/lib/foobara/namespace.rb +4 -0
- data/projects/namespace/src/ambiguous_registry.rb +104 -0
- data/projects/namespace/src/base_registry.rb +66 -0
- data/projects/namespace/src/extensions/module.rb +5 -0
- data/projects/namespace/src/is_namespace.rb +352 -0
- data/projects/namespace/src/namespace/lookup_mode.rb +41 -0
- data/projects/namespace/src/namespace.rb +61 -0
- data/projects/namespace/src/namespace_helpers.rb +273 -0
- data/projects/namespace/src/prefixless_registry.rb +54 -0
- data/projects/namespace/src/scoped.rb +113 -0
- data/projects/namespace/src/unambiguous_registry.rb +65 -0
- data/projects/persistence/lib/foobara/persistence.rb +22 -0
- data/projects/persistence/src/entity_attributes_crud_driver.rb +241 -0
- data/projects/persistence/src/entity_base/table.rb +14 -0
- data/projects/persistence/src/entity_base/transaction/concerns/entity_callback_handling.rb +157 -0
- data/projects/persistence/src/entity_base/transaction/concerns/state_transitions.rb +83 -0
- data/projects/persistence/src/entity_base/transaction/concerns/transaction_tracking.rb +53 -0
- data/projects/persistence/src/entity_base/transaction/state_machine.rb +27 -0
- data/projects/persistence/src/entity_base/transaction.rb +163 -0
- data/projects/persistence/src/entity_base/transaction_table/concerns/queries.rb +42 -0
- data/projects/persistence/src/entity_base/transaction_table/concerns/record_tracking.rb +134 -0
- data/projects/persistence/src/entity_base/transaction_table.rb +620 -0
- data/projects/persistence/src/entity_base.rb +114 -0
- data/projects/persistence/src/persistence.rb +172 -0
- data/projects/state_machine/lib/foobara/state_machine.rb +1 -0
- data/projects/state_machine/src/callbacks.rb +158 -0
- data/projects/state_machine/src/log_entry.rb +13 -0
- data/projects/state_machine/src/state_machine.rb +91 -0
- data/projects/state_machine/src/sugar.rb +125 -0
- data/projects/state_machine/src/transition_log.rb +19 -0
- data/projects/state_machine/src/validations.rb +69 -0
- data/projects/thread_parent/lib/foobara/thread_parent.rb +1 -0
- data/projects/thread_parent/src/thread_parent.rb +38 -0
- data/projects/type_declarations/lib/foobara/type_declarations.rb +131 -0
- data/projects/type_declarations/src/attributes.rb +34 -0
- data/projects/type_declarations/src/caster.rb +7 -0
- data/projects/type_declarations/src/desugarizer.rb +25 -0
- data/projects/type_declarations/src/dsl/attributes.rb +199 -0
- data/projects/type_declarations/src/element_processor.rb +7 -0
- data/projects/type_declarations/src/error_extension.rb +73 -0
- data/projects/type_declarations/src/handlers/extend_array_type_declaration/array_desugarizer.rb +31 -0
- data/projects/type_declarations/src/handlers/extend_array_type_declaration/element_type_declaration_desugarizer.rb +37 -0
- data/projects/type_declarations/src/handlers/extend_array_type_declaration/to_type_transformer.rb +22 -0
- data/projects/type_declarations/src/handlers/extend_array_type_declaration/type_set_to_array_desugarizer.rb +36 -0
- data/projects/type_declarations/src/handlers/extend_array_type_declaration.rb +14 -0
- data/projects/type_declarations/src/handlers/extend_associative_array_type_declaration/to_type_transformer.rb +28 -0
- data/projects/type_declarations/src/handlers/extend_associative_array_type_declaration.rb +20 -0
- data/projects/type_declarations/src/handlers/extend_attributes_type_declaration/dsl_desugarizer.rb +25 -0
- data/projects/type_declarations/src/handlers/extend_attributes_type_declaration/element_type_declarations_desugarizer.rb +34 -0
- data/projects/type_declarations/src/handlers/extend_attributes_type_declaration/hash_desugarizer.rb +60 -0
- data/projects/type_declarations/src/handlers/extend_attributes_type_declaration/to_type_transformer.rb +21 -0
- data/projects/type_declarations/src/handlers/extend_attributes_type_declaration.rb +16 -0
- data/projects/type_declarations/src/handlers/extend_registered_type_declaration/to_type_transformer.rb +75 -0
- data/projects/type_declarations/src/handlers/extend_registered_type_declaration.rb +23 -0
- data/projects/type_declarations/src/handlers/extend_tuple_type_declaration/array_desugarizer.rb +30 -0
- data/projects/type_declarations/src/handlers/extend_tuple_type_declaration/to_type_transformer.rb +24 -0
- data/projects/type_declarations/src/handlers/extend_tuple_type_declaration.rb +13 -0
- data/projects/type_declarations/src/handlers/registered_type_declaration/desugarizer_metadata_cleanup_desugarizer.rb +29 -0
- data/projects/type_declarations/src/handlers/registered_type_declaration/short_type_name_desugarizer.rb +65 -0
- data/projects/type_declarations/src/handlers/registered_type_declaration/strict_desugarizer.rb +32 -0
- data/projects/type_declarations/src/handlers/registered_type_declaration/strict_stringified_desugarizer.rb +39 -0
- data/projects/type_declarations/src/handlers/registered_type_declaration/symbol_desugarizer.rb +26 -0
- data/projects/type_declarations/src/handlers/registered_type_declaration/to_type_transformer.rb +28 -0
- data/projects/type_declarations/src/handlers/registered_type_declaration/type_desugarizer.rb +24 -0
- data/projects/type_declarations/src/handlers/registered_type_declaration.rb +26 -0
- data/projects/type_declarations/src/processor.rb +7 -0
- data/projects/type_declarations/src/to_type_transformer.rb +11 -0
- data/projects/type_declarations/src/transformer.rb +7 -0
- data/projects/type_declarations/src/type_builder.rb +112 -0
- data/projects/type_declarations/src/type_declaration_error.rb +9 -0
- data/projects/type_declarations/src/type_declaration_handler.rb +120 -0
- data/projects/type_declarations/src/type_declaration_handler_registry.rb +27 -0
- data/projects/type_declarations/src/type_declaration_validator.rb +19 -0
- data/projects/type_declarations/src/type_declarations.rb +128 -0
- data/projects/type_declarations/src/typed_transformer.rb +89 -0
- data/projects/type_declarations/src/validator.rb +7 -0
- data/projects/type_declarations/src/with_registries.rb +41 -0
- data/projects/types/lib/foobara/types.rb +11 -0
- data/projects/types/src/element_processor.rb +7 -0
- data/projects/types/src/extensions/error.rb +32 -0
- data/projects/types/src/type/concerns/reflection.rb +79 -0
- data/projects/types/src/type/concerns/supported_processor_registration.rb +56 -0
- data/projects/types/src/type.rb +375 -0
- data/projects/types/src/types.rb +4 -0
- data/projects/value/lib/foobara/value.rb +7 -0
- data/projects/value/src/caster.rb +84 -0
- data/projects/value/src/data_error.rb +27 -0
- data/projects/value/src/processor/casting.rb +123 -0
- data/projects/value/src/processor/multi.rb +63 -0
- data/projects/value/src/processor/pipeline.rb +27 -0
- data/projects/value/src/processor/runner.rb +38 -0
- data/projects/value/src/processor/selection.rb +90 -0
- data/projects/value/src/processor.rb +358 -0
- data/projects/value/src/transformer.rb +84 -0
- data/projects/value/src/validator.rb +53 -0
- data/projects/version/lib/foobara/version.rb +4 -0
- data/projects/version/src/version.rb +5 -0
- data/projects/weak_object_set/lib/foobara/weak_object_set.rb +3 -0
- data/projects/weak_object_set/src/weak_object_set.rb +163 -0
- metadata +445 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 60f90ff595c7b792b48db28577cd347d04b3419f1e8d26a58ee4f3e7b5210b69
|
4
|
+
data.tar.gz: 55a434b5f26b54d7366a985d9a693ce6bb651702db35a16730fb555e60ec8b4e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5968d4a44041c738a939e26a515659291685eb4329b93d88dadcaf75c39c8a467aaf2e83e3752f0e6b75e47b0c8fbbf865ed3366bf8894b1758eb63b2aec9d3e
|
7
|
+
data.tar.gz: bbb716a12e804ed7243d874c9fb8d216976f8be51a0e6b46fc66031e81cd8901e5aa9ac08baf7ca355c6ddce0088e75e1bbde28b3fca2afb507dbb8635a066ed
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 3.2
|
3
|
+
NewCops: enable
|
4
|
+
|
5
|
+
inherit_gem:
|
6
|
+
foobara-rubocop-rules:
|
7
|
+
- rules/*
|
8
|
+
|
9
|
+
Naming/FileName:
|
10
|
+
ExpectMatchingDefinition: true
|
11
|
+
CheckDefinitionPathHierarchy: true
|
12
|
+
Exclude:
|
13
|
+
- spec/lib/**/*
|
14
|
+
- spec/**/*
|
15
|
+
- bin/*
|
16
|
+
CheckDefinitionPathHierarchyRoots:
|
17
|
+
- src
|
18
|
+
- extensions
|
19
|
+
- spec
|
20
|
+
IgnoreExecutableScripts: true
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.2.2
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
## [0.0.1] - 2024-05-31
|
2
|
+
|
3
|
+
Very very alpha alpha release for convenience of demoing the project.
|
4
|
+
|
5
|
+
- Temporarily released under a restrictive license (AGPL-3.0) to unblock demoing while
|
6
|
+
a permissive license is officially decided on.
|
7
|
+
|
8
|
+
## [0.0.0] - 2023-06-14
|
9
|
+
|
10
|
+
- Project birth
|
data/DECISION_LOG.md
ADDED
@@ -0,0 +1,220 @@
|
|
1
|
+
This document is intended to document the rationale behind certain key decisions
|
2
|
+
|
3
|
+
<!-- TOC -->
|
4
|
+
* [2024-05-30 Dual-license under Apache-2.0 OR MIT](#2024-05-30-dual-license-under-apache-20-or-mit)
|
5
|
+
* [Decision](#decision)
|
6
|
+
* [Rationale](#rationale)
|
7
|
+
* [Why MIT](#why-mit)
|
8
|
+
* [Why Apache-2.0](#why-apache-20)
|
9
|
+
* [Why Apache-2.0 OR MIT](#why-apache-20-or-mit)
|
10
|
+
* [Other licenses that were contenders](#other-licenses-that-were-contenders)
|
11
|
+
* [Other concern about the murky state of generative AI and copyright implications](#other-concern-about-the-murky-state-of-generative-ai-and-copyright-implications)
|
12
|
+
* [[RETRACTED] 2024-05-19 License under user choice of 3 licenses](#retracted-2024-05-19-license-under-user-choice-of-3-licenses)
|
13
|
+
* [Decision](#decision-1)
|
14
|
+
* [Rationale](#rationale-1)
|
15
|
+
* [Why MIT OR Apache 2.0](#why-mit-or-apache-20)
|
16
|
+
* [Why MIT is attractive](#why-mit-is-attractive)
|
17
|
+
* [Why Apache 2.0 is attractive](#why-apache-20-is-attractive)
|
18
|
+
* [Why MIT OR Apache 2.0 is attractive](#why-mit-or-apache-20-is-attractive)
|
19
|
+
* [Why OR MPL 2.0](#why-or-mpl-20)
|
20
|
+
* [why MPL 2.0 is attractive](#why-mpl-20-is-attractive)
|
21
|
+
* [Why OR MPL 2.0, ie, why is MPL 2.0 scary](#why-or-mpl-20-ie-why-is-mpl-20-scary)
|
22
|
+
* [What would have been an ideal license?](#what-would-have-been-an-ideal-license)
|
23
|
+
* [Conclusion](#conclusion)
|
24
|
+
<!-- TOC -->
|
25
|
+
|
26
|
+
# 2024-05-31 Temporarily release under AGPLv3
|
27
|
+
|
28
|
+
## Decision
|
29
|
+
|
30
|
+
Adopting a very restrictive license temporarily
|
31
|
+
|
32
|
+
## Rationale
|
33
|
+
|
34
|
+
Unblocks demos that benefit from use of rubygems while buying time to officially finalize a licensing decision.
|
35
|
+
|
36
|
+
# [TENTATIVE] 2024-05-30 Dual-license under Apache-2.0 OR MIT
|
37
|
+
|
38
|
+
## Decision
|
39
|
+
|
40
|
+
Release gems in the foobara org under Apache-2.0 OR MIT.
|
41
|
+
|
42
|
+
## Rationale
|
43
|
+
|
44
|
+
### Why MIT
|
45
|
+
|
46
|
+
* Typical license of the Ruby ecosystem
|
47
|
+
* High-compatibility with other software licenses.
|
48
|
+
|
49
|
+
### Why Apache-2.0
|
50
|
+
|
51
|
+
* Robust
|
52
|
+
* Includes patent grants
|
53
|
+
|
54
|
+
### Why Apache-2.0 OR MIT
|
55
|
+
|
56
|
+
* Maximizes contexts in which Foobara can unambiguously be used without
|
57
|
+
much overhead or confusion.
|
58
|
+
* Reduces needs to debate less typical licensing options with users
|
59
|
+
or contributors.
|
60
|
+
* Reduces need to relicense later for adoption's sake.
|
61
|
+
* Just Apache-2.0 results in incompatibility with GPLv2
|
62
|
+
* Just MIT does not explicitly extend patent grants.
|
63
|
+
|
64
|
+
A thought... By choosing this combination instead of MPL-2.0, then it's not
|
65
|
+
possible to use Foobara in a GPLv2 app without receiving a patent grant from the
|
66
|
+
MIT license. However, my understanding is that such a user does at least know that
|
67
|
+
all contributors have granted any patents in their contributed code to the Foobara
|
68
|
+
project itself by meeting the requirements of both licenses in order to contribute.
|
69
|
+
|
70
|
+
### Other licenses that were contenders
|
71
|
+
|
72
|
+
* MPL-2.0
|
73
|
+
* Pros:
|
74
|
+
* Robust
|
75
|
+
* Compatible with GPLv2 and includes patent grants, eliminating the need to dual-license
|
76
|
+
* Cons:
|
77
|
+
* Not typical in the Ruby ecosystem and would result in conversations among contributors and users.
|
78
|
+
* Could also potentially impact adoption negatively though I don't think it logically should.
|
79
|
+
* Neutral:
|
80
|
+
* The copyleft aspects of MPL-2.0 seem fair while still being quite permissive. However, likely irrelevant because:
|
81
|
+
* These types of projects are typically used as unmodified libraries distributed by rubygems.
|
82
|
+
* When there is a modification, there's not much incentive not to share those improvements. It is
|
83
|
+
a hassle to manage a private fork and easier to just upstream improvements to avoid
|
84
|
+
that hassle.
|
85
|
+
* Even in the case of a private fork, typically the code winds up being used in some network service
|
86
|
+
and not "distributed" and so the copyleft is irrelevant in these common usage patterns
|
87
|
+
* File-level aspect.
|
88
|
+
* Receiving a copy of the modified code is generally the normal usage pattern since it's
|
89
|
+
an interpreted language. There are some tools for encoding but usually Ruby is interpreted from the source,
|
90
|
+
however, the typical pattern is to receive the code.
|
91
|
+
* Also means static-linking stuff is not relevant
|
92
|
+
* Ruby is so easy to monkey patch. It is very easy to modify a Ruby program without modifying a specific file.
|
93
|
+
Potentially undesirable to go down that path. Not sure. But, regardless, there are many ways to add
|
94
|
+
important code to a code base without disturbing certain files or at least minimally disturb them.
|
95
|
+
And, so, major improvements to code under the MPL can be made without technically triggering the copyleft
|
96
|
+
by leaving the old code in place and hooking new code into it.
|
97
|
+
* Makes it clear what license contributions are under (if using license headers in files.) This is because
|
98
|
+
1) modifications to existing files are MPL-2.0 via terms of the license, regardless of contributor intent.
|
99
|
+
2) new files can be force via the build to have license headers and therefore would express intent
|
100
|
+
by the contributor to license the code as MPL-2.0.
|
101
|
+
|
102
|
+
* Why irrelevant? Because github inbound=outbound convention means if the project is under X license
|
103
|
+
then a contribution is under X license by default.
|
104
|
+
* OSL-3.0
|
105
|
+
* Pros
|
106
|
+
* This was the license I liked best of all the licenses I read. It felt quite fair and robust.
|
107
|
+
* Cons
|
108
|
+
* incompatible with not only GPLv2 but all GPL. So it's really dead-on-arrival.
|
109
|
+
* Is not popular and hasn't been defended in court.
|
110
|
+
* EUPL and CDDL
|
111
|
+
* Based on MPL-1.1 and not compatible with GPLv2
|
112
|
+
* LGPL
|
113
|
+
* Not very concise especially for an interpreted language.
|
114
|
+
* I'm worried about users incorrectly lumping it in with strong copyleft.
|
115
|
+
* I find it interesting that GNU recommends that you don't use LGPL.
|
116
|
+
* I think the philosophical/political views of the license authors on OSS are not really necessary
|
117
|
+
and I'm hesitant to make it seem like it's a position communicated by a community.
|
118
|
+
|
119
|
+
### Other concern about the murky state of generative AI and copyright implications
|
120
|
+
|
121
|
+
I would like similar code generated from AI trained on code from this project, or prompted with code
|
122
|
+
from this project, to be considered a derived work.
|
123
|
+
|
124
|
+
It doesn't seem like any of the existing popular licenses influence whether or not an AI-generated work
|
125
|
+
is considered derived or not.
|
126
|
+
|
127
|
+
# [RETRACTED] 2024-05-19 License under user choice of 3 licenses
|
128
|
+
|
129
|
+
## Decision
|
130
|
+
|
131
|
+
RETRACTED: kept in the history but should relocate these thoughts to some other resource.
|
132
|
+
|
133
|
+
Release foobara gem (this repository) under the user's preference of
|
134
|
+
3 different licenses: `MIT OR Apache 2.0 OR MPL 2.0` and come up with a shorter alias for this license.
|
135
|
+
|
136
|
+
## Rationale
|
137
|
+
|
138
|
+
### Why MIT OR Apache 2.0
|
139
|
+
|
140
|
+
#### Why MIT is attractive
|
141
|
+
|
142
|
+
MIT is attractive, aside from the obvious (permissible, simple), because this license
|
143
|
+
is the typical license used in the Ruby community. Adoption would be as known-to-be-simple as possible under
|
144
|
+
this license in this ecosystem.
|
145
|
+
|
146
|
+
#### Why Apache 2.0 is attractive
|
147
|
+
|
148
|
+
Apache 2.0 is attractive due to its robustness and extending patent permissions to users.
|
149
|
+
|
150
|
+
#### Why MIT OR Apache 2.0 is attractive
|
151
|
+
|
152
|
+
Dual-licensing under both allows the end-user to operate under either as-needed.
|
153
|
+
|
154
|
+
The Rust community dual licenses under these two suggesting that a community can function under such
|
155
|
+
a licensing scheme.
|
156
|
+
|
157
|
+
Also, Bootstrap, in 2012, relicensed from Apache 2.0 to MIT so that GPLv2 projects could use Bootstrap.
|
158
|
+
Dual licensing would have also been a solution but the point here is future-proofing unexpected pressure to
|
159
|
+
relicense for adoption-sake.
|
160
|
+
|
161
|
+
### Why OR MPL 2.0
|
162
|
+
|
163
|
+
#### why MPL 2.0 is attractive
|
164
|
+
|
165
|
+
MPL 2.0 seems to me (I am not an expert on this and far from it) after some research to be a robust license
|
166
|
+
that seems to give nearly as much encouragement to give contributors back improvements to their
|
167
|
+
original efforts without sacrificing much, if any, practical permissiveness.
|
168
|
+
|
169
|
+
#### Why OR MPL 2.0, ie, why is MPL 2.0 scary
|
170
|
+
|
171
|
+
It seems like there would be no serious practical burden imposed on users by the MPL 2.0 license. But I'm not
|
172
|
+
100% certain of that without expert confirmation. And so, if users are also uncertain, that might hurt adoption
|
173
|
+
even if in actuality the license is not a hassle to users in any meaningful way.
|
174
|
+
|
175
|
+
What I mean by this is: if I have an MIT-licensed project, or a proprietary project, and I add a MPL-2.0 only gem
|
176
|
+
to my .gemspec, is there any administrative burden imposed? It seems like "no" but again I am not an expert.
|
177
|
+
If the answer is "no" but unclear to the user, that might still hurt adoption. To that extent, if confused with GPL
|
178
|
+
style licenses, it might be ruled out by some organizations even if incorrectly so.
|
179
|
+
|
180
|
+
However, making it OR MIT OR Apache 2.0 allows the user to just operate as if the project were licensed in
|
181
|
+
the way most convenient to the user among those options, making adoption, I assume, at least as easy as MIT alone.
|
182
|
+
|
183
|
+
But the real suspected benefit is this seems like it would allow MPL 2.0 to be the preferred license in the future
|
184
|
+
without needing to seek relicense permission from contributors, nor CLAs to avoid seeking relicense permission.
|
185
|
+
It is, in essence, a solution to punt and get back to coding for now and revisit with more real-world information
|
186
|
+
later.
|
187
|
+
|
188
|
+
### What would have been an ideal license?
|
189
|
+
|
190
|
+
Hard to say without being an expert on licenses and user behavior but, at this time, my best (admittedly uninformed)
|
191
|
+
guess would be to ideally use only one license, similar to MPL 2.0, but:
|
192
|
+
|
193
|
+
1) without the file-level/static stuff as it is likely irrelevant for a gem like Foobara.
|
194
|
+
2) with a network-exposure-is-distribution clause like AGPL 3.0, or really anything to maximize an
|
195
|
+
"if you improve it and make use of those improvements, then share the improvements" vibe, which,
|
196
|
+
with github and forks, seems like a trivial requirement to satisfy.
|
197
|
+
3) if possible, a clause stating that code generated from Foobara code as
|
198
|
+
training data or prompt data to an AI system constitutes a derived work.
|
199
|
+
|
200
|
+
Without expertise and given the point in history where I'm making this decision, I can't really draft
|
201
|
+
such a license and even if I could that seems like it could be a bad strategy regardless (aka license proliferation)
|
202
|
+
|
203
|
+
NOTE: if you happen to know an easy way for me to access expertise for clarity on these issues, please let me know.
|
204
|
+
I'd be happy to pay for a short consult with a professional (ie lawyer who specializes in open-source licensing.)
|
205
|
+
|
206
|
+
## Conclusion
|
207
|
+
|
208
|
+
License under MIT OR Apache 2.0 OR MPL 2.0 for now to:
|
209
|
+
|
210
|
+
1) guarantee seamless fit into Ruby ecosystem (MIT)
|
211
|
+
2) extend patent-granting in case somebody wants that (Apache 2.0/MPL 2.0)
|
212
|
+
3) allow future relicensing under MPL 2.0 without CLAs or non-trivial-contributor-roundup if it turns out that MPL 2.0
|
213
|
+
would have been a good choice once more is understood about the adoption-impact of having chosen that license.
|
214
|
+
4) stop thinking about licensing and get back to hackin'
|
215
|
+
|
216
|
+
To be clear, we are punting for now. At some point, we should choose either:
|
217
|
+
|
218
|
+
1) MPL 2.0
|
219
|
+
2) MIT OR Apache 2.0 (works for Rust community... seems there's no need to decide between these two)
|
220
|
+
3) Some other better-fitting license (would require permission from non-trivial contributors)
|
data/Guardfile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
guard :rspec, all_after_pass: true, all_on_start: true, cmd: "bundle exec rspec", failed_mode: :focus do
|
2
|
+
watch(%r{^spec/(.+)_spec\.rb$})
|
3
|
+
watch(%r{^src/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
4
|
+
watch(%r{^src/foobara/command/concerns/(.+)\.rb$}) { |_m| "spec/foobara/command_spec.rb" }
|
5
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
6
|
+
watch(%r{^spec/spec_helper.rb$}) { "spec/" }
|
7
|
+
watch(%r{^src/commands.rb$/}) { "spec/" }
|
8
|
+
watch(%r{^projects/([^/]+)/src/(.+)\.rb$}) { |m| "spec/foobara/#{m[1]}/#{m[2]}_spec.rb" }
|
9
|
+
end
|