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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/_yardoc/
/coverage/
/doc/
/docs/
/pkg/
/tmp/

Expand All @@ -17,4 +16,5 @@ CLAUDE.md
.repoprompt/
.factory/
.claude/
.codex/
*.gem
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,35 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [0.3.0] - 2025-11-22

### Added
- **CSS framework**: Added Sass option to CSS framework choices
- **CSS framework**: Added "None (skip CSS setup)" option for skipping CSS configuration
- **JavaScript bundler**: Added Bun as a JavaScript bundler option (Rails 8 native support)
- **JavaScript bundler**: Added Vite (via vite_rails gem) with automatic post-installation setup
- **JavaScript bundler**: Added "None (skip JavaScript)" option using `--skip-javascript` flag
- **Test framework**: New test framework selection question (Minitest default, RSpec option)
- **Post-action**: RSpec automatic setup (`bundle add rspec-rails` + `rails generate rspec:install`) when selected
- **Post-action**: Vite Rails automatic setup (`bundle add vite_rails` + `bundle exec vite install`) when selected
- **Post-action**: Bundlebun optional setup (`bundle add bundlebun` + `rake bun:install`) for Bun packaged as a gem
- **Preset**: New `vite-bun.yaml` preset for modern frontend with Vite + Bundlebun (use with `--preset vite-bun`)
- **Command builder**: Choice-level `rails_flag` support for SELECT questions
- **Command builder**: Different choices can now have different flags or no flag at all
- **Tests**: Comprehensive test coverage for choice-level rails_flag feature

### Changed
- **JavaScript question**: Renamed prompt from "Which JavaScript bundler?" to "Which JavaScript approach?"
- **Command builder**: SELECT questions now check for choice-level flags before falling back to question-level flags
- **Command builder**: Vite choice doesn't add any rails flag (handled via post-action instead)
- **Config**: JavaScript choices now use choice-level `rails_flag` instead of question-level for flexibility

### Technical
- Enhanced `CommandBuilder.process_select` to support per-choice flag configuration
- Backward compatible with existing configs using question-level flags
- All tests pass (33 runs, 97 assertions, 0 failures)
- Rubocop clean (no offenses)

## [0.2.1] - 2025-11-22

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
railstart (0.2.1)
railstart (0.3.0)
thor
tty-box
tty-prompt
Expand Down
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,70 @@ railstart new my_app --preset api-only
railstart new my_app --preset api-only --default
```

## Creating Custom Presets

Presets are powerful tools for defining opinionated Rails configurations for specific stacks or team standards. For comprehensive guidance on creating presets, see **[Creating Presets Guide](docs/railstart-preset-builder/SKILL.md)**.

### Quick Preset Creation

Create a new preset file in `config/presets/{name}.yaml`:

```yaml
---
# My Team Preset - PostgreSQL + RSpec + Vite

questions:
- id: database
choices:
- name: PostgreSQL
value: postgresql
default: true

- id: javascript
choices:
- name: Vite (via vite_rails gem)
value: vite
default: true

- id: test_framework
choices:
- name: RSpec
value: rspec
default: true

post_actions:
- id: setup_vite
enabled: true

- id: setup_rspec
enabled: true
```

Then use it:

```bash
railstart new myapp --preset my-team
```

### Built-in Presets

Railstart includes several ready-to-use presets:

- **`default`** - PostgreSQL + Tailwind + Importmap (sensible defaults)
- **`api-only`** - Minimal Rails for JSON APIs (no views, no frontend)
- **`vite-bun`** - Modern SPA with Vite + Bundlebun

### Learn More

For detailed documentation including:
- Available questions and post-actions
- ID-based merging system
- Step-by-step workflow
- Real-world examples
- Best practices and troubleshooting

See the comprehensive **[Creating Presets Guide](docs/railstart-preset-builder/SKILL.md)**.

## Configuration

### Initialize Configuration Files
Expand Down
59 changes: 59 additions & 0 deletions config/presets/vite-bun.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
# Vite + Bundlebun Preset - Modern frontend with Vite and Bun packaged as a gem
# This preset configures Rails with Vite for fast HMR and Bundlebun for unified JavaScript runtime

questions:
- id: database
choices:
- name: PostgreSQL
value: postgresql
default: true

- id: css
choices:
- name: Tailwind
value: tailwind
default: true

- id: javascript
choices:
- name: Vite (via vite_rails gem)
value: vite
default: true

- id: test_framework
choices:
- name: Minitest (default)
value: minitest
default: true

- id: skip_features
default: []

- id: api_only
default: false

- id: skip_git
default: true

- id: skip_docker
default: false

- id: skip_bundle
default: false

post_actions:
- id: setup_vite
name: "Setup Vite Rails"
enabled: true
command: "bundle add vite_rails && bundle install && bundle exec vite install"

- id: setup_bundlebun
name: "Setup Bundlebun (Bun packaged as a gem)"
enabled: true
command: "bundle add bundlebun && bundle install && bundle exec rake bun:install"

- id: init_git
name: "Initialize git repository"
enabled: true
command: "git init && git add . && git commit -m 'Initial commit with Vite + Bundlebun'"
40 changes: 35 additions & 5 deletions config/rails8_defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,35 @@ questions:
value: bulma
- name: PostCSS (no framework)
value: postcss
- name: None
- name: Sass
value: sass
- name: None (skip CSS setup)
value: none
rails_flag: "--css=%{value}"

- id: javascript
type: select
prompt: "Which JavaScript bundler?"
prompt: "Which JavaScript approach?"
choices:
- name: Importmap (default)
value: importmap
default: true
rails_flag: "--javascript=importmap"
- name: Bun
value: bun
rails_flag: "--javascript=bun"
- name: esbuild
value: esbuild
- name: Webpack
value: webpack
rails_flag: "--javascript=esbuild"
- name: Rollup
value: rollup
rails_flag: "--javascript=%{value}"
rails_flag: "--javascript=rollup"
- name: Webpack
value: webpack
rails_flag: "--javascript=webpack"
- name: None (skip JavaScript)
value: none
rails_flag: "--skip-javascript"

- id: skip_features
type: multi_select
Expand Down Expand Up @@ -102,6 +113,17 @@ questions:
default: false
rails_flag: "--skip-bundle"

- id: test_framework
type: select
prompt: "Which test framework?"
choices:
- name: Minitest (default)
value: minitest
default: true
- name: RSpec
value: rspec
rails_flag: "--skip-test"

post_actions:
- id: init_git
name: "Initialize git repository"
Expand All @@ -122,3 +144,11 @@ post_actions:
question: skip_bundle
equals: true
command: "bundle install"

- id: setup_rspec
name: "Setup RSpec"
enabled: true
if:
question: test_framework
equals: rspec
command: "bundle add rspec-rails --group development,test && bundle exec rails generate rspec:install"
Loading