thecore_generators 3.11.0 → 3.13.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 753f6373a24773431ad2987bd84b7d8609f4a9bedb32dff5a59264bc37c68081
4
- data.tar.gz: bc6e8b3d5657bc82bebc1c1913a591e1b7bcb7545f8620d7b4b92704e4735558
3
+ metadata.gz: 146693a69bac954bb16fae029f76d60a5f92d2702f90d1cfda0b19e8a4e1a796
4
+ data.tar.gz: 728d2a12604ebb33b6efa6c7e27e33f7b086e3f61f7042492e5db0d4f9772b6c
5
5
  SHA512:
6
- metadata.gz: f5f315cbe3496bca9a6f8ac33c1af880aba847704d1bda5f313dbfecae44cae8e2d66e6548a3e1eabd473921ec36bfddd0f96fae2dc7f509386a3f31059a53f3
7
- data.tar.gz: 435300740a43124c459e8688e3a3957693b0fd435e664ee07f52b824b30260d90b4a5d4c70e669157df65a5c1c52acd5a056c69fcf2af1d2ec6e59edf8e9030e
6
+ metadata.gz: 738f18d403082dedbbfc4ce40a3376bc03c5057c6789a63436114bf135e262e6127e201c44a65c7ce76a0423eaab0cc198705d47501057d855c96b634ba1ec33
7
+ data.tar.gz: 3559b1310d5d59046158ec81232bc8b86a527c05130c605b571589a65f11c23566b119029d9f36a35b985351b13d31306c66acfbb2f5ee281d6b259a95b2dcd7
data/README.md CHANGED
@@ -391,9 +391,12 @@ for the full design and why the two stay separate).
391
391
  - **Devcontainer/CI/CLAUDE.md**, fetched from the `thecore` repo's own `samples/` (single source
392
392
  of truth, not duplicated here) and written unconditionally, overwriting whatever the bootstrap
