Skip to content

Commit

Permalink
Consolidating generators
Browse files Browse the repository at this point in the history
Prior to this commit, we had two generators touching the same file, with
each generator doing one small thing.

With this commit, I've consolidated some of the logic into a single
generator.

Closes #121
  • Loading branch information
jeremyf committed Feb 13, 2023
1 parent ea97692 commit 6cf34ac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 31 deletions.
25 changes: 0 additions & 25 deletions lib/generators/iiif_print/blacklight_iiif_search_generator.rb

This file was deleted.

15 changes: 13 additions & 2 deletions lib/generators/iiif_print/catalog_controller_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

module IiifPrint
class CatalogControllerGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)

desc "
This generator makes the following changes to your app:
1. Adds index fields in CatalogController
2. Adjusts Blacklight IIIF Search configuration settings in CatalogController
"

def add_index_fields_to_catalog_controller
Expand All @@ -17,5 +16,17 @@ def add_index_fields_to_catalog_controller
" config.add_index_field 'all_text_tsimv', highlight: true, helper_method: :render_ocr_snippets\n"
end
end

def adjust_catalog_controller_all_text_config
gsub_file('app/controllers/catalog_controller.rb',
" full_text_field: 'text',",
" full_text_field: 'all_text_tsimv',")
end

def adjust_catalog_controller_is_page_of_config
gsub_file('app/controllers/catalog_controller.rb',
" object_relation_field: 'is_page_of_s',",
" object_relation_field: 'is_page_of_ssim',")
end
end
end
4 changes: 0 additions & 4 deletions lib/generators/iiif_print/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ def verify_biiif_installed
generate 'blacklight_iiif_search:install'
end

def iiif_configuration
generate 'iiif_print:blacklight_iiif_search'
end

def catalog_controller_configuration
generate 'iiif_print:catalog_controller'
end
Expand Down

0 comments on commit 6cf34ac

Please sign in to comment.