Sha256: 0c89103856d3b49affc1daee0be4c5891e803a836bb068c9bb085b7c46f3f0df

Contents?: true

Size: 964 Bytes

Versions: 65

Compression:

Stored size: 964 Bytes

Contents

# frozen_string_literal: true

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

module GoodJob
  #
  # Rails generator used for setting up GoodJob in a Rails application.
  # Run it with +bin/rails g good_job:install+ in your console.
  #
  class InstallGenerator < Rails::Generators::Base
    include ActiveRecord::Generators::Migration

    TEMPLATES = File.join(File.dirname(__FILE__), "templates/install")
    source_paths << TEMPLATES

    class_option :database, type: :string, aliases: %i(--db), desc: "The database for your migration. By default, the current environment's primary database is used."

    # Generates monolithic migration file that contains all database changes.
    def create_migration_file
      migration_template 'migrations/create_good_jobs.rb.erb', File.join(db_migrate_path, "create_good_jobs.rb")
    end

    private

    def migration_version
      "[#{ActiveRecord::VERSION::STRING.to_f}]"
    end
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
good_job-3.21.4 lib/generators/good_job/install_generator.rb
good_job-3.21.3 lib/generators/good_job/install_generator.rb
good_job-3.21.2 lib/generators/good_job/install_generator.rb
good_job-3.21.1 lib/generators/good_job/install_generator.rb
good_job-3.21.0 lib/generators/good_job/install_generator.rb
good_job-3.20.0 lib/generators/good_job/install_generator.rb
good_job-3.19.4 lib/generators/good_job/install_generator.rb
good_job-3.19.3 lib/generators/good_job/install_generator.rb
good_job-3.19.2 lib/generators/good_job/install_generator.rb
good_job-3.19.1 lib/generators/good_job/install_generator.rb
good_job-3.19.0 lib/generators/good_job/install_generator.rb
good_job-3.18.3 lib/generators/good_job/install_generator.rb
good_job-3.18.2 lib/generators/good_job/install_generator.rb
good_job-3.18.1 lib/generators/good_job/install_generator.rb
good_job-3.18.0 lib/generators/good_job/install_generator.rb
good_job-3.17.4 lib/generators/good_job/install_generator.rb
good_job-3.17.3 lib/generators/good_job/install_generator.rb
good_job-3.17.2 lib/generators/good_job/install_generator.rb
good_job-3.17.1 lib/generators/good_job/install_generator.rb
good_job-3.17.0 lib/generators/good_job/install_generator.rb