thecore_generators 3.15.0 → 3.16.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: b5cb7e253b11bc9757eba5e303f23e0bb745b97f6657fd215b84363d9ba5c977
4
- data.tar.gz: eea84a0e751f4e0956dc767a206201fb77e53c6aaea97c23ccbb434914ea0b26
3
+ metadata.gz: 346f360b4e74d95a718f4a7a882438125fc223dc90f37c64f4e329f5f5b00c58
4
+ data.tar.gz: '039d41bbbbe133326fdbc0807e99bca866954870699bb1bf616af58ddc675adc'
5
5
  SHA512:
6
- metadata.gz: '039f78b814cb50398c6072c84f1bf4bfcf44e22251b3e650d74443ea9af1ddd2e2ac945847c3fb3928a2b2a76a33be04a7e364f715e52e7c7d0053c66c5a6628'
7
- data.tar.gz: 8a11eaf74c07b59e5d6285b03752d94f44d89a8ef3695442e4feb2cec32e5f6e2a7bea351737355790f0a02a93e52ee07b1fda8f41c8b4b831ebd063a68580e0
6
+ metadata.gz: 76b8385d811afe04678b7258ed6aaeb4f77585b0c3311ea9156cd30a8556bf32bd0474cc1aa4cdc893d9571f653d95cf13a0aa2af631fa08881a50bc12fed0eb
7
+ data.tar.gz: e23b6d200469c5ae115ffd3f9cb490f3bf512ad4cce891e13b0288629e5fd78a8d280adbce54d27c2da698e41b085da4ebf461c5322b70463a0604223ebd7c21
data/README.md CHANGED
@@ -393,9 +393,11 @@ New apps start on Rails 8.1. Rails 8's `rails new` only generates Propshaft (the
393
393
  `--asset-pipeline=sprockets` any more); the template switches the app to Sprockets, which
394
394
  RailsAdmin 3 and the Thecore UI need, writes `app/assets/config/manifest.js` and links
395
395
  `"application"` in the layout (Propshaft's `:app` doesn't exist in Sprockets). With Rails 7.2's
396
- `rails new`, keep passing `--asset-pipeline=sprockets`. Rails 8's other defaults (Solid
397
- Cache/Queue/Cable, Kamal, Thruster) are left as `rails new` writes them; the pilot's production
398
- shape is Sidekiq + Redis and one database; the update path that adopts them is #27.
396
+ `rails new`, keep passing `--asset-pipeline=sprockets`. The app runs on the Thecore 3 runtime,
397
+ not Rails 8's defaults: Sidekiq, Action Cable on Redis, one production database, no Solid
398
+ Queue/Cache/Cable, Kamal or Thruster (they come with release/4, #27). The template does what
399
+ `--skip-solid --skip-kamal --skip-thruster` do, so don't pass them: `--skip-kamal` would also
400
+ turn on `force_ssl`, and a Thecore installation terminates SSL at its proxy.
399
401
 
400
402
  Run inside a devcontainer already created by the "Setup Devcontainer" VS Code command — a
401
403
  bootstrap step this template doesn't invoke or modify itself (that command's own code is
@@ -164,6 +164,41 @@ create_file "app/models/ability.rb", <<~RUBY, skip: true
164
164
  end
165
165
  RUBY
166
166
 
167
+ # --- The Thecore 3 runtime, not Rails 8's defaults (#27, stage 1) -------------
168
+ # release/3 apps run like the pilot (mytask-imas): jobs on Sidekiq (thecore_backend_commons
169
+ # sets the production adapter), Action Cable on Redis, one production database (a Thecore
170
+ # deploy has one), built with the Thecore Dockerfile. Rails 8's Solid Queue/Cache/Cable, Kamal
171
+ # and Thruster come with release/4 (ADR 0035 in mytask-imas). The result is what `rails new
172
+ # --skip-solid --skip-kamal --skip-thruster` writes, except SSL: `--skip-kamal` would also turn
173
+ # on `force_ssl`/`assume_ssl`, while a Thecore installation terminates SSL at its proxy, so they
174
+ # stay commented out. Done here, not left to the caller, so "Create App" and a bare
175
+ # `rails new -m` give the same app; Rails 7.2's `rails new` writes none of it.
176
+ #
177
+ # The skeleton is already written when the template runs, but Rails' own `run_kamal` (`kamal
178
+ # init`, config/deploy.yml, .kamal/) and `run_solid` (the solid_*:install commands, which write
179
+ # config/{queue,cache,recurring}.yml, db/*_schema.rb, bin/jobs, the Solid lines of
180
+ # production.rb and cable.yml) run after it: the same switches skip them, as Rails' own
181
+ # implied options do.
182
+ self.options = options.merge(skip_solid: true, skip_kamal: true, skip_thruster: true).freeze
183
+ gsub_file "Gemfile", /^# Use the database-backed adapters for Rails\.cache.*\n/, ""
184
+ gsub_file "Gemfile", /^# Deploy this application anywhere as a Docker container.*\n/, ""
185
+ gsub_file "Gemfile", /^# Add HTTP asset caching\/compression and X-Sendfile.*\n/, ""
186
+ gsub_file "Gemfile", /^gem ["'](solid_cache|solid_queue|solid_cable|kamal|thruster)["'].*\n\n?/, ""
187
+ if File.exist?(File.join(destination_root, "config/database.yml"))
188
+ # Rails 8's production section (primary + cache/queue/cable databases, with a comment on
189
+ # their *_DATABASE_URL variables) becomes the single database `--skip-solid` writes.
190
+ gsub_file "config/database.yml",
191
+ /^# Connection URLs for non-primary databases.*?_DATABASE_URL=.*?\n#\n/m, ""
192
+ gsub_file "config/database.yml",
193
+ /^production:\n primary: &primary_production\n(?: .*\n)+(?: (?:cache|queue|cable):\n(?: .*\n)+)+/ do |section|
194
+ primary = section[/ primary: &primary_production\n((?: .*\n)+)/, 1]
195
+ "production:\n" + primary.gsub(/^ /, " ")
196
+ end
197
+ end
198
+ gsub_file "config/puma.rb", /^# Run the Solid Queue supervisor inside of Puma.*\nplugin :solid_queue.*\n\n?/, "" if File.exist?(File.join(destination_root, "config/puma.rb"))
199
+ gsub_file ".dockerignore", /^# Ignore Kamal files\.\n(?:\/.*\n)+\n?/, "" if File.exist?(File.join(destination_root, ".dockerignore"))
200
+ remove_file "bin/thrust"
201
+
167
202
  # --- Action Cable base classes ----------------------------------------------
168
203
  # Rails 8 no longer generates app/channels/application_cable (7.2 did), but
169
204
  # thecore_backend_commons includes its JWT cable authentication into
@@ -1,3 +1,3 @@
1
1
  module ThecoreGenerators
2
- VERSION = "3.15.0"
2
+ VERSION = "3.16.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.15.0
4
+ version: 3.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni