Skip to content

feat(template-runner): add Rails template post-action support#7

Merged
dpaluy merged 1 commit intomasterfrom
feature/custom-cmds
Nov 23, 2025
Merged

feat(template-runner): add Rails template post-action support#7
dpaluy merged 1 commit intomasterfrom
feature/custom-cmds

Conversation

@dpaluy
Copy link
Copy Markdown
Owner

@dpaluy dpaluy commented Nov 23, 2025

Summary

  • Introduces new type: template post-action for executing full Rails application templates (including RailsBytes scripts)
  • Adds TemplateRunner class wrapping Rails' AppGenerator with proper context injection and error handling
  • Templates receive automatic @app_name and @answers instance variables with support for custom variables via config
  • Includes TemplateError exception type for proper error wrapping and reporting
  • Version bumped to 0.4.0 with comprehensive test coverage (39 test runs, 111 assertions)

Changes Included

  • New file: lib/railstart/template_runner.rb (77 lines with YARD documentation)
  • New test file: test/template_runner_test.rb (comprehensive coverage with mocks)
  • New test file: test/cli_test.rb (CLI command tests)
  • Enhanced lib/railstart/generator.rb with template execution flow and context handling
  • Enhanced lib/railstart/config.rb with template action validation
  • Updated lib/railstart/errors.rb with TemplateError exception class
  • Updated lib/railstart/cli.rb with template command support
  • Updated CHANGELOG.md and README.md with template documentation

Test plan

  • Linting passes (bundle exec rubocop -A) - no offenses detected
  • All existing tests pass (39 runs, 111 assertions)
  • New TemplateRunner class tests cover:
    • Variable injection into template context
    • Destination root configuration
    • Error handling for missing source
    • Error wrapping for template execution failures
  • Config validation for template post-actions verified
  • Manual testing of template execution with variables

Add a new post-action type for executing full Rails application templates
(including RailsBytes scripts) within generated applications. Introduces
TemplateRunner class wrapping Rails' AppGenerator with proper context
injection, error handling, and comprehensive test coverage.

- New TemplateRunner class with template execution and variable injection
- Template post-actions with source path and optional variables support
- Built-in @app_name and @answers variables for all templates
- TemplateError exception type for proper error wrapping
- Config validation for template action entries
- Refactored post-action processing for multi-type support
- Version bump: 0.3.0 → 0.4.0
- All tests passing with 39 runs, 111 assertions
@dpaluy dpaluy merged commit 9d1ae5c into master Nov 23, 2025
1 check passed
@dpaluy dpaluy deleted the feature/custom-cmds branch November 23, 2025 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant