Class: ActiveAgent::Dashboard::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration
Defined in:
lib/generators/active_agent/dashboard/install_generator.rb

Overview

Generator for installing the ActiveAgent Dashboard.

This will:

  • Create the telemetry_traces table migration

  • Add mount directive to routes

  • Create initializer for dashboard configuration

Examples:

Run the generator

rails generate active_agent:dashboard:install

Instance Method Summary collapse

Instance Method Details

#add_routeObject



32
33
34
# File 'lib/generators/active_agent/dashboard/install_generator.rb', line 32

def add_route
  route 'mount ActiveAgent::Dashboard::Engine => "/active_agent"'
end

#copy_migrationsObject



25
26
27
28
29
30
# File 'lib/generators/active_agent/dashboard/install_generator.rb', line 25

def copy_migrations
  migration_template(
    "create_active_agent_telemetry_traces.rb.erb",
    "db/migrate/create_active_agent_telemetry_traces.rb"
  )
end

#create_initializerObject



36
37
38
39
40
41
# File 'lib/generators/active_agent/dashboard/install_generator.rb', line 36

def create_initializer
  template(
    "active_agent_dashboard.rb.erb",
    "config/initializers/active_agent_dashboard.rb"
  )
end

#show_readmeObject



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/generators/active_agent/dashboard/install_generator.rb', line 43

def show_readme
  say "\n"
  say "ActiveAgent Dashboard installed successfully!", :green
  say "\n"
  say "Next steps:"
  say "  1. Run migrations: rails db:migrate"
  say "  2. Configure telemetry in config/active_agent.yml:"
  say "     telemetry:"
  say "       enabled: true"
  say "       local_storage: true"
  say "  3. Visit /active_agent to view the dashboard"
  say "\n"
end