forest_admin_rails 1.23.3 → 1.24.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/lib/forest_admin_rails/version.rb +1 -1
- data/lib/tasks/forest_admin_rails_tasks.rake +43 -4
- 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: a8924406ad949542bc87e2971f5e2d4bf3d528428d63abc9f9cf70cc99017f89
|
|
4
|
+
data.tar.gz: 4b3081dae9136012b5a38c05dc39390b59364e1c470027d8505ba705b82e493f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 82b9973d48fd158a6d7005c2df0e749b2dbbcb50f4d240945a688013dc0ff627d5e02d67027e22ec7c27612fe8622a1a6f315a30e476600501fc65c9538adf71
|
|
7
|
+
data.tar.gz: 70012143460570542fe833a1071889dd2d7447598efb41574ec0c5c18f11a07efc6e128905531a10cba48baea14b9e5ef2798e96769e44b30b91fb1a9e42a03e
|
|
@@ -1,4 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
namespace :forest_admin do
|
|
2
|
+
namespace :schema do
|
|
3
|
+
desc 'Generate the Forest Admin schema file without starting the server or sending it to the API'
|
|
4
|
+
task generate: :environment do
|
|
5
|
+
require 'forest_admin_agent'
|
|
6
|
+
|
|
7
|
+
debug_mode = ENV['debug'] == 'true'
|
|
8
|
+
|
|
9
|
+
puts '[ForestAdmin] Starting schema generation...'
|
|
10
|
+
|
|
11
|
+
# Force eager loading of all models
|
|
12
|
+
Rails.application.eager_load!
|
|
13
|
+
|
|
14
|
+
# Check if create_agent.rb exists
|
|
15
|
+
create_agent_path = Rails.root.join('lib', 'forest_admin_rails', 'create_agent.rb')
|
|
16
|
+
unless File.exist?(create_agent_path)
|
|
17
|
+
puts '[ForestAdmin] Error: create_agent.rb not found at lib/forest_admin_rails/create_agent.rb'
|
|
18
|
+
puts '[ForestAdmin] Run `rails generate forest_admin_rails <ENV_SECRET>` to create it.'
|
|
19
|
+
exit 1
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Setup the agent factory
|
|
23
|
+
agent_factory = ForestAdminAgent::Builder::AgentFactory.instance
|
|
24
|
+
agent_factory.setup(ForestAdminRails.config)
|
|
25
|
+
|
|
26
|
+
# Enable schema-only mode (generates schema without sending to API)
|
|
27
|
+
agent_factory.schema_only_mode = true
|
|
28
|
+
|
|
29
|
+
# Load and execute the create_agent.rb file
|
|
30
|
+
require create_agent_path
|
|
31
|
+
|
|
32
|
+
# Call setup! which will generate the schema
|
|
33
|
+
begin
|
|
34
|
+
ForestAdminRails::CreateAgent.setup!
|
|
35
|
+
puts '[ForestAdmin] Schema generation completed!'
|
|
36
|
+
rescue StandardError => e
|
|
37
|
+
puts "[ForestAdmin] Error during schema generation: #{e.message}"
|
|
38
|
+
puts e.backtrace.first(10).join("\n") if debug_mode
|
|
39
|
+
exit 1
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|