ruby_cms 0.2.0 → 0.2.0.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 +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +14 -0
- data/config/importmap.rb +2 -0
- data/lib/ruby_cms/engine.rb +20 -0
- data/lib/ruby_cms/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f997170922c55751d5a99a10253efbeaa4cc8c7f82ffa18e7083b5a932cacc26
|
|
4
|
+
data.tar.gz: 179a045dd39b70960801f6b3901e218bc4103ffd767dbc48202d9722c2467d67
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aa897c7d17c24754544357dea2d82797506f11623a4125fc1ca49653f9daa21aeed9e97c703016efee4a8003a64b8ee4f4060bedcbe25977b80c83268f633f62
|
|
7
|
+
data.tar.gz: 7245bb0f650775224383ac1d4588241fe5f084713525a13003706ce27acc25dff00a6dd485cefb816b7faec02a4f03d66c89f3528a7ab39ee9feca9925205687
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -490,6 +490,20 @@ Tests use an in-memory SQLite database via `spec/support/dummy_app.rb`. No separ
|
|
|
490
490
|
rails ruby_cms:css:compile_gem
|
|
491
491
|
```
|
|
492
492
|
|
|
493
|
+
### Faster Docker Builds (`assets:precompile`)
|
|
494
|
+
|
|
495
|
+
`assets:precompile` loads the Rails app in production mode and can be slow in Docker/Fly builds.
|
|
496
|
+
RubyCMS now skips non-asset runtime initializers during this phase (navigation registration,
|
|
497
|
+
dashboard registration, versioning hook, settings import, and permission seeding), which reduces
|
|
498
|
+
precompile overhead.
|
|
499
|
+
|
|
500
|
+
Recommended Docker layer order:
|
|
501
|
+
|
|
502
|
+
1. Copy `Gemfile` / `Gemfile.lock`
|
|
503
|
+
2. Run `bundle install`
|
|
504
|
+
3. Copy app source
|
|
505
|
+
4. Run `SECRET_KEY_BASE=DUMMY bin/rails assets:precompile`
|
|
506
|
+
|
|
493
507
|
### Architecture
|
|
494
508
|
|
|
495
509
|
```
|
data/config/importmap.rb
CHANGED
|
@@ -34,3 +34,5 @@ pin "ruby_cms/auto_save_preference_controller",
|
|
|
34
34
|
pin "ruby_cms/nav_order_sortable_controller",
|
|
35
35
|
to: "controllers/ruby_cms/nav_order_sortable_controller.js"
|
|
36
36
|
pin "ruby_cms/page_preview_controller", to: "controllers/ruby_cms/page_preview_controller.js"
|
|
37
|
+
pin "ruby_cms/content_block_history_controller",
|
|
38
|
+
to: "controllers/ruby_cms/content_block_history_controller.js"
|
data/lib/ruby_cms/engine.rb
CHANGED
|
@@ -66,6 +66,8 @@ module RubyCms
|
|
|
66
66
|
|
|
67
67
|
# Ensure Ahoy is loaded before host's config/initializers/ahoy.rb runs
|
|
68
68
|
initializer "ruby_cms.require_ahoy", before: :load_config_initializers do
|
|
69
|
+
next if RubyCms::Engine.assets_precompile_phase?
|
|
70
|
+
|
|
69
71
|
require "ahoy_matey"
|
|
70
72
|
end
|
|
71
73
|
|
|
@@ -103,6 +105,8 @@ module RubyCms
|
|
|
103
105
|
end
|
|
104
106
|
|
|
105
107
|
initializer "ruby_cms.nav" do
|
|
108
|
+
next if RubyCms::Engine.assets_precompile_phase?
|
|
109
|
+
|
|
106
110
|
Rails.application.config.to_prepare do
|
|
107
111
|
RubyCms::Engine.register_main_nav_items
|
|
108
112
|
RubyCms::Engine.register_settings_nav_items
|
|
@@ -110,22 +114,30 @@ module RubyCms
|
|
|
110
114
|
end
|
|
111
115
|
|
|
112
116
|
initializer "ruby_cms.dashboard_blocks" do
|
|
117
|
+
next if RubyCms::Engine.assets_precompile_phase?
|
|
118
|
+
|
|
113
119
|
RubyCms::Engine.register_default_dashboard_blocks
|
|
114
120
|
end
|
|
115
121
|
|
|
116
122
|
initializer "ruby_cms.versionable" do
|
|
123
|
+
next if RubyCms::Engine.assets_precompile_phase?
|
|
124
|
+
|
|
117
125
|
Rails.application.config.to_prepare do
|
|
118
126
|
ContentBlock.include(ContentBlock::Versionable) unless ContentBlock <= ContentBlock::Versionable
|
|
119
127
|
end
|
|
120
128
|
end
|
|
121
129
|
|
|
122
130
|
initializer "ruby_cms.settings_import", after: :load_config_initializers do
|
|
131
|
+
next if RubyCms::Engine.assets_precompile_phase?
|
|
132
|
+
|
|
123
133
|
RubyCms::Settings.import_initializer_values!
|
|
124
134
|
end
|
|
125
135
|
|
|
126
136
|
# After host initializers (e.g. register_permission_keys), ensure Permission rows exist
|
|
127
137
|
# so can?(:manage_backups) and other keys do not fail on Permission.exists? checks.
|
|
128
138
|
initializer "ruby_cms.ensure_permission_rows", after: :load_config_initializers do
|
|
139
|
+
next if RubyCms::Engine.assets_precompile_phase?
|
|
140
|
+
|
|
129
141
|
RubyCms::Permission.ensure_defaults!
|
|
130
142
|
rescue StandardError => e
|
|
131
143
|
Rails.logger.warn("[RubyCMS] Permission.ensure_defaults! skipped: #{e.message}")
|
|
@@ -249,5 +261,13 @@ module RubyCms
|
|
|
249
261
|
app.config.paths["db/migrate"] << path
|
|
250
262
|
end
|
|
251
263
|
end
|
|
264
|
+
|
|
265
|
+
def self.assets_precompile_phase?
|
|
266
|
+
command = File.basename($PROGRAM_NAME.to_s)
|
|
267
|
+
rake_assets_precompile = command == "rake" && ARGV.include?("assets:precompile")
|
|
268
|
+
rails_assets_precompile = command == "rails" && ARGV.include?("assets:precompile")
|
|
269
|
+
|
|
270
|
+
rake_assets_precompile || rails_assets_precompile
|
|
271
|
+
end
|
|
252
272
|
end
|
|
253
273
|
end
|
data/lib/ruby_cms/version.rb
CHANGED