Sha256: 74581396049e9e4dc5d42819b71ab6fb52b7b7f634ae2292cb4757d7100aec27

Contents?: true

Size: 1.12 KB

Versions: 50

Compression:

Stored size: 1.12 KB

Contents

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

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"
    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

50 entries across 50 versions & 1 rubygems

Version Path
blacklight-6.25.0 lib/generators/blacklight/models_generator.rb
blacklight-6.24.0 lib/generators/blacklight/models_generator.rb
blacklight-7.10.0 lib/generators/blacklight/models_generator.rb
blacklight-7.9.0 lib/generators/blacklight/models_generator.rb
blacklight-7.8.1 lib/generators/blacklight/models_generator.rb
blacklight-7.8.0 lib/generators/blacklight/models_generator.rb
blacklight-6.23.0 lib/generators/blacklight/models_generator.rb
blacklight-7.7.0 lib/generators/blacklight/models_generator.rb
blacklight-7.6.0 lib/generators/blacklight/models_generator.rb
blacklight-7.5.1 lib/generators/blacklight/models_generator.rb
blacklight-6.22.0 lib/generators/blacklight/models_generator.rb
blacklight-7.5.0 lib/generators/blacklight/models_generator.rb
blacklight-7.4.2 lib/generators/blacklight/models_generator.rb
blacklight-7.4.1 lib/generators/blacklight/models_generator.rb
blacklight-6.21.0 lib/generators/blacklight/models_generator.rb
blacklight-7.4.0 lib/generators/blacklight/models_generator.rb
blacklight-7.3.0 lib/generators/blacklight/models_generator.rb
blacklight-7.2.0 lib/generators/blacklight/models_generator.rb
blacklight-7.1.0 lib/generators/blacklight/models_generator.rb
blacklight-7.1.0.alpha lib/generators/blacklight/models_generator.rb