railstart 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -1
- data/README.md +64 -0
- data/config/presets/vite-bun.yaml +59 -0
- data/config/rails8_defaults.yaml +35 -5
- data/lib/railstart/cli.rb +1 -1
- data/lib/railstart/command_builder.rb +17 -1
- data/lib/railstart/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3b7aaa542b7abf7c01dbbbb6bfcb71ce8dede1ae7b1535683e4538ac0aad138e
|
|
4
|
+
data.tar.gz: 150539a6c55e31e18b33a0852f2e0840057518f5789644073320e060190399bd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e180fd3ba85eaad0ca8f0f20726c66b4567e7799000d7bac4e35919d0519deab21772c1f44968d3ff152a74019e33551c8b0f9cba544f814a3f14b006a3ac7de
|
|
7
|
+
data.tar.gz: 1733110d3c2f9901d6154a87cd3b479596df1d949fff1b9f02e29cd3415c834eba3eb738d30c7a1f1124c8934338f65ef2fb43e38714775f55c349ae578e7bf7
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,40 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
## [0.3.0] - 2025-11-22
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **CSS framework**: Added Sass option to CSS framework choices
|
|
13
|
+
- **CSS framework**: Added "None (skip CSS setup)" option for skipping CSS configuration
|
|
14
|
+
- **JavaScript bundler**: Added Bun as a JavaScript bundler option (Rails 8 native support)
|
|
15
|
+
- **JavaScript bundler**: Added Vite (via vite_rails gem) with automatic post-installation setup
|
|
16
|
+
- **JavaScript bundler**: Added "None (skip JavaScript)" option using `--skip-javascript` flag
|
|
17
|
+
- **Test framework**: New test framework selection question (Minitest default, RSpec option)
|
|
18
|
+
- **Post-action**: RSpec automatic setup (`bundle add rspec-rails` + `rails generate rspec:install`) when selected
|
|
19
|
+
- **Post-action**: Vite Rails automatic setup (`bundle add vite_rails` + `bundle exec vite install`) when selected
|
|
20
|
+
- **Post-action**: Bundlebun optional setup (`bundle add bundlebun` + `rake bun:install`) for Bun packaged as a gem
|
|
21
|
+
- **Preset**: New `vite-bun.yaml` preset for modern frontend with Vite + Bundlebun (use with `--preset vite-bun`)
|
|
22
|
+
- **Command builder**: Choice-level `rails_flag` support for SELECT questions
|
|
23
|
+
- **Command builder**: Different choices can now have different flags or no flag at all
|
|
24
|
+
- **Tests**: Comprehensive test coverage for choice-level rails_flag feature
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
- **JavaScript question**: Renamed prompt from "Which JavaScript bundler?" to "Which JavaScript approach?"
|
|
28
|
+
- **Command builder**: SELECT questions now check for choice-level flags before falling back to question-level flags
|
|
29
|
+
- **Command builder**: Vite choice doesn't add any rails flag (handled via post-action instead)
|
|
30
|
+
- **Config**: JavaScript choices now use choice-level `rails_flag` instead of question-level for flexibility
|
|
31
|
+
|
|
32
|
+
### Technical
|
|
33
|
+
- Enhanced `CommandBuilder.process_select` to support per-choice flag configuration
|
|
34
|
+
- Backward compatible with existing configs using question-level flags
|
|
35
|
+
- All tests pass (33 runs, 97 assertions, 0 failures)
|
|
36
|
+
- Rubocop clean (no offenses)
|
|
37
|
+
|
|
38
|
+
## [0.2.1] - 2025-11-22
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
- Thor::UndefinedCommandError raised with incorrect number of arguments (now passes command, nil, and all_commands.keys)
|
|
42
|
+
|
|
9
43
|
## [0.2.0] - 2025-11-22
|
|
10
44
|
|
|
11
45
|
### Added
|
|
@@ -38,7 +72,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
38
72
|
- TTY::Prompt select/multi_select displaying duplicate options (switched from array pairs to hash format)
|
|
39
73
|
- Default value selection not working correctly (now uses 1-based index as expected by TTY::Prompt)
|
|
40
74
|
- Bundle install post-action incorrectly prompting when user explicitly skips bundle install
|
|
41
|
-
- CLI error handling improved (Thor::UndefinedCommandError)
|
|
42
75
|
|
|
43
76
|
### Removed
|
|
44
77
|
- Plain text summary formatting replaced with styled box display
|
data/README.md
CHANGED
|
@@ -141,6 +141,70 @@ railstart new my_app --preset api-only
|
|
|
141
141
|
railstart new my_app --preset api-only --default
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
+
## Creating Custom Presets
|
|
145
|
+
|
|
146
|
+
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)**.
|
|
147
|
+
|
|
148
|
+
### Quick Preset Creation
|
|
149
|
+
|
|
150
|
+
Create a new preset file in `config/presets/{name}.yaml`:
|
|
151
|
+
|
|
152
|
+
```yaml
|
|
153
|
+
---
|
|
154
|
+
# My Team Preset - PostgreSQL + RSpec + Vite
|
|
155
|
+
|
|
156
|
+
questions:
|
|
157
|
+
- id: database
|
|
158
|
+
choices:
|
|
159
|
+
- name: PostgreSQL
|
|
160
|
+
value: postgresql
|
|
161
|
+
default: true
|
|
162
|
+
|
|
163
|
+
- id: javascript
|
|
164
|
+
choices:
|
|
165
|
+
- name: Vite (via vite_rails gem)
|
|
166
|
+
value: vite
|
|
167
|
+
default: true
|
|
168
|
+
|
|
169
|
+
- id: test_framework
|
|
170
|
+
choices:
|
|
171
|
+
- name: RSpec
|
|
172
|
+
value: rspec
|
|
173
|
+
default: true
|
|
174
|
+
|
|
175
|
+
post_actions:
|
|
176
|
+
- id: setup_vite
|
|
177
|
+
enabled: true
|
|
178
|
+
|
|
179
|
+
- id: setup_rspec
|
|
180
|
+
enabled: true
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Then use it:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
railstart new myapp --preset my-team
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Built-in Presets
|
|
190
|
+
|
|
191
|
+
Railstart includes several ready-to-use presets:
|
|
192
|
+
|
|
193
|
+
- **`default`** - PostgreSQL + Tailwind + Importmap (sensible defaults)
|
|
194
|
+
- **`api-only`** - Minimal Rails for JSON APIs (no views, no frontend)
|
|
195
|
+
- **`vite-bun`** - Modern SPA with Vite + Bundlebun
|
|
196
|
+
|
|
197
|
+
### Learn More
|
|
198
|
+
|
|
199
|
+
For detailed documentation including:
|
|
200
|
+
- Available questions and post-actions
|
|
201
|
+
- ID-based merging system
|
|
202
|
+
- Step-by-step workflow
|
|
203
|
+
- Real-world examples
|
|
204
|
+
- Best practices and troubleshooting
|
|
205
|
+
|
|
206
|
+
See the comprehensive **[Creating Presets Guide](docs/railstart-preset-builder/SKILL.md)**.
|
|
207
|
+
|
|
144
208
|
## Configuration
|
|
145
209
|
|
|
146
210
|
### Initialize Configuration Files
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
# Vite + Bundlebun Preset - Modern frontend with Vite and Bun packaged as a gem
|
|
3
|
+
# This preset configures Rails with Vite for fast HMR and Bundlebun for unified JavaScript runtime
|
|
4
|
+
|
|
5
|
+
questions:
|
|
6
|
+
- id: database
|
|
7
|
+
choices:
|
|
8
|
+
- name: PostgreSQL
|
|
9
|
+
value: postgresql
|
|
10
|
+
default: true
|
|
11
|
+
|
|
12
|
+
- id: css
|
|
13
|
+
choices:
|
|
14
|
+
- name: Tailwind
|
|
15
|
+
value: tailwind
|
|
16
|
+
default: true
|
|
17
|
+
|
|
18
|
+
- id: javascript
|
|
19
|
+
choices:
|
|
20
|
+
- name: Vite (via vite_rails gem)
|
|
21
|
+
value: vite
|
|
22
|
+
default: true
|
|
23
|
+
|
|
24
|
+
- id: test_framework
|
|
25
|
+
choices:
|
|
26
|
+
- name: Minitest (default)
|
|
27
|
+
value: minitest
|
|
28
|
+
default: true
|
|
29
|
+
|
|
30
|
+
- id: skip_features
|
|
31
|
+
default: []
|
|
32
|
+
|
|
33
|
+
- id: api_only
|
|
34
|
+
default: false
|
|
35
|
+
|
|
36
|
+
- id: skip_git
|
|
37
|
+
default: true
|
|
38
|
+
|
|
39
|
+
- id: skip_docker
|
|
40
|
+
default: false
|
|
41
|
+
|
|
42
|
+
- id: skip_bundle
|
|
43
|
+
default: false
|
|
44
|
+
|
|
45
|
+
post_actions:
|
|
46
|
+
- id: setup_vite
|
|
47
|
+
name: "Setup Vite Rails"
|
|
48
|
+
enabled: true
|
|
49
|
+
command: "bundle add vite_rails && bundle install && bundle exec vite install"
|
|
50
|
+
|
|
51
|
+
- id: setup_bundlebun
|
|
52
|
+
name: "Setup Bundlebun (Bun packaged as a gem)"
|
|
53
|
+
enabled: true
|
|
54
|
+
command: "bundle add bundlebun && bundle install && bundle exec rake bun:install"
|
|
55
|
+
|
|
56
|
+
- id: init_git
|
|
57
|
+
name: "Initialize git repository"
|
|
58
|
+
enabled: true
|
|
59
|
+
command: "git init && git add . && git commit -m 'Initial commit with Vite + Bundlebun'"
|
data/config/rails8_defaults.yaml
CHANGED
|
@@ -30,24 +30,35 @@ questions:
|
|
|
30
30
|
value: bulma
|
|
31
31
|
- name: PostCSS (no framework)
|
|
32
32
|
value: postcss
|
|
33
|
-
- name:
|
|
33
|
+
- name: Sass
|
|
34
|
+
value: sass
|
|
35
|
+
- name: None (skip CSS setup)
|
|
34
36
|
value: none
|
|
35
37
|
rails_flag: "--css=%{value}"
|
|
36
38
|
|
|
37
39
|
- id: javascript
|
|
38
40
|
type: select
|
|
39
|
-
prompt: "Which JavaScript
|
|
41
|
+
prompt: "Which JavaScript approach?"
|
|
40
42
|
choices:
|
|
41
43
|
- name: Importmap (default)
|
|
42
44
|
value: importmap
|
|
43
45
|
default: true
|
|
46
|
+
rails_flag: "--javascript=importmap"
|
|
47
|
+
- name: Bun
|
|
48
|
+
value: bun
|
|
49
|
+
rails_flag: "--javascript=bun"
|
|
44
50
|
- name: esbuild
|
|
45
51
|
value: esbuild
|
|
46
|
-
|
|
47
|
-
value: webpack
|
|
52
|
+
rails_flag: "--javascript=esbuild"
|
|
48
53
|
- name: Rollup
|
|
49
54
|
value: rollup
|
|
50
|
-
|
|
55
|
+
rails_flag: "--javascript=rollup"
|
|
56
|
+
- name: Webpack
|
|
57
|
+
value: webpack
|
|
58
|
+
rails_flag: "--javascript=webpack"
|
|
59
|
+
- name: None (skip JavaScript)
|
|
60
|
+
value: none
|
|
61
|
+
rails_flag: "--skip-javascript"
|
|
51
62
|
|
|
52
63
|
- id: skip_features
|
|
53
64
|
type: multi_select
|
|
@@ -102,6 +113,17 @@ questions:
|
|
|
102
113
|
default: false
|
|
103
114
|
rails_flag: "--skip-bundle"
|
|
104
115
|
|
|
116
|
+
- id: test_framework
|
|
117
|
+
type: select
|
|
118
|
+
prompt: "Which test framework?"
|
|
119
|
+
choices:
|
|
120
|
+
- name: Minitest (default)
|
|
121
|
+
value: minitest
|
|
122
|
+
default: true
|
|
123
|
+
- name: RSpec
|
|
124
|
+
value: rspec
|
|
125
|
+
rails_flag: "--skip-test"
|
|
126
|
+
|
|
105
127
|
post_actions:
|
|
106
128
|
- id: init_git
|
|
107
129
|
name: "Initialize git repository"
|
|
@@ -122,3 +144,11 @@ post_actions:
|
|
|
122
144
|
question: skip_bundle
|
|
123
145
|
equals: true
|
|
124
146
|
command: "bundle install"
|
|
147
|
+
|
|
148
|
+
- id: setup_rspec
|
|
149
|
+
name: "Setup RSpec"
|
|
150
|
+
enabled: true
|
|
151
|
+
if:
|
|
152
|
+
question: test_framework
|
|
153
|
+
equals: rspec
|
|
154
|
+
command: "bundle add rspec-rails --group development,test && bundle exec rails generate rspec:install"
|
data/lib/railstart/cli.rb
CHANGED
|
@@ -71,7 +71,7 @@ module Railstart
|
|
|
71
71
|
self.class.subcommand_classes[command].help(shell, subcommand)
|
|
72
72
|
else
|
|
73
73
|
cmd = self.class.all_commands[command]
|
|
74
|
-
raise Thor::UndefinedCommandError,
|
|
74
|
+
raise Thor::UndefinedCommandError.new(command, nil, self.class.all_commands.keys) unless cmd
|
|
75
75
|
|
|
76
76
|
shell.say "Usage:"
|
|
77
77
|
shell.say " #{self.class.banner(cmd)}"
|
|
@@ -42,13 +42,29 @@ module Railstart
|
|
|
42
42
|
|
|
43
43
|
def process_question_flags(flags, question, answer)
|
|
44
44
|
case question["type"]
|
|
45
|
-
when "select"
|
|
45
|
+
when "select"
|
|
46
|
+
process_select(flags, question, answer)
|
|
47
|
+
when "yes_no", "input"
|
|
46
48
|
add_flags(flags, question, answer)
|
|
47
49
|
when "multi_select"
|
|
48
50
|
process_multi_select(flags, question, answer)
|
|
49
51
|
end
|
|
50
52
|
end
|
|
51
53
|
|
|
54
|
+
def process_select(flags, question, answer)
|
|
55
|
+
# Check if the selected choice has a choice-level rails_flag
|
|
56
|
+
selected_choice = Array(question["choices"]).find { |choice| choice["value"] == answer }
|
|
57
|
+
|
|
58
|
+
if selected_choice && (selected_choice["rails_flag"] || selected_choice["rails_flags"])
|
|
59
|
+
# Use choice-level flag
|
|
60
|
+
add_flags(flags, selected_choice, answer)
|
|
61
|
+
elsif question["rails_flag"] || question["rails_flags"]
|
|
62
|
+
# Fall back to question-level flag
|
|
63
|
+
add_flags(flags, question, answer)
|
|
64
|
+
end
|
|
65
|
+
# If neither exists, no flag is added (e.g., for choices that don't need flags)
|
|
66
|
+
end
|
|
67
|
+
|
|
52
68
|
def process_multi_select(flags, question, answer)
|
|
53
69
|
Array(question["choices"]).each do |choice|
|
|
54
70
|
next unless Array(answer).include?(choice["value"])
|
data/lib/railstart/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: railstart
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- dpaluy
|
|
@@ -69,6 +69,7 @@ files:
|
|
|
69
69
|
- Rakefile
|
|
70
70
|
- config/presets/api-only.yaml
|
|
71
71
|
- config/presets/default.yaml
|
|
72
|
+
- config/presets/vite-bun.yaml
|
|
72
73
|
- config/rails8_defaults.yaml
|
|
73
74
|
- exe/railstart
|
|
74
75
|
- lib/railstart.rb
|