lib/generators/eivo/sidekiq/install_generator.rb in eivo-rails-sidekiq-0.0.2 vs lib/generators/eivo/sidekiq/install_generator.rb in eivo-rails-sidekiq-0.1.0

- old
+ new

@@ -13,44 +13,10 @@ end def create_initializer_file copy_file 'config/sidekiq.yml' copy_file 'app/jobs/application_job.rb' - - restart_code = <<-'EOF' -### EIVO Sidekiq begin ### - -bundle exec sidekiqctl stop tmp/pids/sidekiq.pid 120 -bundle exec sidekiq -C config/sidekiq.yml - -### EIVO Sidekiq end ### -EOF - - stop_code = <<-'EOF' -### EIVO Sidekiq begin ### - -bundle exec sidekiqctl stop tmp/pids/sidekiq.pid 15 - -### EIVO Sidekiq end ### -EOF - - # Remove old code if present - regexp = /\n### EIVO Sidekiq begin ###.*### EIVO Sidekiq end ###/m - gsub_file 'restart_production.sh', regexp, '' - gsub_file 'restart_staging.sh', regexp, '' - gsub_file 'stop_production.sh', regexp, '' - gsub_file 'stop_staging.sh', regexp, '' - - # Inject new code - after = "### EIVO end ###\n" - inject_into_file 'restart_production.sh', restart_code, after: after - inject_into_file 'restart_staging.sh', restart_code, after: after - inject_into_file 'stop_production.sh', stop_code, after: after - inject_into_file 'stop_staging.sh', stop_code, after: after - append_to_file 'Procfile', "worker: bundle exec sidekiq -C config/sidekiq.yml\n" - append_to_file '.env.example', "SIDEKIQ_THREADS=\"5\"\n" - gsub_file '.env.example', /^DB_POOL="(\d+)".*/, 'DB_POOL="\1" # [RAILS_MAX_THREADS, SIDEKIQ_THREADS].max' end end end end