lib/kithe.rb in kithe-1.0.0 vs lib/kithe.rb in kithe-1.1.0
- old
+ new
@@ -1,8 +1,20 @@
require "kithe/engine"
require 'kithe/indexable_settings'
+# For reasons we don't fully understand, yell is messing up the Rails6 zeitwerk
+# auto-loader in some cases, in our consuming app that uses kithe.
+# https://github.com/rudionrails/yell/issues/60
+#
+# Manually requiring yell here seems to avoid it. We believe switching yell to use
+# Module#prepend might also resolve.
+# https://github.com/rudionrails/yell/pull/61
+#
+# We don't actually use yell in kithe, it's just here via traject. If traject stops using yell,
+# we can stop require'ing it here, it's just a weird workaround.
+require 'yell'
+
module Kithe
# for ruby-progressbar
STANDARD_PROGRESS_BAR_FORMAT = "%a %t: |%B| %R/s %c/%u %p%% %e"
# ActiveRecord will automatically pick this up for all our models.
@@ -53,13 +65,14 @@
# * disable_callbacks: set to true to globally disable automatic after_commit
#
#
# The settings need to live here not in Kithe::Indexable, to avoid terrible
# Rails dev-mode class-reloading weirdnesses. This module is not reloaded.
- mattr_accessor :indexable_settings do
- # set up default settings
- IndexableSettings.new(
+ class << self
+ attr_accessor :indexable_settings
+ end
+ self.indexable_settings = IndexableSettings.new(
solr_url: "http://localhost:8983/solr/default",
model_name_solr_field: "model_name_ssi",
solr_id_value_attribute: "id",
writer_class_name: "Traject::SolrJsonWriter",
writer_settings: {
@@ -75,8 +88,15 @@
# MAYBE? no skippable exceptions please
# "solr_writer.skippable_exceptions" => []
},
disable_callbacks: false
)
-end
+
+ class << self
+ # Currently used by Kithe::AssetUploader, a bit of a hacky
+ # design, we should improve with better way to customize uploaders.
+ attr_accessor :use_mediainfo
+ end
+ # default to if we can find the CLI.
+ self.use_mediainfo = !`which mediainfo`.blank?
end