Class: Suspenders::JobsGenerator

Inherits:
Generators::Base show all
Defined in:
lib/suspenders/generators/jobs_generator.rb

Instance Method Summary collapse

Methods inherited from Generators::Base

default_source_root, inherited

Methods included from Actions

#action_mailer_asset_host, #action_mailer_host, #configure_environment, #expand_json, #replace_in_file

Instance Method Details

#add_jobs_gemObject


5
6
7
8
# File 'lib/suspenders/generators/jobs_generator.rb', line 5

def add_jobs_gem
  gem "delayed_job_active_record"
  Bundler.with_unbundled_env { run "bundle install" }
end

#configure_active_jobObject


21
22
23
24
25
26
# File 'lib/suspenders/generators/jobs_generator.rb', line 21

def configure_active_job
  configure_application_file(
    "config.active_job.queue_adapter = :delayed_job"
  )
  configure_environment "test", "config.active_job.queue_adapter = :inline"
end

#configure_background_jobs_for_rspecObject


10
11
12
# File 'lib/suspenders/generators/jobs_generator.rb', line 10

def configure_background_jobs_for_rspec
  generate "delayed_job:active_record"
end

#initialize_active_jobObject


14
15
16
17
18
19
# File 'lib/suspenders/generators/jobs_generator.rb', line 14

def initialize_active_job
  copy_file(
    "active_job.rb",
    "config/initializers/active_job.rb"
  )
end