Class: Synthra::Engine
- Inherits:
-
Rails::Engine
- Object
- Rails::Engine
- Synthra::Engine
- Defined in:
- lib/synthra/engine.rb
Overview
Rails Engine for zero-configuration integration
Provides automatic setup for Rails applications:
- Auto-discovers schemas from standard locations
- Mounts API in development mode
- Integrates with Factory Bot if present
- Auto-configures for test environment
Constant Summary collapse
- SCHEMA_PATHS =
Schema search paths (in priority order)
%w[ db/schemas app/schemas schemas spec/schemas test/schemas ].freeze
Class Method Summary collapse
-
.routes ⇒ Object
Engine routes.
Instance Method Summary collapse
Class Method Details
.routes ⇒ Object
Engine routes
136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/synthra/engine.rb', line 136 def self.routes @routes ||= ActionDispatch::Routing::RouteSet.new.tap do |routes| routes.draw do get "/", to: "synthra/api#index" get "/schemas", to: "synthra/api#schemas" get "/:schema", to: "synthra/api#generate" get "/:schema/batch", to: "synthra/api#batch" get "/:schema/stream", to: "synthra/api#stream" post "/:schema", to: "synthra/api#create" end end end |
Instance Method Details
#find_schema_directory(root) ⇒ Object (private)
151 152 153 154 155 156 157 |
# File 'lib/synthra/engine.rb', line 151 def find_schema_directory(root) SCHEMA_PATHS.each do |path| full_path = root.join(path) return full_path if Dir.exist?(full_path) end nil end |