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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 191ae03bb97c033f925a4de3aee9ed624f53612307a976a4118717c24b19ea26
4
- data.tar.gz: 52d839874e453876475d3cade80a2d49e64796a0fc454a56726812fde8d3fb2b
3
+ metadata.gz: a8924406ad949542bc87e2971f5e2d4bf3d528428d63abc9f9cf70cc99017f89
4
+ data.tar.gz: 4b3081dae9136012b5a38c05dc39390b59364e1c470027d8505ba705b82e493f
5
5
  SHA512:
6
- metadata.gz: 77593a2538cc3dbcc0656837444614d74fad088aecdfe405afff1a414f199b3b49a2b58c9185c6900dd9d1e108721d261ddcb7d211b94bb31bb1edbfc71be111
7
- data.tar.gz: 4dd294f1ddeea9d61451e5c8d58ff78ce40d07d08c2671246ea3021b94641dd056e0f9d7a7b933236678588e75fdfeb9cbc67757190af077d5264c8f993b9f2d
6
+ metadata.gz: 82b9973d48fd158a6d7005c2df0e749b2dbbcb50f4d240945a688013dc0ff627d5e02d67027e22ec7c27612fe8622a1a6f315a30e476600501fc65c9538adf71
7
+ data.tar.gz: 70012143460570542fe833a1071889dd2d7447598efb41574ec0c5c18f11a07efc6e128905531a10cba48baea14b9e5ef2798e96769e44b30b91fb1a9e42a03e
@@ -1,3 +1,3 @@
1
1
  module ForestAdminRails
2
- VERSION = "1.23.3"
2
+ VERSION = "1.24.0"
3
3
  end
@@ -1,4 +1,43 @@
1
- # desc "Explaining what the task does"
2
- # task :forest_admin_rails do
3
- # # Task goes here
4
- # end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.23.3
4
+ version: 1.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu