Sha256: cf7a22eaf945836d43dae3500efc8e08e9aa685e2b10f92ca52584ee5ed5dd6e

Contents?: true

Size: 1000 Bytes

Versions: 23

Compression:

Stored size: 1000 Bytes

Contents

require 'rails/generators'
require 'rails/generators/active_record'

module GoodJob
  #
  # Implements the Rails generator used for setting up GoodJob in a Rails
  # application. Run it with +bin/rails g good_job:install+ in your console.
  #
  # This generator is primarily dedicated to stubbing out a migration that adds
  # a table to hold GoodJob's queued jobs in your database.
  #
  class InstallGenerator < Rails::Generators::Base
    include Rails::Generators::Migration

    class << self
      delegate :next_migration_number, to: ActiveRecord::Generators::Base
    end

    source_paths << File.join(File.dirname(__FILE__), "templates")

    # Generates the actual migration file and places it on disk.
    def create_migration_file
      migration_template 'migration.rb.erb', 'db/migrate/create_good_jobs.rb', migration_version: migration_version
    end

    private

    def migration_version
      "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
good_job-1.9.6 lib/generators/good_job/install_generator.rb
good_job-1.9.5 lib/generators/good_job/install_generator.rb
good_job-1.9.4 lib/generators/good_job/install_generator.rb
good_job-1.9.3 lib/generators/good_job/install_generator.rb
good_job-1.9.2 lib/generators/good_job/install_generator.rb
good_job-1.9.1 lib/generators/good_job/install_generator.rb
good_job-1.9.0 lib/generators/good_job/install_generator.rb
good_job-1.8.0 lib/generators/good_job/install_generator.rb
good_job-1.7.1 lib/generators/good_job/install_generator.rb
good_job-1.7.0 lib/generators/good_job/install_generator.rb
good_job-1.6.0 lib/generators/good_job/install_generator.rb
good_job-1.5.0 lib/generators/good_job/install_generator.rb
good_job-1.4.1 lib/generators/good_job/install_generator.rb
good_job-1.4.0 lib/generators/good_job/install_generator.rb
good_job-1.3.6 lib/generators/good_job/install_generator.rb
good_job-1.3.5 lib/generators/good_job/install_generator.rb
good_job-1.3.4 lib/generators/good_job/install_generator.rb
good_job-1.3.3 lib/generators/good_job/install_generator.rb
good_job-1.3.2 lib/generators/good_job/install_generator.rb
good_job-1.3.1 lib/generators/good_job/install_generator.rb