Class: Kowl::SidekiqGenerator

Inherits:
Generators::Base show all
Defined in:
lib/kowl/generators/sidekiq_generator.rb

Instance Method Summary collapse

Methods inherited from Generators::Base

default_source_root, source_paths

Methods included from Docker

#alpine_docker_dependencies, #app_js_volumes, #app_volumes, #db_volumes, #debian_database_dependencies, #debian_docker_dependencies, #docker_app_command, #docker_compose_database_string, #docker_databases, #docker_depends_on, #docker_port_watcher, #docker_redis_service, #docker_sidekiq_service, #docker_variables, #docker_volumes, #docker_webpacker_service, #dockerfile_database_args, #dockerfile_migration_snip, #js_volumes, #mysql_volumes, #postgresql_volumes, #redis_volumes

Methods included from Actions

#add_extension_routes, #add_package, #append_to_file, #database_route, #dev_config, #dup_file, #file_exists?, #mailer_gems, #mailer_route, #mk_dir, #move_file, #pry_gems, #rails_cmd, #remove_dir, #remove_file, #remove_gem, #replace_string_in_file, #robocop_test_engine, #sidekiq_route, #template_linter_gems

Instance Method Details

#copy_configObject

Copy over a basic sidekiq config and sidekiq initializer



14
15
16
17
# File 'lib/kowl/generators/sidekiq_generator.rb', line 14

def copy_config
  template 'config/sidekiq.yml.tt', 'config/sidekiq.yml'
  copy_file 'config/initializers/sidekiq.rb', 'config/initializers/sidekiq.rb'
end

#pghero_workerObject

Setup pghero scheduled job, if application will be running with postgresql



20
21
22
# File 'lib/kowl/generators/sidekiq_generator.rb', line 20

def pghero_worker
  copy_file('app/workers/scheduler/pghero_scheduler.rb', 'app/workers/scheduler/pghero_scheduler.rb') if options[:database] == 'postgresql'
end

#set_redis_as_cache_storageObject

Setup the application to use redis as a cache_store



25
26
27
28
29
# File 'lib/kowl/generators/sidekiq_generator.rb', line 25

def set_redis_as_cache_storage
  # https://blog.appsignal.com/2018/04/17/rails-built-in-cache-stores.html
  # https://www.engineyard.com/blog/rails-5-2-redis-cache-store
  # config.cache_storage = :redis_cache_store, { driver: :hiredis } # , url: "redis://redis:6379/0" }
end