Sha256: 4960fb22fbe409eef57cb0457111f7416ce1fd663bfdfec3062cf0c4c4c83e13

Contents?: true

Size: 913 Bytes

Versions: 3

Compression:

Stored size: 913 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")
      migration_template "add_headers_to_munster_webhooks.rb.erb", File.join(db_migrate_path, "add_headers_to_munster_webhooks.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

3 entries across 3 versions & 1 rubygems

Version Path
munster-0.4.2 lib/munster/install_generator.rb
munster-0.4.1 lib/munster/install_generator.rb
munster-0.4.0 lib/munster/install_generator.rb