Skip to content

Conversation

@afuno
Copy link
Member

@afuno afuno commented Jan 4, 2026

No description provided.

afuno added 3 commits January 4, 2026 17:55
- Migrated the service generator templates to a cleaner, modular format using embedded Ruby templates.
- Added support for namespace customization and comment skipping during generation for better flexibility.
- Improved localization management by introducing English and Russian locale YAML templates in the install generator.
- Removed deprecated files and unused components to enhance maintainability and reduce clutter.
- Refactored service generator templates to streamline the output and logic.
- Removed `--internal`, `--output`, and `--skip-make` options as they are now obsolete.
- Simplified declarations in services and changed default names for clarity.
- Updated `USAGE` and README documentation to reflect the new structure and options.
- Adjusted specs for generators to align with simplified outputs.
- Enhanced RSpec service generator with `.info` API support to automatically generate input examples.
- Replaced explicit hash key-value pairs with shorthand syntax for cleaner attribute assignments in `base` and `rspec_generator`.
- Suppressed RuboCop `Metrics` offenses by adding inline comments for method lengths and complexity.
- Improved readability and maintainability of the example value generation logic.
@afuno afuno added this to the v.2.17.0 milestone Jan 4, 2026
@afuno afuno self-assigned this Jan 4, 2026
@afuno afuno added the feature label Jan 4, 2026
afuno added 13 commits January 4, 2026 22:27
- Renamed `--skip-comments` to `--minimal` for better descriptive accuracy and updated all related templates, specs, and documentation accordingly.
- Changed default output name from `result` to `data` in service generator templates for consistency and clarity.
- Enhanced RSpec integration by introducing validation for `internals` and `outputs` in addition to `inputs`.
- Updated README and usage examples to reflect the latest changes in generator options and behavior.
- Refactored internal methods for service generators to improve readability and maintainability.
- Added an inline comment to disable the `Metrics/ClassLength` RuboCop warning for the `RspecGenerator` class.
- No functional changes introduced; this only addresses the linter violation.
- Updated `Base` to inherit from `Servactory::Base` and support `success_class` configuration.
- Added `Success` exception class to improve alignment with Servactory's exception structure.
- Enhanced template comments to better illustrate customization options.
- Modified specs to validate the new `Base` configuration and `Success` exception class.
- Commented out: `fail_on! ActiveRecord::RecordInvalid`, `hash_mode_class_names`, `i18n_root_key`, and other unused options.
- Simplified the `Base` template by removing unnecessary comments in advanced configuration sections.
- No functional changes introduced; this primarily enhances clarity and reduces noise in the template.
- Introduced a `--path` option for `install`, `service`, and `rspec` generators to specify a custom directory for generated files.
- Updated templates and methods to use the `--path` option, ensuring flexibility in output file locations.
- Enhanced documentation and usage examples to reflect the new `--path` option.
- Added comprehensive tests to cover path customization for both service and spec file generation.
- Added a `base_path` helper method to simplify and centralize path handling in the `install_generator`.
- Reordered `class_option` declarations for improved readability across `install`, `service`, and `rspec` generators.
- Refactored `service_path` to delegate path resolution to `base_path`, ensuring consistent logic for file generation.
- Updated accompanying `rbs` files to reflect the addition of `base_path`.
- Reorganized `class_option` declarations and method definitions in `service` and `RSpecGenerator` classes for better readability.
- Adjusted method positions for `services_path` and `call_method` to maintain logical consistency.
- Updated corresponding `.rbs` type signature files to reflect the adjusted structure.
- No functional changes introduced; purely structural improvements.
- Simplified `before` and `after` blocks in `generator_helpers.rb` by replacing `do...end` with single-line `{}` syntax.
- No functional changes made; improves readability and reduces code verbosity.
- Reorganized test blocks in `install_generator_spec.rb`, `service_generator_spec.rb`, and `rspec_generator_spec.rb` to replace `describe` with nested `context` blocks for better clarity and modularity.
- Consolidated tests for `--namespace`, `--path`, and combined options to reduce redundancy and improve maintainability.
- Added missing test scenarios for `--locales`, `--minimal`, `--skip-output`, and `--call-method` to ensure full coverage of generator options.
- Removed duplicate test cases and ensured all existing ones validate critical functionality effectively.
- Refactored `install_generator` to extract `locales` into a dedicated method for robust locale parsing of strings and arrays.
- Updated Rails generator test helpers to ensure compatibility with both Rails 7 and 8.
- Added missing `railties` gems for Rails versions 5.1 through 8.1 in Appraisals and gemfiles for generator dependency consistency.
- Improved type definitions with a new `locales` method signature in `.rbs` files.
- Enhanced generator testing framework by centralizing behavior logic for assertion methods and class testing definitions.
- Extracted `locales` logic to a dedicated method for better maintainability and robust parsing of single strings and arrays.
- Removed duplicate method definitions to streamline code in `install_generator.rb`.
- Added and updated type signatures in `.rbs` files to reflect the extracted methods (`locales`, `minimal?`, and `base_path`).
- Reordered private methods for logical grouping and consistency.
- Reordered private methods alphabetically in `install_generator.rb` to improve readability and maintain consistent structure.
- Removed redundant definitions of `namespace`, `namespace_path`, and `service_path` methods.
- Updated `.rbs` file to match the restructured private method ordering and type signatures.
- No functional changes; purely structural improvements.
- Moved `require "rails/generators"` inside the `begin...end` block to handle conditional loading based on Rails version compatibility.
- Removed unnecessary `begin` wrapping other `require` statements for improved readability.
- Ensures safe usage and compatibility with Rails 7 and 8.
@afuno afuno changed the title Refactor service generators Introduce comprehensive Rails generators for services Jan 4, 2026
afuno added 8 commits January 5, 2026 04:19
- Deleted unused locale templates (`servactory.en.yml` and `servactory.ru.yml`) for cleaner project structure and to simplify maintenance.
- Updated `install_generator` to dynamically locate locale files using `gem_locales_path`, improving flexibility and ensuring missing locale files are reported with warnings.
- Reorganized methods in `service_generator` and `rspec_generator` for consistent structure and better readability.
- Refactored boolean type mapping in `Base` to include both `TrueClass` and `FalseClass`, fixing an accuracy issue.
- Made minor updates to templates and type signature files to align with structural changes.
- Rephrased the comment in `generator_helpers.rb` for the `tests` method to improve clarity and better describe its purpose.
- No functional changes; purely a documentation improvement.
- Renamed `attributes` to `inputs` in `ServiceGenerator` for consistency in naming convention.
- Enhanced input parsing to normalize lowercase types (e.g., `string` → `String`) and preserve custom types.
- Improved `USAGE` documentation to clarify input type handling, including examples of normalization and custom types.
- Added `rails_5.1`, `rails_7.2`, and `rails_8.1` gemfiles for Appraisals to ensure compatibility across Rails versions.
- Updated test coverage for generator functionality to verify normalized and custom input handling behavior.
- Adjusted `RspecGenerator` to inherit from `Servactory::Generators::NamedBase` for consistency.
- Replaced legacy methods for inputs, internals, and outputs with `inputs_with_examples` for cleaner and more concise logic.
- Enhanced type mapping to generate accurate example values and type assertions in RSpec tests.
- Adjusted templates to align with updated attribute handling logic and improved validation examples.
- Improved path conversions for custom paths in app/lib directories, ensuring correct spec generation directories.
- Updated Rails 7 gemfile for compatibility, added dependency details, and ensured correct bundler configuration.
- Deleted lock files for Rails 5.1, 7.0, 7.2, and 8.1 to simplify dependency management and testing configuration.
- Ensured updated Appraisal structure will handle Rails version compatibility without requiring specific lock files.
- Streamlined test setup and eliminated redundancy in gem dependency definitions.
- Clarified input handling for service generator with examples (e.g., `email:string name:String user:User`).
- Updated RSpec generator documentation to specify input arguments and explain spec path derivation.
- Improved explanations for `--path` and `--call-method` options in both generator descriptions.
- Ensured consistency and readability in usage instructions.
- Combined handling of `TrueClass` and `FalseClass` under a single case for `[TrueClass, FalseClass]` to simplify logic.
- Removed redundant case for `[TrueClass, FalseClass]` for better clarity and maintainability.
afuno added 6 commits January 5, 2026 18:08
- Added `/gemfiles/*.gemfile.lock` to `.gitignore` to exclude gemfile lock files.
- Helps streamline Appraisal-based Rails dependency management and testing configuration by preventing lock file conflicts.
- Introduced `bin/rails` script to streamline running `bundle exec` commands with version-specific Gemfiles.
- Supports specifying Rails version via `-v` or `--version` flags, with a default version set to `8.1`.
- Provides usage examples and lists available Rails versions for better usability.
- Ensures error handling for missing Gemfiles, improving user feedback and clarity.
- Added namespace validation in `InstallGenerator`, ensuring proper Ruby constant naming (e.g., `MyApp::Services`).
- Introduced input name validation for `ServiceGenerator` to enforce valid variable naming conventions (e.g., lowercase or snake_case).
- Extended type mappings to include `nil` (normalized to `NilClass`) and `decimal` (normalized to `BigDecimal`).
- Updated RSpec tests to cover new validations and extended type mappings for both generators.
- Enhanced path conversion in `RSpecGenerator` to handle Rails engine-specific paths accurately (e.g., `engines/core/app` to `engines/core/spec`).
- Reorganized shared examples for DRY specs with syntax validation tests for generated files.
- Moved the shared example "generates valid Ruby syntax" to `spec/support/shared_examples` for improved organization.
- Updated generator specs to reflect the new shared examples location by removing redundant `require_relative` imports.
- Simplified path handling logic in `RspecGenerator` using conditional assignment for Rails engine-specific paths.
- Improved formatting for long `expect` statements in generator specs for better readability.
- Expanded `ServiceGenerator` to normalize collection types (Array, Hash), temporal types (Date, Time, DateTime), and `symbol` inputs.
- Modified RSpec templates to reflect normalized types and generate accurate type assertions with example values (e.g., `Date.current`, `Array`, `Hash`).
- Removed redundant test cases for `nil` and `BigDecimal` type mappings to avoid duplication.
- Improved spec organization by grouping related contexts (e.g., inputs, generator options, type mappings) for better readability and maintainability.
- Added `railties ~> 8.1.0` to Gemfile for testing Rails generators locally with the latest version.
- Updated `Gemfile.lock` with Rails 8.1 dependencies, including new gems like `actionpack`, `actionview`, and `railties`.
- Simplified `GeneratorHelpers` by removing fallback logic for older Rails versions and consolidating assertions using RSpec expectations.
- Improved test structure in `spec/support/generator_helpers.rb` by organizing module methods and hooks (`before`, `after`) for
@afuno afuno marked this pull request as ready for review January 5, 2026 14:24
@afuno afuno merged commit db5a036 into main Jan 5, 2026
37 checks passed
@afuno afuno deleted the feature/SRV-379/generators branch January 5, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants