Class: SolidQueue::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#configure_adapter_and_databaseObject



14
15
16
17
18
19
20
21
# File 'lib/generators/solid_queue/install/install_generator.rb', line 14

def configure_adapter_and_database
  pathname = Pathname(destination_root).join("config/environments/production.rb")

  gsub_file pathname, /\n\s*config\.solid_queue\.connects_to\s+=.*\n/, "\n", verbose: false
  gsub_file pathname, /(# )?config\.active_job\.queue_adapter\s+=.*\n/,
    "config.active_job.queue_adapter = :solid_queue\n" +
    "  config.solid_queue.connects_to = { database: { writing: :queue } }\n"
end

#copy_filesObject



6
7
8
9
10
11
12
# File 'lib/generators/solid_queue/install/install_generator.rb', line 6

def copy_files
  template "config/queue.yml"
  template "config/recurring.yml"
  template "db/queue_schema.rb"
  template "bin/jobs"
  chmod "bin/jobs", 0755 & ~File.umask, verbose: false
end