Skip to content

Commit

Permalink
add support for Rails 6, Hyrax 4, and Blacklight 7
Browse files Browse the repository at this point in the history
this makes no attempt to ensure UI-layer support for BL7 and whatever bootstrap
versions it requires (excepting whatever is tested by RSpec). the scope here is
simply to make it *possible* for a Hyrax 4 application to install and use
Bulkrax.
  • Loading branch information
tamsin johnson committed Apr 6, 2023
1 parent fd0d915 commit 445d79f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ gemspec
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.

gem 'blacklight', '~> 6.25.0'
gem 'blacklight'
gem 'bootstrap-sass', '~> 3.0'
gem 'coderay'
gem 'factory_bot_rails'
gem 'hyrax', '>= 2.3'
gem 'hyrax', '>= 2.3', '< 4.999'
gem 'oai'
gem 'rsolr', '>= 1.0'
gem 'rspec-rails'
Expand All @@ -28,6 +28,7 @@ group :development, :test do
gem 'database_cleaner'
gem 'pry-byebug'
gem 'solr_wrapper', '>= 0.3'
gem 'sqlite3', '~> 1.4'
end

group :lint do
Expand Down
2 changes: 1 addition & 1 deletion app/factories/bulkrax/object_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def search_by_identifier
def create
attrs = transform_attributes
@object = klass.new
object.reindex_extent = Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX if object.respond_to?(:reindex_extent)
object.reindex_extent = Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX if defined?(Hyrax::Adapters::NestingIndexAdapter) && object.respond_to?(:reindex_extent)
run_callbacks :save do
run_callbacks :create do
if klass == Collection
Expand Down
3 changes: 2 additions & 1 deletion app/jobs/bulkrax/create_relationships_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ def process(relationship:, importer_run_id:, parent_record:, ability:)
end

def add_to_collection(child_record, parent_record)
parent_record.try(:reindex_extent=, Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX)
parent_record.try(:reindex_extent=, Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX) if
defined?(Hyrax::Adapters::NestingIndexAdapter)
child_record.member_of_collections << parent_record
child_record.save!
end
Expand Down
3 changes: 2 additions & 1 deletion app/services/bulkrax/remove_relationships_for_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def break_relationships!
remove_relationships_from_work(obj)
end

obj.try(:reindex_extent=, Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX) if defined?(Hyrax)
obj.try(:reindex_extent=, Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX) if
defined?(Hyrax::Adapters::NestingIndexAdapter)
obj.save!
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/test_app/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class ApplicationController < ActionController::Base
include Blacklight::Controller
include Hyrax::ThemedLayoutController
with_themed_layout '1_column'
skip_after_action :discard_flash_if_xhr
skip_after_action :discard_flash_if_xhr if
Rails.version.split('.').first.to_i < 6
protect_from_forgery with: :exception

end
1 change: 0 additions & 1 deletion spec/test_app/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module TestApp
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1
config.active_record.sqlite3.represent_boolean_as_integer = true
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
Expand Down

0 comments on commit 445d79f

Please sign in to comment.