Class: TCB::Generators::EventStoreGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/tcb/event_store/event_store_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_domain_moduleObject



18
19
20
21
# File 'lib/generators/tcb/event_store/event_store_generator.rb', line 18

def create_domain_module
  return if options[:skip_domain]
  template "domain_module.rb.tt", "app/domain/#{module_name.underscore}.rb"
end

#create_handlersObject



23
24
25
26
27
28
29
# File 'lib/generators/tcb/event_store/event_store_generator.rb', line 23

def create_handlers
  return if options[:skip_domain]
  parsed_commands.each do |cmd|
    @current_command = cmd
    template "command_handler.rb.tt", cmd.handler_file_path(module_name.underscore)
  end
end

#create_migrationObject



31
32
33
34
35
# File 'lib/generators/tcb/event_store/event_store_generator.rb', line 31

def create_migration
  return if options[:skip_migration]
  timestamp = Time.now.utc.strftime("%Y%m%d%H%M%S")
  template "migration.rb.tt", "db/migrate/#{timestamp}_create_#{table_name}.rb"
end