Sha256: 4c71740b798d7b124f394033f0a38ed08632c5bf00e2a3a1c180a50adcc437cf

Contents?: true

Size: 802 Bytes

Versions: 5

Compression:

Stored size: 802 Bytes

Contents

module Trestle
  module Auth
    module Otp
      module Generators
        class AdminGenerator < ::Rails::Generators::Base
          desc "Creates a Trestle admin for managing Administrators"

          argument :model, type: :string, default: "Administrator"

          class_option :devise, type: :boolean, default: false, desc: "Create admin for a Devise user model"

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

          def create_admin
            template "admin.rb.erb", File.join('app/admin/auth', "#{model.underscore.pluralize}_admin.rb")
          end

          def devise?
            options[:devise]
          end

        protected
          def plural_name
            model.demodulize.underscore.pluralize
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trestle-auth-otp-0.2.2 lib/generators/trestle/auth/otp/admin/admin_generator.rb
trestle-auth-otp-0.2.1 lib/generators/trestle/auth/otp/admin/admin_generator.rb
trestle-auth-otp-0.2.0 lib/generators/trestle/auth/otp/admin/admin_generator.rb
trestle-auth-otp-0.1.1 lib/generators/trestle/auth/otp/admin/admin_generator.rb
trestle-auth-otp-0.1.0 lib/generators/trestle/auth/otp/admin/admin_generator.rb