Class: Hyrax::Configuration
- Inherits:
-
Object
- Object
- Hyrax::Configuration
- Includes:
- Callbacks
- Defined in:
- lib/hyrax/configuration.rb
Instance Attribute Summary collapse
-
#active_deposit_agreement_acceptance ⇒ Object
writeonly
Sets the attribute active_deposit_agreement_acceptance.
- #activity_to_show_default_seconds_since_now ⇒ Object
-
#always_display_share_button ⇒ Object
writeonly
Should a button with “Share my work” show on the front page to all users (even those not logged in)?.
-
#analytic_start_date ⇒ Object
Returns the value of attribute analytic_start_date.
-
#analytics ⇒ Object
Sets the attribute analytics.
-
#arkivo_api ⇒ Object
writeonly
Sets the attribute arkivo_api.
- #audit_user_key ⇒ Object
- #banner_image ⇒ Object
- #batch_user_key ⇒ Object
- #binaries_directory ⇒ Object
-
#browse_everything ⇒ Object
writeonly
Sets the attribute browse_everything.
- #cache_path ⇒ Object
-
#characterization_runner ⇒ Object
Override characterization runner.
-
#citations ⇒ Object
writeonly
Sets the attribute citations.
- #contact_email ⇒ Object
-
#dashboard_configuration ⇒ Object
rubocop:disable Metrics/MethodLength.
-
#default_active_workflow_name ⇒ String
When an admin set is created, we need to activate a workflow.
- #derivatives_path ⇒ Object
- #descriptions_directory ⇒ Object
-
#display_media_download_link ⇒ Object
writeonly
Sets the attribute display_media_download_link.
-
#display_microdata ⇒ Object
writeonly
Sets the attribute display_microdata.
- #enable_ffmpeg ⇒ Object
-
#enable_local_ingest ⇒ Object
Returns the value of attribute enable_local_ingest.
-
#enable_noids ⇒ Object
writeonly
Sets the attribute enable_noids.
-
#extract_full_text ⇒ Object
writeonly
Sets the attribute extract_full_text.
- #feature_config_path ⇒ Object
- #ffmpeg_path ⇒ Object
- #fits_message_length ⇒ Object
- #fits_path ⇒ Object
- #google_analytics_id ⇒ Object (also: #google_analytics_id?)
- #import_export_jar_file_path ⇒ Object
- #ingest_queue_name ⇒ Object
- #libreoffice_path ⇒ Object
- #license_service_class ⇒ Object
- #lock_retry_count ⇒ Object
- #lock_retry_delay ⇒ Object
- #lock_time_to_live ⇒ Object
- #max_days_between_audits ⇒ Object
- #max_notifications_for_dashboard ⇒ Object
- #microdata_default_type ⇒ Object
- #minter_statefile ⇒ Object
-
#model_to_create ⇒ Object
Returns a lambda that takes a hash of attributes and returns a string of the model name.
- #noid_minter_class ⇒ Object
- #noid_template ⇒ Object
- #owner_permission_levels ⇒ Object
- #permission_levels ⇒ Object
- #persistent_hostpath ⇒ Object
- #redis_namespace ⇒ Object
- #subject_prefix ⇒ Object
-
#temp_file_base ⇒ Object
Returns the value of attribute temp_file_base.
- #translate_id_to_uri ⇒ Object
- #translate_uri_to_id ⇒ Object
- #upload_path ⇒ Object
- #whitelisted_ingest_dirs ⇒ Object
-
#work_requires_files ⇒ Object
writeonly
Sets the attribute work_requires_files.
- #working_path ⇒ Object
Instance Method Summary collapse
- #active_deposit_agreement_acceptance? ⇒ Boolean (also: #active_deposit_agreement_acceptance)
- #always_display_share_button? ⇒ Boolean (also: #always_display_share_button)
- #analytics? ⇒ Boolean (also: #analytics)
- #arkivo_api? ⇒ Boolean (also: #arkivo_api)
- #browse_everything? ⇒ Boolean (also: #browse_everything)
- #citations? ⇒ Boolean (also: #citations)
-
#curation_concerns ⇒ Array<Class>
The registered curation concerns.
- #display_media_download_link? ⇒ Boolean (also: #display_media_download_link)
- #display_microdata? ⇒ Boolean (also: #display_microdata)
- #enable_noids? ⇒ Boolean (also: #enable_noids)
- #extract_full_text? ⇒ Boolean
- #geonames_username=(username) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#register_curation_concern(*curation_concern_types) ⇒ Object
Registers the given curation concern model in the configuration.
-
#register_roles {|Hyrax::RoleRegistry| ... } ⇒ TrueClass
Exposes a means to register application critical roles.
-
#registered_curation_concern_types ⇒ Array<String>
The normalization done by this method must occur after the initialization process so it can take advantage of irregular inflections from config/initializers/inflections.rb.
- #work_requires_files? ⇒ Boolean (also: #work_requires_files)
Methods included from Callbacks
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 11 12 |
# File 'lib/hyrax/configuration.rb', line 8 def initialize @registered_concerns = [] @role_registry = Hyrax::RoleRegistry.new @default_active_workflow_name = DEFAULT_ACTIVE_WORKFLOW_NAME end |
Instance Attribute Details
#active_deposit_agreement_acceptance=(value) ⇒ Object (writeonly)
Sets the attribute active_deposit_agreement_acceptance
343 344 345 |
# File 'lib/hyrax/configuration.rb', line 343 def active_deposit_agreement_acceptance=(value) @active_deposit_agreement_acceptance = value end |
#activity_to_show_default_seconds_since_now ⇒ Object
328 329 330 |
# File 'lib/hyrax/configuration.rb', line 328 def activity_to_show_default_seconds_since_now @activity_to_show_default_seconds_since_now ||= 24 * 60 * 60 end |
#always_display_share_button=(value) ⇒ Object (writeonly)
Should a button with “Share my work” show on the front page to all users (even those not logged in)?
381 382 383 |
# File 'lib/hyrax/configuration.rb', line 381 def (value) @always_display_share_button = value end |
#analytic_start_date ⇒ Object
Returns the value of attribute analytic_start_date.
82 83 84 |
# File 'lib/hyrax/configuration.rb', line 82 def analytic_start_date @analytic_start_date end |
#analytics=(value) ⇒ Object
Sets the attribute analytics
82 83 84 |
# File 'lib/hyrax/configuration.rb', line 82 def analytics=(value) @analytics = value end |
#arkivo_api=(value) ⇒ Object (writeonly)
Sets the attribute arkivo_api
332 333 334 |
# File 'lib/hyrax/configuration.rb', line 332 def arkivo_api=(value) @arkivo_api = value end |
#audit_user_key ⇒ Object
365 366 367 |
# File 'lib/hyrax/configuration.rb', line 365 def audit_user_key @audit_user_key ||= '[email protected]' end |
#banner_image ⇒ Object
282 283 284 |
# File 'lib/hyrax/configuration.rb', line 282 def @banner_image ||= "https://cloud.githubusercontent.com/assets/92044/18370978/88ecac20-75f6-11e6-8399-6536640ef695.jpg" end |
#batch_user_key ⇒ Object
360 361 362 |
# File 'lib/hyrax/configuration.rb', line 360 def batch_user_key @batch_user_key ||= '[email protected]' end |
#binaries_directory ⇒ Object
188 189 190 |
# File 'lib/hyrax/configuration.rb', line 188 def binaries_directory @binaries_directory ||= "tmp/binaries" end |
#browse_everything=(value) ⇒ Object (writeonly)
Sets the attribute browse_everything
301 302 303 |
# File 'lib/hyrax/configuration.rb', line 301 def browse_everything=(value) @browse_everything = value end |
#cache_path ⇒ Object
376 377 378 |
# File 'lib/hyrax/configuration.rb', line 376 def cache_path @cache_path ||= ->() { Rails.root + 'tmp' + 'uploads' + 'cache' } end |
#characterization_runner ⇒ Object
Override characterization runner
140 141 142 |
# File 'lib/hyrax/configuration.rb', line 140 def characterization_runner @characterization_runner end |
#citations=(value) ⇒ Object (writeonly)
Sets the attribute citations
315 316 317 |
# File 'lib/hyrax/configuration.rb', line 315 def citations=(value) @citations = value end |
#contact_email ⇒ Object
422 423 424 |
# File 'lib/hyrax/configuration.rb', line 422 def contact_email @contact_email ||= "[email protected]" end |
#dashboard_configuration ⇒ Object
rubocop:disable Metrics/MethodLength
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/hyrax/configuration.rb', line 196 def dashboard_configuration @dashboard_configuration ||= { menu: { index: {}, resource_details: {}, workflow: {}, workflow_roles: {} }, actions: { index: { partials: [ "total_objects_charts", "total_embargo_visibility" ] }, resource_details: { partials: [ "total_objects" ] }, workflow: { partials: [ "workflow" ] } }, data_sources: { resource_stats: Hyrax::ResourceStatisticsSource } } end |
#default_active_workflow_name ⇒ String
The active workflow for an admin set can be changed at a later point.
Changing this value after other AdminSet(s) are created does not alter the already created AdminSet(s)
When an admin set is created, we need to activate a workflow. The :default_active_workflow_name is the name of the workflow we will activate.
26 27 28 |
# File 'lib/hyrax/configuration.rb', line 26 def default_active_workflow_name @default_active_workflow_name end |
#derivatives_path ⇒ Object
51 52 53 |
# File 'lib/hyrax/configuration.rb', line 51 def derivatives_path @derivatives_path ||= Rails.root.join('tmp', 'derivatives') end |
#descriptions_directory ⇒ Object
181 182 183 |
# File 'lib/hyrax/configuration.rb', line 181 def descriptions_directory @descriptions_directory ||= "tmp/descriptions" end |
#display_media_download_link=(value) ⇒ Object (writeonly)
Sets the attribute display_media_download_link
126 127 128 |
# File 'lib/hyrax/configuration.rb', line 126 def display_media_download_link=(value) @display_media_download_link = value end |
#display_microdata=(value) ⇒ Object (writeonly)
Sets the attribute display_microdata
85 86 87 |
# File 'lib/hyrax/configuration.rb', line 85 def display_microdata=(value) @display_microdata = value end |
#enable_ffmpeg ⇒ Object
62 63 64 65 |
# File 'lib/hyrax/configuration.rb', line 62 def enable_ffmpeg return @enable_ffmpeg unless @enable_ffmpeg.nil? @enable_ffmpeg = false end |
#enable_local_ingest ⇒ Object
Returns the value of attribute enable_local_ingest.
82 83 84 |
# File 'lib/hyrax/configuration.rb', line 82 def enable_local_ingest @enable_local_ingest end |
#enable_noids=(value) ⇒ Object (writeonly)
Sets the attribute enable_noids
103 104 105 |
# File 'lib/hyrax/configuration.rb', line 103 def enable_noids=(value) @enable_noids = value end |
#extract_full_text=(value) ⇒ Object (writeonly)
Sets the attribute extract_full_text
431 432 433 |
# File 'lib/hyrax/configuration.rb', line 431 def extract_full_text=(value) @extract_full_text = value end |
#feature_config_path ⇒ Object
78 79 80 |
# File 'lib/hyrax/configuration.rb', line 78 def feature_config_path @feature_config_path ||= Rails.root.join('config', 'features.yml') end |
#ffmpeg_path ⇒ Object
68 69 70 |
# File 'lib/hyrax/configuration.rb', line 68 def ffmpeg_path @ffmpeg_path ||= 'ffmpeg' end |
#fits_message_length ⇒ Object
73 74 75 |
# File 'lib/hyrax/configuration.rb', line 73 def @fits_message_length ||= 5 end |
#fits_path ⇒ Object
135 136 137 |
# File 'lib/hyrax/configuration.rb', line 135 def fits_path @fits_path ||= 'fits.sh' end |
#google_analytics_id ⇒ Object Also known as: google_analytics_id?
390 391 392 |
# File 'lib/hyrax/configuration.rb', line 390 def google_analytics_id @google_analytics_id ||= nil end |
#import_export_jar_file_path ⇒ Object
174 175 176 |
# File 'lib/hyrax/configuration.rb', line 174 def import_export_jar_file_path @import_export_jar_file_path ||= "tmp/fcrepo-import-export.jar" end |
#ingest_queue_name ⇒ Object
167 168 169 |
# File 'lib/hyrax/configuration.rb', line 167 def ingest_queue_name @ingest_queue_name ||= :default end |
#libreoffice_path ⇒ Object
297 298 299 |
# File 'lib/hyrax/configuration.rb', line 297 def libreoffice_path @libreoffice_path ||= "soffice" end |
#license_service_class ⇒ Object
277 278 279 |
# File 'lib/hyrax/configuration.rb', line 277 def license_service_class @license_service_class ||= Hyrax::LicenseService end |
#lock_retry_count ⇒ Object
146 147 148 |
# File 'lib/hyrax/configuration.rb', line 146 def lock_retry_count @lock_retry_count ||= 600 # Up to 2 minutes of trying at intervals up to 200ms end |
#lock_retry_delay ⇒ Object
160 161 162 |
# File 'lib/hyrax/configuration.rb', line 160 def lock_retry_delay @lock_retry_delay ||= 200 # milliseconds end |
#lock_time_to_live ⇒ Object
153 154 155 |
# File 'lib/hyrax/configuration.rb', line 153 def lock_time_to_live @lock_time_to_live ||= 60_000 # milliseconds end |
#max_days_between_audits ⇒ Object
99 100 101 |
# File 'lib/hyrax/configuration.rb', line 99 def max_days_between_audits @max_days_between_audits ||= 7 end |
#max_notifications_for_dashboard ⇒ Object
323 324 325 |
# File 'lib/hyrax/configuration.rb', line 323 def max_notifications_for_dashboard @max_notifications_for_dashboard ||= 5 end |
#microdata_default_type ⇒ Object
94 95 96 |
# File 'lib/hyrax/configuration.rb', line 94 def microdata_default_type @microdata_default_type ||= 'http://schema.org/CreativeWork' end |
#minter_statefile ⇒ Object
122 123 124 |
# File 'lib/hyrax/configuration.rb', line 122 def minter_statefile @minter_statefile ||= '/tmp/minter-state' end |
#model_to_create ⇒ Object
Returns a lambda that takes a hash of attributes and returns a string of the model name. This is called by the batch upload process
440 441 442 |
# File 'lib/hyrax/configuration.rb', line 440 def model_to_create @model_to_create ||= ->(_attributes) { Hyrax.primary_work_type.model_name.name } end |
#noid_minter_class ⇒ Object
117 118 119 |
# File 'lib/hyrax/configuration.rb', line 117 def noid_minter_class @noid_minter_class ||= ActiveFedora::Noid::Minter::Db end |
#noid_template ⇒ Object
112 113 114 |
# File 'lib/hyrax/configuration.rb', line 112 def noid_template @noid_template ||= '.reeddeeddk' end |
#owner_permission_levels ⇒ Object
407 408 409 |
# File 'lib/hyrax/configuration.rb', line 407 def @owner_permission_levels ||= { "Edit Access" => "edit" } end |
#permission_levels ⇒ Object
400 401 402 403 404 |
# File 'lib/hyrax/configuration.rb', line 400 def @permission_levels ||= { "Choose Access" => "none", "View/Download" => "read", "Edit" => "edit" } end |
#persistent_hostpath ⇒ Object
287 288 289 |
# File 'lib/hyrax/configuration.rb', line 287 def persistent_hostpath @persistent_hostpath ||= "http://localhost/files/" end |
#redis_namespace ⇒ Object
292 293 294 |
# File 'lib/hyrax/configuration.rb', line 292 def redis_namespace @redis_namespace ||= "hyrax" end |
#subject_prefix ⇒ Object
427 428 429 |
# File 'lib/hyrax/configuration.rb', line 427 def subject_prefix @subject_prefix ||= "Contact form:" end |
#temp_file_base ⇒ Object
Returns the value of attribute temp_file_base.
82 83 84 |
# File 'lib/hyrax/configuration.rb', line 82 def temp_file_base @temp_file_base end |
#translate_id_to_uri ⇒ Object
417 418 419 |
# File 'lib/hyrax/configuration.rb', line 417 def translate_id_to_uri @translate_id_to_uri ||= ActiveFedora::Noid.config.translate_id_to_uri end |
#translate_uri_to_id ⇒ Object
412 413 414 |
# File 'lib/hyrax/configuration.rb', line 412 def translate_uri_to_id @translate_uri_to_id ||= ActiveFedora::Noid.config.translate_uri_to_id end |
#upload_path ⇒ Object
371 372 373 |
# File 'lib/hyrax/configuration.rb', line 371 def upload_path @upload_path ||= ->() { Rails.root + 'tmp' + 'uploads' } end |
#whitelisted_ingest_dirs ⇒ Object
232 233 234 235 236 237 238 239 |
# File 'lib/hyrax/configuration.rb', line 232 def whitelisted_ingest_dirs @whitelisted_ingest_dirs ||= \ if defined? BrowseEverything Array.wrap(BrowseEverything.config['file_system'].try(:[], :home)).compact else [] end end |
#work_requires_files=(value) ⇒ Object (writeonly)
Sets the attribute work_requires_files
351 352 353 |
# File 'lib/hyrax/configuration.rb', line 351 def work_requires_files=(value) @work_requires_files = value end |
#working_path ⇒ Object
57 58 59 |
# File 'lib/hyrax/configuration.rb', line 57 def working_path @working_path ||= Rails.root.join('tmp', 'uploads') end |
Instance Method Details
#active_deposit_agreement_acceptance? ⇒ Boolean Also known as: active_deposit_agreement_acceptance
344 345 346 347 |
# File 'lib/hyrax/configuration.rb', line 344 def active_deposit_agreement_acceptance? return true if @active_deposit_agreement_acceptance.nil? @active_deposit_agreement_acceptance end |
#always_display_share_button? ⇒ Boolean Also known as:
382 383 384 385 |
# File 'lib/hyrax/configuration.rb', line 382 def return true if @always_display_share_button.nil? @always_display_share_button end |
#analytics? ⇒ Boolean Also known as: analytics
309 310 311 |
# File 'lib/hyrax/configuration.rb', line 309 def analytics? @analytics ||= false end |
#arkivo_api? ⇒ Boolean Also known as: arkivo_api
333 334 335 |
# File 'lib/hyrax/configuration.rb', line 333 def arkivo_api? @arkivo_api ||= false end |
#browse_everything? ⇒ Boolean Also known as: browse_everything
302 303 304 |
# File 'lib/hyrax/configuration.rb', line 302 def browse_everything? @browse_everything ||= nil end |
#citations? ⇒ Boolean Also known as: citations
316 317 318 |
# File 'lib/hyrax/configuration.rb', line 316 def citations? @citations ||= false end |
#curation_concerns ⇒ Array<Class>
Returns the registered curation concerns.
266 267 268 |
# File 'lib/hyrax/configuration.rb', line 266 def curation_concerns registered_curation_concern_types.map(&:constantize) end |
#display_media_download_link? ⇒ Boolean Also known as: display_media_download_link
127 128 129 130 |
# File 'lib/hyrax/configuration.rb', line 127 def display_media_download_link? return @display_media_download_link unless @display_media_download_link.nil? @display_media_download_link = true end |
#display_microdata? ⇒ Boolean Also known as: display_microdata
86 87 88 89 |
# File 'lib/hyrax/configuration.rb', line 86 def display_microdata? return @display_microdata unless @display_microdata.nil? @display_microdata = true end |
#enable_noids? ⇒ Boolean Also known as: enable_noids
104 105 106 107 |
# File 'lib/hyrax/configuration.rb', line 104 def enable_noids? return @enable_noids unless @enable_noids.nil? @enable_noids = true end |
#extract_full_text? ⇒ Boolean
432 433 434 435 |
# File 'lib/hyrax/configuration.rb', line 432 def extract_full_text? return @extract_full_text unless @extract_full_text.nil? @extract_full_text = true end |
#geonames_username=(username) ⇒ Object
339 340 341 |
# File 'lib/hyrax/configuration.rb', line 339 def geonames_username=(username) Qa::Authorities::Geonames.username = username end |
#register_curation_concern(*curation_concern_types) ⇒ Object
Registers the given curation concern model in the configuration
250 251 252 253 254 255 256 |
# File 'lib/hyrax/configuration.rb', line 250 def register_curation_concern(*curation_concern_types) Array.wrap(curation_concern_types).flatten.compact.each do |cc_type| unless @registered_concerns.include?(cc_type) @registered_concerns << cc_type end end end |
#register_roles {|Hyrax::RoleRegistry| ... } ⇒ TrueClass
Exposes a means to register application critical roles
44 45 46 47 |
# File 'lib/hyrax/configuration.rb', line 44 def register_roles yield(@role_registry) true end |
#registered_curation_concern_types ⇒ Array<String>
The normalization done by this method must occur after the initialization process so it can take advantage of irregular inflections from config/initializers/inflections.rb
261 262 263 |
# File 'lib/hyrax/configuration.rb', line 261 def registered_curation_concern_types @registered_concerns.map { |cc_type| normalize_concern_name(cc_type) } end |
#work_requires_files? ⇒ Boolean Also known as: work_requires_files
352 353 354 355 |
# File 'lib/hyrax/configuration.rb', line 352 def work_requires_files? return true if @work_requires_files.nil? @work_requires_files end |