Skip to content

Commit

Permalink
Merge pull request #4294 from samvera/valkyrie-indexing-no-gen
Browse files Browse the repository at this point in the history
remove the indexer initializer generator
  • Loading branch information
jeremyf authored May 6, 2020
2 parents 0dffbf8 + 48f7864 commit f63b1f1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
4 changes: 0 additions & 4 deletions lib/generators/hyrax/config_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ def create_initializer_config_file
copy_file 'config/initializers/hyrax.rb'
end

def create_initializer_indexers_file
copy_file 'config/initializers/indexers.rb'
end

# Add mini-magick configuration
def minimagick_config
copy_file 'config/initializers/mini_magick.rb'
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Generated via
# `rails generate hyrax:work_resource <%= class_name %>`
class <%= class_name %>Indexer < Hyrax::ValkyrieWorkIndexer
Hyrax::ValkyrieIndexer.register self, as_indexer_for: <%= class_name %>
include Hyrax::Indexer(:basic_metadata)

# Uncomment this block if you want to add custom indexing behavior:
# def to_solr
Expand Down
10 changes: 6 additions & 4 deletions lib/generators/hyrax/work_resource/work_resource_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ def create_indexer
end

def register_indexer
config = 'config/initializers/indexers.rb'
register_line = " Hyrax::ValkyrieIndexer.register #{class_name}Indexer, as_indexer_for: #{class_name}\n"
inject_into_file config, after: "# Register Indexers\n" do
return if File.read(config).include?(register_line)
config = 'config/initializers/hyrax.rb'
register_line = "Hyrax::ValkyrieIndexer.register #{class_name}Indexer, as_indexer_for: #{class_name}\n"

return if File.read(config).include?(register_line)

append_to_file config do
register_line
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/hyrax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
require 'hyrax/engine'
require 'hyrax/version'
require 'hyrax/inflections'
require 'hyrax/name'
require 'hyrax/valkyrie_can_can_adapter'
require 'kaminari_route_prefix'

Expand Down

0 comments on commit f63b1f1

Please sign in to comment.