Sha256: 6967857e283fa0ef8e85469fdf44accebd7e81cb44ef05979c917bf5892ef44e

Contents?: true

Size: 846 Bytes

Versions: 4

Compression:

Stored size: 846 Bytes

Contents

require_relative "base"

module Bulldozer
  class JobsGenerator < Generators::Base
    def add_jobs_gem
      gem "delayed_job_active_record"
      Bundler.with_clean_env { run "bundle install" }
    end

    def configure_background_jobs_for_rspec
      generate "delayed_job:active_record"
    end

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

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

    private

    def configure_application_file(config)
      inject_into_file(
        "config/application.rb",
        "\n    #{config}",
        before: "\n  end",
      )
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bulldozer-1.6.3 lib/bulldozer/generators/jobs_generator.rb
bulldozer-1.6.2 lib/bulldozer/generators/jobs_generator.rb
bulldozer-1.6.1 lib/bulldozer/generators/jobs_generator.rb
bulldozer-1.6.0 lib/bulldozer/generators/jobs_generator.rb