Class: PromptCanary::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(_path) ⇒ Object



13
14
15
# File 'lib/generators/prompt_canary/install_generator.rb', line 13

def self.next_migration_number(_path)
  Time.now.utc.strftime("%Y%m%d%H%M%S")
end

Instance Method Details

#copy_migrationObject



21
22
23
24
25
26
# File 'lib/generators/prompt_canary/install_generator.rb', line 21

def copy_migration
  migration_template(
    "create_prompt_canary_calls.rb",
    "db/migrate/create_prompt_canary_calls.rb"
  )
end

#mount_engineObject



17
18
19
# File 'lib/generators/prompt_canary/install_generator.rb', line 17

def mount_engine
  route 'mount PromptCanary::Engine, at: "/prompt_canary"'
end

#show_instructionsObject



28
29
30
31
32
33
34
35
36
# File 'lib/generators/prompt_canary/install_generator.rb', line 28

def show_instructions
  say "\nPromptCanary installed!", :green
  say "  1. Run: rails db:migrate"
  say "  2. Set storage: :active_record in your PromptCanary initializer"
  say "  3. Add to config/recurring.yml:"
  say "       prompt_canary_monitor:"
  say "         class: PromptCanary::MonitorJob"
  say "         schedule: every 5 minutes\n"
end