Class: Vert::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_routesObject



38
39
40
41
42
# File 'lib/vert/generators/install_generator.rb', line 38

def add_routes
  route 'get "/health", to: "health#show"'
  route 'get "/health/live", to: "health#live"'
  route 'get "/health/ready", to: "health#ready"'
end

#create_application_recordObject



21
22
23
# File 'lib/vert/generators/install_generator.rb', line 21

def create_application_record
  template "application_record.rb.tt", "app/models/application_record.rb"
end

#create_current_modelObject



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

def create_current_model
  template "current.rb.tt", "app/models/current.rb"
end

#create_health_controllerObject



34
35
36
# File 'lib/vert/generators/install_generator.rb', line 34

def create_health_controller
  template "health_controller.rb.tt", "app/controllers/health_controller.rb"
end

#create_initializerObject



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

def create_initializer
  template "initializer.rb.tt", "config/initializers/vert.rb"
end

#create_outbox_event_modelObject



25
26
27
# File 'lib/vert/generators/install_generator.rb', line 25

def create_outbox_event_model
  template "outbox_event.rb.tt", "app/models/outbox_event.rb"
end

#create_outbox_migrationObject



29
30
31
32
# File 'lib/vert/generators/install_generator.rb', line 29

def create_outbox_migration
  migration_template "create_outbox_events.rb.tt",
                     "db/migrate/#{timestamp}_create_outbox_events.rb"
end

#show_instructionsObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/vert/generators/install_generator.rb', line 44

def show_instructions
  say "\n"
  say "Vert installed successfully!", :green
  say "\n"
  say "Next steps:", :yellow
  say "1. Edit config/initializers/vert.rb to enable the features you need"
  say "2. Run migrations: rails db:migrate"
  say "3. Include Vert concerns in your models as needed:"
  say "   include Vert::Concerns::UuidPrimaryKey"
  say "   include Vert::Concerns::MultiTenant"
  say "   include Vert::Concerns::Auditable"
  say "   include Vert::Concerns::SoftDeletable"
  say "\n"
end