393
393
  "Setup Devcontainer" step created: `.devcontainer/*` (base image, plugin mounts, `gh`/`glab`
394
- CLI config mounts commented out by default), `.gitlab-ci.yml` (build/test/lint/deploy, no
395
- customer-specific paths), and `CLAUDE.md` (universal sections only, project-specific sections
396
- left as TODO placeholders). The fetch location is one overridable point,
394
+ CLI config mounts commented out by default), **both** `.gitlab-ci.yml` and
395
+ `.github/workflows/ci.yml` (build/test/lint/deploy, no customer-specific paths no hosting-
396
+ profile prompt, same git-hosting-agnostic reasoning ADR 0006 established for `thecore:atom`'s
397
+ own dual-CI generation, extended here by ADR 0007/thecore_generators#25), and `CLAUDE.md`
398
+ (universal sections only, project-specific sections left as TODO placeholders). The fetch
399
+ location is one overridable point,
397
400
  `ENV["THECORE_SAMPLES_SOURCE"]`, defaulting to the raw GitHub URL for `thecore`'s `samples/`
398
401
  on `master` (`thecore`'s actual default branch).
399
402
  - **The standard installer chain** (`devise:install`, `rails_admin:install`, `active_storage:
@@ -401,8 +404,16 @@ for the full design and why the two stay separate).
401
404
  each preceded by the necessary `bundle install`) is genuinely optional, gated behind an
402
405
  interactive prompt (`yes?`, wrapped in `after_bundle` so it only ever runs once the gems
403
406
  above are actually bundled) — a developer bootstrapping without network access can decline
404
- and run these by hand later. There is no non-interactive/unattended flag for this in the
405
- current version (tracked as a future improvement, not silently missing).
407
+ and run these by hand later.
408
+ - **Non-interactive/unattended mode**: set `THECORE_APP_TEMPLATE_NON_INTERACTIVE` (any non-blank
409
+ value) to bypass the installer-chain prompt above. When set, `THECORE_APP_TEMPLATE_RUN_INSTALLERS`
410
+ (`"true"` or `"false"`) is required — the template aborts with a clear message if it's missing
411
+ or unrecognized, rather than guessing. Example:
412
+ ```bash
413
+ THECORE_APP_TEMPLATE_NON_INTERACTIVE=1 THECORE_APP_TEMPLATE_RUN_INSTALLERS=true \
414
+ rails new myapp --database=postgresql --asset-pipeline=sprockets \
415
+ -m https://raw.githubusercontent.com/gabrieletassoni/thecore_generators/release/3/lib/templates/app_template.rb
416
+ ```
406
417
 
407
418
  ## Installation
408
419
 
@@ -153,6 +153,10 @@ chmod ".devcontainer/link-host-home.sh", 0o755
153
153
  chmod ".devcontainer/check-plugins.sh", 0o755
154
154
 
155
155
  fetch_thecore_sample(".gitlab-ci.yml", ".gitlab-ci.yml")
156
+ # thecore_generators#25 (ADR 0007): fetched unconditionally, alongside .gitlab-ci.yml above --
157
+ # no hosting-profile prompt, same reasoning ADR 0006 already established for thecore:atom's own
158
+ # dual-CI generation (git hosting is a generic, per-developer choice, not something to ask about).
159
+ fetch_thecore_sample(".github/workflows/ci.yml", ".github/workflows/ci.yml")
156
160
  fetch_thecore_sample("CLAUDE.md", "CLAUDE.md")
157
161
 
158
162
  # --- Standard installer chain ------------------------------------------------
@@ -170,10 +174,44 @@ if options[:asset_pipeline].to_s != "sprockets"
170
174
  :yellow
171
175
  end
172
176
 
173
- run_setup_now = yes?(
174
- "Run `bundle install` and the standard installer generators (devise, rails_admin, " \
175
- "active_storage, action_text, action_mailbox, cancan, erd) now? (y/n)"
176
- )
177
+ # thecore_generators#23: non-interactive mode, triggered ONLY by the explicit env var
178
+ # below -- deliberately NOT auto-detected from tty absence the way `thecore:atom`'s
179
+ # `TtyDetection`-based `effectively_non_interactive?` is (ADR 0006). That precedent
180
+ # works because `AtomGenerator` runs in-process inside its own test, where stubbing
181
+ # `$stdin.tty?`/`$stdout.tty?` (see `association_wiring_test.rb`) is meaningful. This
182
+ # template instead always runs as a genuine separate `rails new` subprocess (its own
183
+ # test seam spawns it via Open3), whose stdin is a pipe -- never a real tty -- even
184
+ # when the test is legitimately simulating interactive use by feeding an answer via
185
+ # `stdin_data`. Auto-triggering on tty absence would misfire on every such simulated-
186
+ # interactive test run; the explicit, deliberate opt-in below avoids that with no loss
187
+ # of real-world safety (an unattended CI run with neither var set still fails loudly
188
+ # below, just one env var short of `thecore:atom`'s own auto-detected equivalent).
189
+ non_interactive = !ENV["THECORE_APP_TEMPLATE_NON_INTERACTIVE"].to_s.strip.empty?
190
+
191
+ run_setup_now =
192
+ if non_interactive
193
+ run_installers_raw = ENV["THECORE_APP_TEMPLATE_RUN_INSTALLERS"]
194
+ if run_installers_raw.nil? || run_installers_raw.strip.empty?
195
+ abort(
196
+ "THECORE_APP_TEMPLATE_NON_INTERACTIVE is set but THECORE_APP_TEMPLATE_RUN_INSTALLERS " \
197
+ "is not -- set it to \"true\" or \"false\" to say whether the installer chain " \
198
+ "(devise/rails_admin/active_storage/action_text/action_mailbox/cancan/erd) should run."
199
+ )
200
+ end
201
+ normalized = run_installers_raw.strip.downcase
202
+ unless %w[true false].include?(normalized)
203
+ abort(
204
+ "THECORE_APP_TEMPLATE_RUN_INSTALLERS must be \"true\" or \"false\", got " \
205
+ "#{run_installers_raw.inspect}."
206
+ )
207
+ end
208
+ normalized == "true"
209
+ else
210
+ yes?(
211
+ "Run `bundle install` and the standard installer generators (devise, rails_admin, " \
212
+ "active_storage, action_text, action_mailbox, cancan, erd) now? (y/n)"
213
+ )
214
+ end
177
215
 
178
216
  after_bundle do
179
217
  next unless run_setup_now
@@ -1,3 +1,3 @@
1
1
  module ThecoreGenerators
2
- VERSION = "3.11.0"
2
+ VERSION = "3.13.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.11.0
4
+ version: 3.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni