Sha256: 204f96a1767a4196dc4501576689b03258817a05cbdd4baf68fac563739facee

Contents?: true

Size: 1.22 KB

Versions: 56

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/migration'
require 'blacklight/version'

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

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

    desc <<-EOS
    This generator makes the following changes to your application:
     1. Creates several database migrations if they do not exist in /db/migrate
     2. Creates config/blacklight.yml with a default configuration
    EOS

    # Copy all files in templates/config directory to host config
    def create_configuration_files
      copy_file "config/blacklight.yml", "config/blacklight.yml"
      gsub_file 'config/blacklight.yml', '__VERSION__', Blacklight::VERSION
    end

    # Setup the database migrations
    def copy_migrations
      rake "blacklight:install:migrations"
    end

    def add_routes
      route <<-EOF

  concern :exportable, Blacklight::Routes::Exportable.new

  resources :solr_documents, only: [:show], path: '/catalog', controller: 'catalog' do
    concerns :exportable
  end

  resources :bookmarks do
    concerns :exportable

    collection do
      delete 'clear'
    end
  end
      EOF
    end
  end
end

Version data entries

56 entries across 56 versions & 2 rubygems

Version Path
blacklight-7.40.0 lib/generators/blacklight/models_generator.rb
blacklight-7.39.0 lib/generators/blacklight/models_generator.rb
blacklight-7.38.0 lib/generators/blacklight/models_generator.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/lib/generators/blacklight/models_generator.rb
blacklight-7.37.0 lib/generators/blacklight/models_generator.rb
blacklight-7.36.2 lib/generators/blacklight/models_generator.rb
blacklight-7.36.1 lib/generators/blacklight/models_generator.rb
blacklight-7.36.0 lib/generators/blacklight/models_generator.rb
blacklight-7.35.0 lib/generators/blacklight/models_generator.rb
blacklight-7.34.0 lib/generators/blacklight/models_generator.rb
blacklight-7.33.1 lib/generators/blacklight/models_generator.rb
blacklight-7.33.0 lib/generators/blacklight/models_generator.rb
blacklight-7.32.0 lib/generators/blacklight/models_generator.rb
blacklight-7.31.0 lib/generators/blacklight/models_generator.rb
blacklight-7.30.0 lib/generators/blacklight/models_generator.rb
blacklight-7.29.0 lib/generators/blacklight/models_generator.rb
blacklight-7.28.0 lib/generators/blacklight/models_generator.rb
blacklight-7.27.1 lib/generators/blacklight/models_generator.rb
blacklight-7.27.0 lib/generators/blacklight/models_generator.rb
blacklight-7.26.1 lib/generators/blacklight/models_generator.rb