Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable setting blacklight-version #3022

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ jobs:
ruby: "3.2"
blacklight_version: "~> 7.34"
bootstrap_version: ~> 4.0
additional_name: Rails 6.1
additional_name: Rails 7.1
- rails_version: 7.1.3.4
ruby: 3.3
blacklight_version: ~> 8.0
bootstrap_version: ~> 4.0
additional_name: Blacklight 8
- rails_version: 7.0.8.4
ruby: 3.3
blacklight_version: ~> 7.34
Expand Down
6 changes: 5 additions & 1 deletion app/views/layouts/spotlight/base.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
<% else %>
<%= stylesheet_link_tag "application" %>
<% end %>
<%= javascript_include_tag "application" %>
<% if defined? Importmap %>
<%= javascript_importmap_tags %>
<% else %>
<%= javascript_include_tag "application" %>
<% end %>
<%= csrf_meta_tags %>
<%= content_for(:head) %>
<%= description %>
Expand Down
16 changes: 13 additions & 3 deletions lib/generators/spotlight/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,21 @@ def add_js_rails6
end

def add_manifest
append_to_file 'app/assets/javascripts/application.js', "\n//= require_tree .\n"
append_to_file 'app/assets/config/manifest.js', "\n//= link spotlight/manifest.js"

# Rails installed importmap by default, but we don't have importmap + Blacklight 7 working yet.
remove_file 'app/javascript/application.js'
# Blacklight 8 does not use this directory by default.
if File.exist?('app/assets/javascripts')
append_to_file 'app/assets/javascripts/application.js', "\n//= require_tree .\n"
# Rails installed importmap by default, but we don't have importmap + Blacklight 7 working yet.
remove_file 'app/javascript/application.js'
else
# install via importmap
append_to_file 'app/javascript/application.js' do
<<~CONTENT
import Spotlight from "spotlight.esm"
CONTENT
end
end
end

def inject_spotlight_routes
Expand Down
7 changes: 6 additions & 1 deletion spec/test_app_templates/Gemfile.extra
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
if ENV['BLACKLIGHT_VERSION'] == 'edge'
case ENV['BLACKLIGHT_VERSION']
when 'edge'
gem 'blacklight', github: 'projectblacklight/blacklight'
gem 'blacklight-gallery', github: 'projectblacklight/blacklight-gallery'
gem 'blacklight-oembed', github: 'projectblacklight/blacklight-oembed'
when 'latest'
gem 'blacklight'
else
gem 'blacklight', ENV['BLACKLIGHT_VERSION'] if ENV['BLACKLIGHT_VERSION'] && !ENV['BLACKLIGHT_VERSION'].empty?
end
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def run_spotlight_migrations

def add_spotlight_routes_and_assets
generate :'spotlight:install', '-f --mailer_default_url_host=localhost:3000'
append_to_file 'app/assets/config/manifest.js', "\n//= link application.js\n" if Rails.version > '7' && File.exist?('app/assets/config/manifest.js')
end

def install_test_catalog_controller
Expand Down
Loading