Skip to content

Commit

Permalink
Move internal dependencies into the main Engine body
Browse files Browse the repository at this point in the history
This loads dependencies from `lib/hyrax` and dry-rb explictly from
Hyrax::Engine, instead of waiting until the initializer.

This is an alternate implementation to the one in
#3472
  • Loading branch information
Tom Johnson committed Jan 25, 2019
1 parent b5c6605 commit 06c92e2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/hyrax/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ module Hyrax
class Engine < ::Rails::Engine
isolate_namespace Hyrax

# These gems must be required outside of an initializer or they don't get loaded.
require 'awesome_nested_set'
require 'breadcrumbs_on_rails'
require 'dry/struct'
require 'dry/equalizer'
require 'dry/validation'
require 'jquery-ui-rails'
require 'flot-rails'
require 'almond-rails'
Expand All @@ -15,6 +17,11 @@ class Engine < ::Rails::Engine
require 'legato'
require 'pul_uv_rails'

require 'hydra/derivatives'
require 'hyrax/controller_resource'
require 'hyrax/search_state'
require 'hyrax/errors'

# Force these models to be added to Legato's registry in development mode
config.eager_load_paths += %W[
#{config.root}/app/models/hyrax/download.rb
Expand Down Expand Up @@ -62,14 +69,7 @@ class Engine < ::Rails::Engine
end

initializer 'requires' do
require 'hydra/derivatives'
require 'hyrax/controller_resource'
require 'hyrax/search_state'
require 'hyrax/errors'
require 'power_converters'
require 'dry/struct'
require 'dry/equalizer'
require 'dry/validation'
end

initializer 'routing' do
Expand Down

0 comments on commit 06c92e2

Please sign in to comment.