Class: AgentCode::Commands::InstallCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- AgentCode::Commands::InstallCommand
- Defined in:
- lib/agentcode/commands/install_command.rb
Overview
Interactive setup wizard — mirrors Laravel php artisan agentcode:install exactly.
Usage: rails agentcode:install
Instance Method Summary collapse
Methods inherited from BaseCommand
Constructor Details
This class inherits a constructor from AgentCode::Commands::BaseCommand
Instance Method Details
#perform ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/agentcode/commands/install_command.rb', line 11 def perform say "" say "+ AgentCode :: Install :: Let's build something great +", :cyan say "" features = multi_select("Which features would you like to configure?") do || .default 1 .choice "Publish config & routes", "publish" .choice "Multi-tenant support (Organizations, Roles)", "multi_tenant" .choice "Audit trail (change logging)", "audit_trail" end test_framework = select("Which test framework do you use?") do || .default 1 .choice "RSpec", "rspec" .choice "Minitest", "minitest" end identifier_column = "id" roles = ["admin"] if features.include?("multi_tenant") identifier_column = ask("What column should be used to identify organizations?", default: "id") roles_input = ask("What roles should your app have?", default: "admin, editor, viewer") roles = (["admin"] + roles_input.split(",").map(&:strip)).uniq end say "" if features.include?("publish") task("Publishing config") { publish_config(test_framework) } task("Publishing routes") { publish_routes } task("Creating blueprint directory") { create_blueprint_directory } end if features.include?("multi_tenant") task("Creating migrations") { create_multi_tenant_migrations } task("Creating models") { create_multi_tenant_models(roles) } task("Creating factories") { create_factories } task("Creating policies") { create_policies } task("Updating config") { update_config(identifier_column) } task("Creating seeders") { create_seeders(roles) } end if features.include?("audit_trail") task("Creating audit trail migration") { create_audit_trail_migration } end say "" run_post_install_steps(features) install_ai_skill say "" say "AgentCode installed successfully!", :green say "" print_next_steps(features) end |