Class: RobotLab::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- RobotLab::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/robot_lab/install_generator.rb
Overview
Installs RobotLab into a Rails application
Usage:
rails generate robot_lab:install
Class Method Summary collapse
-
.next_migration_number(dirname) ⇒ String
Returns the next migration number for ActiveRecord migrations.
Instance Method Summary collapse
-
#create_directories ⇒ void
Creates the robots and tools directories.
-
#create_initializer ⇒ void
Creates the RobotLab initializer file.
-
#create_job ⇒ void
Creates the background job for robot execution.
-
#create_migration ⇒ void
Creates the database migration for RobotLab tables.
-
#create_models ⇒ void
Creates the ActiveRecord model files.
-
#display_post_install ⇒ void
Displays post-installation instructions.
Class Method Details
.next_migration_number(dirname) ⇒ String
Returns the next migration number for ActiveRecord migrations.
27 28 29 |
# File 'lib/generators/robot_lab/install_generator.rb', line 27 def self.next_migration_number(dirname) ::ActiveRecord::Generators::Base.next_migration_number(dirname) end |
Instance Method Details
#create_directories ⇒ void
This method returns an undefined value.
Creates the robots and tools directories.
69 70 71 72 |
# File 'lib/generators/robot_lab/install_generator.rb', line 69 def create_directories empty_directory "app/robots" empty_directory "app/tools" end |
#create_initializer ⇒ void
This method returns an undefined value.
Creates the RobotLab initializer file.
34 35 36 |
# File 'lib/generators/robot_lab/install_generator.rb', line 34 def create_initializer template "initializer.rb.tt", "config/initializers/robot_lab.rb" end |
#create_job ⇒ void
This method returns an undefined value.
Creates the background job for robot execution.
60 61 62 63 64 |
# File 'lib/generators/robot_lab/install_generator.rb', line 60 def create_job return if [:skip_job] template "job.rb.tt", "app/jobs/robot_run_job.rb" end |
#create_migration ⇒ void
This method returns an undefined value.
Creates the database migration for RobotLab tables.
41 42 43 44 45 |
# File 'lib/generators/robot_lab/install_generator.rb', line 41 def create_migration return if [:skip_migration] migration_template "migration.rb.tt", "db/migrate/create_robot_lab_tables.rb" end |
#create_models ⇒ void
This method returns an undefined value.
Creates the ActiveRecord model files.
50 51 52 53 54 55 |
# File 'lib/generators/robot_lab/install_generator.rb', line 50 def create_models return if [:skip_migration] template "thread_model.rb.tt", "app/models/robot_lab_thread.rb" template "result_model.rb.tt", "app/models/robot_lab_result.rb" end |
#display_post_install ⇒ void
This method returns an undefined value.
Displays post-installation instructions.
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/generators/robot_lab/install_generator.rb', line 77 def display_post_install say "" say "RobotLab installed successfully!", :green say "" say "Next steps:" say " 1. Run migrations: rails db:migrate" say " 2. Configure your LLM API keys in config/initializers/robot_lab.rb" say " 3. Generate your first robot: rails g robot_lab:robot MyRobot" say " 4. Enqueue robot runs via RobotRunJob (app/jobs/robot_run_job.rb)" unless [:skip_job] say "" end |