Sha256: 4631472eb29a1c04899f2e4242b01ee0c874d559c8bddb18bc9aa25e4d86fdae

Contents?: true

Size: 1.52 KB

Versions: 18

Compression:

Stored size: 1.52 KB

Contents

require 'rails/generators'

class TestAppGenerator < Rails::Generators::Base
  source_root '../spec/test_app_templates'

  def add_gems
    gem 'blacklight', '~> 6.0'
    gem 'blacklight-gallery', '>= 0.3.0'
    Bundler.with_clean_env do
      run 'bundle install'
    end
  end

  def run_blacklight_generator
    say_status('warning', 'GENERATING BL', :yellow)

    generate 'blacklight:install', '--devise'
  end

  def run_spotlight_migrations
    rake 'spotlight:install:migrations'
    rake 'db:migrate'
  end

  def add_spotlight_routes_and_assets
    generate 'spotlight:install', '-f --mailer_default_url_host=localhost:3000'
  end

  def install_test_catalog_controller
    copy_file 'catalog_controller.rb', 'app/controllers/catalog_controller.rb', force: true
  end

  def add_rake_tasks_to_app
    rakefile 'spotlight_test.rake', File.read(find_in_source_paths('spotlight_test.rake'))
  end

  def disable_carrierwave_processing
    copy_file 'carrierwave.rb', 'config/initializers/carrierwave.rb'
  end

  def disable_filter_resources_by_exhibit
    initializer 'disable_filter_resources_by_exhibit.rb' do
      <<-EOF
      # Setting this to false when running tests so that we don't have to set up
      # exhibit specific solr documents for tests that don't use the default exhibit.
      Spotlight::Engine.config.filter_resources_by_exhibit = false
EOF
    end
  end

  def disable_papertrail_associations
    initializer 'paper_trail.rb' do
      <<-EOF
        PaperTrail.config.track_associations = false
      EOF
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
blacklight-spotlight-0.28.3 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.28.2 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.28.1 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.28.0 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.27.0 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.26.1 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.26.0 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.25.0 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.24.0 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.23.0 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.22.0 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.21.0 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.20.3 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.20.2 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.20.1 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.20.0 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.19.2 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-spotlight-0.19.1 spec/test_app_templates/lib/generators/test_app_generator.rb