Sha256: 6010579912940c56e884d11017eda5f460855f683148b2578564fa6e3d585904

Contents?: true

Size: 703 Bytes

Versions: 5

Compression:

Stored size: 703 Bytes

Contents

# frozen_string_literal: true

require 'rails/generators/active_record'

module Monarchy
  class SetupGenerator < Rails::Generators::Base
    include Rails::Generators::Migration

    desc 'This generator setups Monarchy'
    source_root File.expand_path('../../templates', __FILE__)

    def setup_monarchy
      template 'config.rb', 'config/initializers/monarchy.rb'

      migration_template 'migrations/hierarchy.rb', 'db/migrate/monarchy_create_hierarchies.rb'
      migration_template 'migrations/membership.rb', 'db/migrate/monarchy_create_memberships.rb'
    end

    def self.next_migration_number(dirname)
      ActiveRecord::Generators::Base.next_migration_number(dirname)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
monarchy-2.4.0 lib/generators/monarchy/setup_generator.rb
monarchy-2.3.0 lib/generators/monarchy/setup_generator.rb
monarchy-2.2.2 lib/generators/monarchy/setup_generator.rb
monarchy-2.2.1 lib/generators/monarchy/setup_generator.rb
monarchy-2.2.0 lib/generators/monarchy/setup_generator.rb