Sha256: 13cca71b550c3659bfba8239727fd5e16e91543fcb436767c4400ed23ea2755c

Contents?: true

Size: 1.23 KB

Versions: 10

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require 'rails/generators'

class TestAppGenerator < Rails::Generators::Base
  source_root File.expand_path('../../../test_app_templates', __dir__)

  def remove_index
    remove_file "public/index.html"
  end

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

    Bundler.with_unbundled_env do
      run "bundle install"
    end
    options = '--devise'
    if ENV['BLACKLIGHT_API_TEST'].present?
      options += ' --skip-assets'
    end

    generate 'blacklight:install', options
  end

  def run_test_support_generator
    say_status("warning", "GENERATING test_support", :yellow)

    generate 'blacklight:test_support'
  end

  def add_local_assets_for_propshaft
    return unless defined?(Propshaft)

    run "yarn add #{Blacklight::Engine.root}"
  end

  def add_component_template_override
    src_template = File.join(Blacklight::Engine.root, 'app', 'components', 'blacklight', 'top_navbar_component.html.erb')
    target_template = File.join('app', 'components', 'blacklight', 'top_navbar_component.html.erb')
    create_file(target_template) do
      File.read(src_template).gsub('role="navigation"', 'role="navigation" data-template-override="top_navbar_component"')
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
blacklight-8.2.2 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-8.2.1 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-8.2.0 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-8.1.0 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-8.0.1 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-8.0.0 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-8.0.0.beta8 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-8.0.0.beta7 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-8.0.0.beta6 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-8.0.0.beta5 spec/test_app_templates/lib/generators/test_app_generator.rb