railstart 0.4.0 → 0.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 675d33f74310aa870ad6a167cbd585cc643b3e37096d255732bcf900fa7ab65d
4
- data.tar.gz: 460628c266ba316d4ad19e148b9e8044912865c98f6c091dd8a1be25653dab71
3
+ metadata.gz: 5dd1449c02711ec50bf8b11e6ccfc0465768a4ad9271b0d8f08f7c9246aeb69f
4
+ data.tar.gz: 56a1956411fb506f35216355bc68be172d7f20dddc537504b31fe2b7e509fd9b
5
5
  SHA512:
6
- metadata.gz: 344c0860107725a5a56e88bf108a7e7a73891da7f0f7678850af5c47469ed63f91c8c22de71743dc68747557f7d34aac2d001814033dee29533f5b343d8b7e0d
7
- data.tar.gz: 2252beeb778c40a048e1156aebd1786a904fa7cf5edec89fd89d924265b223ff742024ceee8491d5b2a5b459a8a560047be60e43a85c13d771ee96db6edd978a
6
+ metadata.gz: 142b9a8f8ed2fee2f0647ef2cde5c8403080443ad7c312797268874677bc61ac6ab268321bbebc2910a611f1577f1b5d7198e2e8f2fa43666e8602f4838f5416
7
+ data.tar.gz: f1a77fbfdc5bcaffeb5a35db065583f8aab6cbaf9eb74c9b378bfeb7017448aee1d369dd6a063890ea416c478c1cc161617955702c4e2f9700694c4219029b36
data/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
5
5
  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
+ ## [0.4.1] - 2025-11-23
9
+
10
+ ### Changed
11
+ - **Init command**: `railstart init` now copies the complete `config/rails8_defaults.yaml` as `~/.config/railstart/config.yaml` instead of generating a minimal example with only 2 questions. Users now see all available configuration options immediately.
12
+ - **README**: Updated preset usage documentation to show both interactive and non-interactive modes immediately after custom preset creation example
13
+ - **multi_select architecture**: `ask_multi_select` now transforms value-based defaults (e.g., "action_mailer") to name-based defaults (e.g., "Action Mailer") when calling TTY::Prompt, allowing configs to use stable IDs while maintaining correct UI display
14
+
15
+ ### Fixed
16
+ - **CRITICAL ARCHITECTURE FIX**: Fixed `multi_select` question defaults to use stable choice **values** (internal IDs like "action_mailer") instead of fragile display **names** (like "Action Mailer"). This prevents preset breakage when display text changes.
17
+ - Updated `lib/railstart/generator.rb` `ask_multi_select` method to transform values → names at the TTY::Prompt boundary
18
+ - Updated `config/presets/api-only.yaml` to use values in defaults
19
+ - Updated all examples in `docs/railstart-preset-builder/SKILL.md` to use values
20
+ - Added comprehensive test coverage (3 new tests) validating transformation and storage behavior
21
+ - **Documentation**: Corrected SKILL.md to explain values-based approach with stability rationale
22
+ - Improved discoverability of configuration options - users no longer need to guess what can be configured
23
+
8
24
  ## [0.4.0] - 2025-11-22
9
25
 
10
26
  ### Added
data/README.md CHANGED
@@ -183,7 +183,11 @@ post_actions:
183
183
  Then use it:
184
184
 
185
185
  ```bash
186
+ # Interactive mode - prompts for each question
186
187
  railstart new myapp --preset my-team
188
+
189
+ # Non-interactive mode - uses all preset defaults
190
+ railstart new myapp --preset my-team --default
187
191
  ```
188
192
 
189
193
  ### Built-in Presets
