Class: Pheromone::InitializerGenerator

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

Overview

creates job depedency initializer

Instance Method Summary collapse

Instance Method Details

#create_initializerObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/generators/pheromone/initializer_generator.rb', line 5

def create_initializer
  create_file(
      'config/initializers/pheromone.rb',
      "Pheromone.setup do |pheromone_config|\n"\
      "  # pheromone_config.background_processor.name = ':resque / :sidekiq'\n"\
      "  # pheromone_config.background_processor.klass = 'BackgroundWorker'\n"\
      "  # pheromone_config.timezone = 'UTC'\n"\
      "  pheromone_config.message_format = :json\n"\
      "  WaterDrop.setup do |waterdrop_config|\n"\
      "    waterdrop_config.deliver = Rails.env.production?\n"\
      "    waterdrop_config.kafka.seed_brokers = [Rails.env.production? ? ENV['KAFKA_HOST'] : 'localhost:9092']\n"\
      "  end\n"\
      "end"\
  )
end