···33argument-hint: <module-name>
44---
5566-Create a new boxcar module called `$ARGUMENTS.rb` in this Rails template project.
66+Create a new boxcar module called `$ARGUMENTS.rb` in the `modules/` folder.
7788## Context
99- This is a Rails application template project (used with `rails new myapp -m template.rb`)
1010-- Modules are Ruby files that get applied via `apply_template('$ARGUMENTS')` in `template.rb`
1010+- Modules live in `modules/` and are applied via `apply_module('$ARGUMENTS')` in `template.rb`
1111- Each module should be self-contained and handle one feature/concern
12121313## Module Structure
···2323 - `gem 'name'` - add gems
2424 - `generate :model, 'Name field:type'` - run generators
2525 - `file 'path', <<~RUBY ... RUBY` - create files
2626+ - `initializer 'name.rb', <<~RUBY ... RUBY` - create initializers
2627 - `inject_into_file`, `gsub_file` - modify files
2728 - `route` - add routes
2829 - `after_bundle do ... end` - run code after bundle install
29303031## Reference Files
3132Look at these existing modules for patterns:
3232-- @auth.rb - authentication module
3333-- @public_identifiable.rb - public IDs module
3434-- @tailwind.rb - Tailwind CSS module
3535-- @template.rb - main template entry point
3333+- @modules/auth.rb - authentication module
3434+- @modules/public_identifiable.rb - public IDs module
3535+- @modules/github.rb - simple GitHub workflow setup
3636+- @template.rb - main template entry point (orchestrator)
36373738## Task
38391. Ask what the module should do if not clear from the name
3939-2. Create the module file `$ARGUMENTS.rb`
4040-3. Show how to add it to `template.rb` using `apply_template('$ARGUMENTS')`
4040+2. Create the module file `modules/$ARGUMENTS.rb`
4141+3. Show how to add it to `template.rb` using `apply_module('$ARGUMENTS')`
aasm.rb
modules/aasm.rb
admin_routes.rb
modules/admin_routes.rb
+5
analytics.rb
modules/analytics.rb
···9090 include Trackable
9191RUBY
92929393+say ' Configuring ApplicationMailer for tracking...', :cyan
9494+inject_into_file 'app/mailers/application_mailer.rb', after: "class ApplicationMailer < ActionMailer::Base\n" do
9595+ " has_history\n utm_params\n"
9696+end
9797+9398say 'Ahoy analytics configured!', :green
9499say ' Track events: ahoy.track "Event Name", key: value', :cyan
95100say ' Email tracking enabled for opens and clicks', :cyan