projectblacklight/blacklight

View on GitHub
lib/generators/blacklight/document_generator.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

require 'rails/generators'

module Blacklight
  class DocumentGenerator < Rails::Generators::Base
    include Rails::Generators::Migration

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

    argument :model_name, type: :string, default: "solr_document"

    desc <<-EOS
      This generator makes the following changes to your application:
       1. Creates a blacklight document in your /app/models directory
    EOS

    def create_solr_document
      template "solr_document.rb", "app/models/#{model_name}.rb"
    end
  end
end