Sha256: 10e74bc166ef0b78bbe921bc16ac5040b5ce18caa728e61f6425ee2b398aaf3b

Contents?: true

Size: 956 Bytes

Versions: 14

Compression:

Stored size: 956 Bytes

Contents

# frozen_string_literal: true

require "rails/generators"
require "rails/generators/active_record"

module Gouda
  # Rails generator used for setting up Gouda in a Rails application.
  # Run it with +bin/rails g gouda: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_gouda_tables.rb.erb", File.join(db_migrate_path, "create_gouda_tables.rb")
    end

    private

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
gouda-0.1.14 lib/generators/gouda/install_generator.rb
gouda-0.1.13 lib/generators/gouda/install_generator.rb
gouda-0.1.12 lib/generators/gouda/install_generator.rb
gouda-0.1.11 lib/generators/gouda/install_generator.rb
gouda-0.1.10 lib/generators/gouda/install_generator.rb
gouda-0.1.9 lib/generators/gouda/install_generator.rb
gouda-0.1.8 lib/generators/gouda/install_generator.rb
gouda-0.1.7 lib/generators/gouda/install_generator.rb
gouda-0.1.5 lib/generators/gouda/install_generator.rb
gouda-0.1.4 lib/generators/gouda/install_generator.rb
gouda-0.1.3 lib/generators/gouda/install_generator.rb
gouda-0.1.2 lib/generators/gouda/install_generator.rb
gouda-0.1.1 lib/generators/gouda/install_generator.rb
gouda-0.1.0 lib/generators/gouda/install_generator.rb