@@ -209,18 +213,18 @@ See the comprehensive **[Creating Presets Guide](docs/railstart-preset-builder/S
209
213
 
210
214
  ### Initialize Configuration Files
211
215
 
212
- The easiest way to get started with custom configuration is to generate example files:
216
+ The easiest way to get started with custom configuration is to generate template files:
213
217
 
214
218
  ```bash
215
219
  railstart init
216
220
  ```
217
221
 
218
222
  This creates:
219
- - `~/.config/railstart/config.yaml` - Example user config with common customizations
223
+ - `~/.config/railstart/config.yaml` - Complete configuration template (copy of rails8_defaults.yaml with all available options)
220
224
  - `~/.config/railstart/presets/` - Directory for your presets
221
225
  - `~/.config/railstart/presets/example.yaml` - Example preset to get started
222
226
 
223
- You can then edit these files to match your preferences.
227
+ The generated `config.yaml` shows all available questions, choices, flags, and post-actions. You can delete or comment out sections you don't want to customize, and modify the defaults for sections you do want to change.
224
228
 
225
229
  ### Built-in Defaults
226
230
 
@@ -228,24 +232,29 @@ Railstart ships with sensible Rails 8 defaults defined in `config/rails8_default
228
232
 
229
233
  ### Customize for Your Team
230
234
 
231
- You can create `~/.config/railstart/config.yaml` manually or use `railstart init` to generate an example file:
235
+ You can create `~/.config/railstart/config.yaml` manually or use `railstart init` to generate a complete template file. The template includes all available options, so you can simply modify the defaults you want to change:
232
236
 
233
237
  ```yaml
238
+ # After running `railstart init`, your config.yaml will contain all options.
239
+ # Simply modify the defaults you want to change:
240
+
234
241
  questions:
235
242
  - id: database
236
243
  choices:
237
244
  - name: PostgreSQL (recommended)
238
245
  value: postgresql
239
- default: true # Your team's preference
246
+ default: true # Changed from SQLite to PostgreSQL
247
+
248
+ # ... other questions with their full configuration ...
240
249
 
241
250
  post_actions:
242
251
  - id: bundle_install
243
- enabled: false # Your team manages gems differently
244
-
252
+ enabled: false # Disabled - your team manages gems differently
253
+
245
254
  - id: setup_auth
246
255
  name: "Setup authentication"
247
256
  enabled: true
248
- command: "bundle exec rails generate devise:install"
257
+ command: "bundle exec rails generate devise:install" # New custom action
249
258
  ```
250
259
 
251
260
  **Merge behavior:**
data/lib/railstart/cli.rb CHANGED
@@ -257,40 +257,9 @@ module Railstart
257
257
  end
258
258
 
259
259
  def example_user_config
260
- <<~YAML
261
- ---
262
- # Railstart User Configuration
263
- # This file overrides built-in defaults for all your Rails projects.
264
- #
265
- # Merge behavior: questions and post_actions are merged by 'id'.
266
- # Override individual fields or add new entries.
267
-
268
- questions:
269
- # Example: Change database default to PostgreSQL
270
- - id: database
271
- choices:
272
- - name: PostgreSQL
273
- value: postgresql
274
- default: true
275
-
276
- # Example: Change CSS default to Tailwind
277
- - id: css
278
- choices:
279
- - name: Tailwind
280
- value: tailwind
281
- default: true
282
-
283
- post_actions:
284
- # Example: Disable bundle install (manage gems manually)
285
- # - id: bundle_install
286
- # enabled: false
287
-
288
- # Example: Add custom post-action
289
- # - id: setup_linting
290
- # name: "Setup RuboCop and StandardRB"
291
- # enabled: true
292
- # command: "bundle add rubocop rubocop-rails standard --group development"
293
- YAML
260
+ # Copy the full rails8_defaults.yaml as the user config template
261
+ defaults_path = File.expand_path("../../config/rails8_defaults.yaml", __dir__)
262
+ File.read(defaults_path)
294
263
  end
295
264
 
296
265
  def example_preset_config
@@ -137,9 +137,16 @@ module Railstart
137
137
  choices = question["choices"].each_with_object({}) do |choice, hash|
138
138
  hash[choice["name"]] = choice["value"]
139
139
  end
140
- defaults = question["default"] || []
141
140
 
142
- @prompt.multi_select(question["prompt"], choices, default: defaults)
141
+ # Transform value-based defaults to name-based defaults for TTY::Prompt
142
+ # Config uses stable values (e.g., "action_mailer"), TTY::Prompt needs display names
143
+ value_defaults = question["default"] || []
144
+ name_defaults = value_defaults.map do |value|
145
+ choice = question["choices"].find { |c| c["value"] == value }
146
+ choice ? choice["name"] : nil
147
+ end.compact
148
+
149
+ @prompt.multi_select(question["prompt"], choices, default: name_defaults)
143
150
  end
144
151
 
145
152
  def ask_yes_no?(question)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Railstart
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
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.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dpaluy