Sha256: 7c7f8580d97e5ba32115366ce1ddf7cba8fd25896bd97a15414d86db4cd077d7

Contents?: true

Size: 781 Bytes

Versions: 4

Compression:

Stored size: 781 Bytes

Contents

# frozen_string_literal: true

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

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

    source_root File.expand_path("../templates", __FILE__)

    def create_migration_file
      migration_template "create_munster_tables.rb.erb", File.join(db_migrate_path, "create_munster_tables.rb")
    end

    def copy_files
      template "munster.rb", File.join("config", "initializers", "munster.rb")
    end

    private

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
munster-0.3.1 lib/munster/install_generator.rb
munster-0.3.0 lib/munster/install_generator.rb
munster-0.2.0 lib/munster/install_generator.rb
munster-0.1.0 lib/munster/install_generator.rb