Class: Hitch::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Hitch::Generators::InstallGenerator
- Includes:
- GeneratorGuards
- Defined in:
- lib/generators/hitch/install/install_generator.rb
Overview
One install: the initializer, the /mcp endpoint controller, an empty explicit tool registry, and the routes, in order. Migrations are auto-appended by the engine; run db:migrate after install.
Usage:
bin/rails generate hitch:install
bin/rails destroy hitch:install
Constant Summary collapse
- INITIALIZER_PATH =
"config/initializers/hitch.rb"- ROUTES_PATH =
"config/routes.rb"- CONTROLLER_PATTERN =
/\A[A-Z][A-Za-z0-9]*(?:::[A-Z][A-Za-z0-9]*)*Controller\z/- MCP_ROUTE_PATTERN =
/["']\/?mcp\/?["']/
Constants included from GeneratorGuards
GeneratorGuards::REGISTRY_PATH
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
35 36 37 |
# File 'lib/generators/hitch/install/install_generator.rb', line 35 def self.exit_on_failure? true end |
Instance Method Details
#install_or_revoke ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/generators/hitch/install/install_generator.rb', line 39 def install_or_revoke prepare_identity! if behavior == :revoke remove_files remove_routes print_removal_steps else preflight! create_files add_routes print_next_steps end end |