Sha256: 399ff8ebb087e274e11dbace7343c5544a97e69a8fb5a6a9bcc0d393a4f0a790

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 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('aria-label', 'data-template-override="top_navbar_component" aria-label')
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blacklight-8.6.1 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-8.6.0 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-8.5.1 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-8.5.0 spec/test_app_templates/lib/generators/test_app_generator.rb
blacklight-8.4.0 spec/test_app_templates/lib/generators/test_app_generator.rb