Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [Unreleased]

- `core_setup` installs the `polymorphic-parent-resources` and `rake-tasks` skills (#222)
- `TaskTools` keeps rake arguments that contain an underscore. Only a bare `_` or a blank value falls back to the default (#222)
- Bring the `core_setup` and `ui_components` READMEs up to date (#222)

## [v2.7.0] Nov 4, 2026

- Generators may now use `install_skill(name)` to install a project level skill from RoleModel/skills (#208)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ Generators that leave behind conventions a coding agent needs to follow also ins
| `rolemodel:turbo:modals` | `turbo-modals` |
| `rolemodel:turbo:form` | `dynamic-forms` |
| `rolemodel:soft_destroyable` | `soft-destroyable` |
| `rolemodel:core_setup` | `polymorphic-parent-resources`, `rake-tasks` |

## Utilities

Expand Down
31 changes: 20 additions & 11 deletions lib/generators/rolemodel/core_setup/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Core Setup Generator

[USAGE](./USAGE)

Runs the core generators every new Rails app should have. Unlike
`rolemodel:all`, this skips the app-specific extras (React, SaaS/Devise,
GoodJob, Kaminari, etc.) so you get just the standard baseline — a new Rails
Expand All @@ -9,21 +11,28 @@ app you can push straight to Heroku right after generation.

- A freshly generated Rails app

## Options

- `--material`, `--phosphor`, `--tabler`, `--feather`, `--lucide`, or `--custom`
picks the Optics icon library up front. Without one, the icons generator asks.
- `--skip-deployable` skips Heroku, Sentry, and Lograge.

## What you get

- [GitHub](../github) — standard GitHub configuration
- [Heroku](../heroku) — standard Heroku deployment configuration
- [Readme](../readme) — standard project README
- [Webpack](../webpack) — Webpack v5 for JS and CSS
- [Sentry](../sentry) — error monitoring for Ruby and JavaScript
- [Slim](../slim) — Slim templates
- [Optics](../optics) — Optics design system (pass an icon library flag such as
`--material` to choose it up front; otherwise the icons generator asks)
- [Testing](../testing) — RSpec, FactoryBot, parallel_tests, TestProf
(pass `--js-runner` to include jasmine-playwright-runner)
- [Webpack](../webpack) — Webpack v5 for JS and CSS
- [Optics](../optics) — Optics design system and icons
- [SimpleForm](../simple_form) — SimpleForm with our configuration
- [Tom Select](../tom_select) — Tom Select with a Stimulus controller and SimpleForm inputs
- [Testing](../testing) — RSpec, FactoryBot, parallel_tests, and TestProf
- [Turbo](../turbo) — Turbo 8 setup, confirm dialogs, modals, and dynamic forms
- [Flash](../ui_components/flash) — flash messages
- [GitHub](../github) — standard GitHub configuration
- [Readme](../readme) — standard project README
- [Linters](../linters) — Rubocop and ESLint
- [UI Components](../ui_components) — flash, the modal pattern, & Turbo 8 support
- [Editors](../editors) — EditorConfig and recommended VSCode extensions
- [Heroku](../heroku) — standard Heroku deployment configuration
- [Sentry](../sentry) — error monitoring for Ruby and JavaScript
- [Lograge](../lograge) — condensed request logging
- The [`polymorphic-parent-resources`](https://github.com/RoleModel/skills/tree/main/skills/polymorphic-parent-resources)
and [`rake-tasks`](https://github.com/RoleModel/skills/tree/main/skills/rake-tasks) agent skills for
`resource_for` and `Rolemodel::Utility::TaskTools`, installed into `.agents/skills`
16 changes: 10 additions & 6 deletions lib/generators/rolemodel/core_setup/USAGE
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
Description:
Runs the core generators every new Rails app should have

Sets up GitHub config, Heroku deployment, README, Webpack, Sentry, Slim,
Optics, testing (RSpec & friends), SimpleForm, linters, Turbo 8+ support,
and Lograge. The result is an app that is ready to push directly to Heroku.
Sets up Slim, Webpack, Optics, SimpleForm, Tom Select, testing (RSpec &
friends), Turbo, flash messages, GitHub config, README, linters, Heroku
deployment, Sentry, and Lograge. It also installs the agent skills for
resource_for and TaskTools. The result is an app that is ready to push
directly to Heroku.

Pass --js-runner to also include jasmine-playwright-runner for browser
JS testing.
Pass an icon library flag (--material, --phosphor, --tabler, --feather,
--lucide, or --custom) to choose the Optics icons up front.

Pass --skip-deployable to skip Heroku, Sentry, and Lograge.

Example:
rails generate rolemodel:core_setup
rails generate rolemodel:core_setup --material
7 changes: 7 additions & 0 deletions lib/generators/rolemodel/core_setup/core_setup_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ class CoreSetupGenerator < ::Rolemodel::GeneratorBase

class_option :skip_deployable, type: :boolean, default: false, desc: 'skip generators for app deployment (Heroku, Sentry, Lograge)'

def install_agent_skills
say 'Installing agent skills for the rolemodel_rails utilities', :green

install_skill 'polymorphic-parent-resources'
install_skill 'rake-tasks'
end

def run_the_core_generators
generate 'rolemodel:slim'
generate 'rolemodel:webpack'
Expand Down
3 changes: 2 additions & 1 deletion lib/generators/rolemodel/ui_components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
## What you get

* [Flash](./flash)
* [Modals](./modals)
* [Navbar](./navbar)

Modals moved to the [Turbo modals](../turbo/modals) generator.
2 changes: 1 addition & 1 deletion lib/rolemodel/utility/task_tools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def initialize(args)
end

def to_h
@args.transform_values { it.to_s.strip.match?('_') ? nil : it.to_s.strip }.compact
@args.transform_values { it.to_s.strip.presence unless it.to_s.strip == '_' }.compact
end
end
end
Expand Down
10 changes: 10 additions & 0 deletions spec/generators/rolemodel/core_setup_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,14 @@

expect(generator).to have_received(:generate).with('rolemodel:optics:all', '--material')
end

it 'installs the skills for the rolemodel_rails utilities' do
generator = described_class.new
allow(generator).to receive(:install_skill)

generator.install_agent_skills

expect(generator).to have_received(:install_skill).with('polymorphic-parent-resources')
expect(generator).to have_received(:install_skill).with('rake-tasks')
end
end
23 changes: 23 additions & 0 deletions spec/utility/task_tools_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

require 'rolemodel/utility/task_tools'

RSpec.describe Rolemodel::Utility::TaskTools do
subject(:tools) { Object.new.extend(described_class) }

describe '#sanitize_arguments' do
let(:defaults) { { name: 'RoleModel', email: 'admin@example.com' } }

it 'strips the values it keeps' do
expect(tools.sanitize_arguments({ name: ' Jane ' }, defaults)).to eq(name: 'Jane', email: 'admin@example.com')
end

it 'falls back to the default for an argument skipped with _ or left blank' do
expect(tools.sanitize_arguments({ name: '_', email: ' ' }, defaults)).to eq defaults
end

it 'keeps values that contain an underscore' do
expect(tools.sanitize_arguments({ email: 'jane_doe@example.com' }, defaults)[:email]).to eq 'jane_doe@example.com'
end
end
end
Loading