Class: Hyrax::Configuration

Inherits:
Object
  • Object
show all
Includes:
Callbacks
Defined in:
lib/hyrax/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Callbacks

#callback

Constructor Details

#initializeConfiguration

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

Parameters:

  • value

    the value to set the attribute active_deposit_agreement_acceptance to.



331
332
333
# File 'lib/hyrax/configuration.rb', line 331

def active_deposit_agreement_acceptance=(value)
  @active_deposit_agreement_acceptance = value
end

#activity_to_show_default_seconds_since_nowObject



316
317
318
# File 'lib/hyrax/configuration.rb', line 316

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)?



369
370
371
# File 'lib/hyrax/configuration.rb', line 369

def always_display_share_button=(value)
  @always_display_share_button = value
end

#analytic_start_dateObject

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

Parameters:

  • value

    the value to set the attribute analytics to.



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

Parameters:

  • value

    the value to set the attribute arkivo_api to.



320
321
322
# File 'lib/hyrax/configuration.rb', line 320

def arkivo_api=(value)
  @arkivo_api = value
end

#audit_user_keyObject



353
354
355
# File 'lib/hyrax/configuration.rb', line 353

def audit_user_key
  @audit_user_key ||= '[email protected]'
end


270
271
272
# File 'lib/hyrax/configuration.rb', line 270

def banner_image
  @banner_image ||= "https://cloud.githubusercontent.com/assets/92044/18370978/88ecac20-75f6-11e6-8399-6536640ef695.jpg"
end

#batch_user_keyObject



348
349
350
# File 'lib/hyrax/configuration.rb', line 348

def batch_user_key
  @batch_user_key ||= '[email protected]'
end

#binaries_directoryObject



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

Parameters:

  • value

    the value to set the attribute browse_everything to.



289
290
291
# File 'lib/hyrax/configuration.rb', line 289

def browse_everything=(value)
  @browse_everything = value
end

#cache_pathObject



364
365
366
# File 'lib/hyrax/configuration.rb', line 364

def cache_path
  @cache_path ||= ->() { Rails.root + 'tmp' + 'uploads' + 'cache' }
end

#characterization_runnerObject

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

Parameters:

  • value

    the value to set the attribute citations to.



303
304
305
# File 'lib/hyrax/configuration.rb', line 303

def citations=(value)
  @citations = value
end

#contact_emailObject



410
411
412
# File 'lib/hyrax/configuration.rb', line 410

def contact_email
  @contact_email ||= "[email protected]"
end

#dashboard_configurationObject

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_nameString

Note:

The active workflow for an admin set can be changed at a later point.

Note:

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.

Returns:

  • (String)

See Also:



26
27
28
# File 'lib/hyrax/configuration.rb', line 26

def default_active_workflow_name
  @default_active_workflow_name
end

#derivatives_pathObject



51
52
53
# File 'lib/hyrax/configuration.rb', line 51

def derivatives_path
  @derivatives_path ||= Rails.root.join('tmp', 'derivatives')
end

#descriptions_directoryObject



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

Parameters:

  • value

    the value to set the attribute display_media_download_link to.



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

Parameters:

  • value

    the value to set the attribute display_microdata to.



85
86
87
# File 'lib/hyrax/configuration.rb', line 85

def display_microdata=(value)
  @display_microdata = value
end

#enable_ffmpegObject



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_ingestObject

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

Parameters:

  • value

    the value to set the attribute enable_noids to.



103
104
105
# File 'lib/hyrax/configuration.rb', line 103

def enable_noids=(value)
  @enable_noids = value
end

#feature_config_pathObject



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_pathObject



68
69
70
# File 'lib/hyrax/configuration.rb', line 68

def ffmpeg_path
  @ffmpeg_path ||= 'ffmpeg'
end

#fits_message_lengthObject



73
74
75
# File 'lib/hyrax/configuration.rb', line 73

def fits_message_length
  @fits_message_length ||= 5
end

#fits_pathObject



135
136
137
# File 'lib/hyrax/configuration.rb', line 135

def fits_path
  @fits_path ||= 'fits.sh'
end

#google_analytics_idObject Also known as: google_analytics_id?



378
379
380
# File 'lib/hyrax/configuration.rb', line 378

def google_analytics_id
  @google_analytics_id ||= nil
end

#import_export_jar_file_pathObject



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_nameObject



167
168
169
# File 'lib/hyrax/configuration.rb', line 167

def ingest_queue_name
  @ingest_queue_name ||= :default
end

#libreoffice_pathObject



285
286
287
# File 'lib/hyrax/configuration.rb', line 285

def libreoffice_path
  @libreoffice_path ||= "soffice"
end

#license_service_classObject



265
266
267
# File 'lib/hyrax/configuration.rb', line 265

def license_service_class
  @license_service_class ||= Hyrax::LicenseService
end

#lock_retry_countObject



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_delayObject



160
161
162
# File 'lib/hyrax/configuration.rb', line 160

def lock_retry_delay
  @lock_retry_delay ||= 200 # milliseconds
end

#lock_time_to_liveObject



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_auditsObject



99
100
101
# File 'lib/hyrax/configuration.rb', line 99

def max_days_between_audits
  @max_days_between_audits ||= 7
end

#max_notifications_for_dashboardObject



311
312
313
# File 'lib/hyrax/configuration.rb', line 311

def max_notifications_for_dashboard
  @max_notifications_for_dashboard ||= 5
end

#microdata_default_typeObject



94
95
96
# File 'lib/hyrax/configuration.rb', line 94

def microdata_default_type
  @microdata_default_type ||= 'http://schema.org/CreativeWork'
end

#minter_statefileObject



122
123
124
# File 'lib/hyrax/configuration.rb', line 122

def minter_statefile
  @minter_statefile ||= '/tmp/minter-state'
end

#model_to_createObject

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



422
423
424
# File 'lib/hyrax/configuration.rb', line 422

def model_to_create
  @model_to_create ||= ->(_attributes) { Hyrax.primary_work_type.model_name.name }
end

#noid_minter_classObject



117
118
119
# File 'lib/hyrax/configuration.rb', line 117

def noid_minter_class
  @noid_minter_class ||= ActiveFedora::Noid::Minter::Db
end

#noid_templateObject



112
113
114
# File 'lib/hyrax/configuration.rb', line 112

def noid_template
  @noid_template ||= '.reeddeeddk'
end

#owner_permission_levelsObject



395
396
397
# File 'lib/hyrax/configuration.rb', line 395

def owner_permission_levels
  @owner_permission_levels ||= { "Edit Access" => "edit" }
end

#permission_levelsObject



388
389
390
391
392
# File 'lib/hyrax/configuration.rb', line 388

def permission_levels
  @permission_levels ||= { "Choose Access" => "none",
                           "View/Download" => "read",
                           "Edit" => "edit" }
end

#persistent_hostpathObject



275
276
277
# File 'lib/hyrax/configuration.rb', line 275

def persistent_hostpath
  @persistent_hostpath ||= "http://localhost/files/"
end

#redis_namespaceObject



280
281
282
# File 'lib/hyrax/configuration.rb', line 280

def redis_namespace
  @redis_namespace ||= "hyrax"
end

#subject_prefixObject



415
416
417
# File 'lib/hyrax/configuration.rb', line 415

def subject_prefix
  @subject_prefix ||= "Contact form:"
end

#temp_file_baseObject

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_uriObject



405
406
407
# File 'lib/hyrax/configuration.rb', line 405

def translate_id_to_uri
  @translate_id_to_uri ||= ActiveFedora::Noid.config.translate_id_to_uri
end

#translate_uri_to_idObject



400
401
402
# File 'lib/hyrax/configuration.rb', line 400

def translate_uri_to_id
  @translate_uri_to_id ||= ActiveFedora::Noid.config.translate_uri_to_id
end

#upload_pathObject



359
360
361
# File 'lib/hyrax/configuration.rb', line 359

def upload_path
  @upload_path ||= ->() { Rails.root + 'tmp' + 'uploads' }
end

#work_requires_files=(value) ⇒ Object (writeonly)

Sets the attribute work_requires_files

Parameters:

  • value

    the value to set the attribute work_requires_files to.



339
340
341
# File 'lib/hyrax/configuration.rb', line 339

def work_requires_files=(value)
  @work_requires_files = value
end

#working_pathObject



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

Returns:

  • (Boolean)


332
333
334
335
# File 'lib/hyrax/configuration.rb', line 332

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: always_display_share_button

Returns:

  • (Boolean)


370
371
372
373
# File 'lib/hyrax/configuration.rb', line 370

def always_display_share_button?
  return true if @always_display_share_button.nil?
  @always_display_share_button
end

#analytics?Boolean Also known as: analytics

Returns:

  • (Boolean)


297
298
299
# File 'lib/hyrax/configuration.rb', line 297

def analytics?
  @analytics ||= false
end

#arkivo_api?Boolean Also known as: arkivo_api

Returns:

  • (Boolean)


321
322
323
# File 'lib/hyrax/configuration.rb', line 321

def arkivo_api?
  @arkivo_api ||= false
end

#browse_everything?Boolean Also known as: browse_everything

Returns:

  • (Boolean)


290
291
292
# File 'lib/hyrax/configuration.rb', line 290

def browse_everything?
  @browse_everything ||= nil
end

#citations?Boolean Also known as: citations

Returns:

  • (Boolean)


304
305
306
# File 'lib/hyrax/configuration.rb', line 304

def citations?
  @citations ||= false
end

#curation_concernsArray<Class>

Returns the registered curation concerns.

Returns:

  • (Array<Class>)

    the registered curation concerns



254
255
256
# File 'lib/hyrax/configuration.rb', line 254

def curation_concerns
  registered_curation_concern_types.map(&:constantize)
end

#display_media_download_link?Boolean Also known as: display_media_download_link

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


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

#geonames_username=(username) ⇒ Object



327
328
329
# File 'lib/hyrax/configuration.rb', line 327

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

Parameters:

  • curation_concern_types (Array<Symbol>, Symbol)


238
239
240
241
242
243
244
# File 'lib/hyrax/configuration.rb', line 238

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

Examples:

Hyrax.config.register_roles do |registry|
  registry.add(name: 'captaining', description: 'Grants captain duties')
end

Yields:

Returns:

  • (TrueClass)


44
45
46
47
# File 'lib/hyrax/configuration.rb', line 44

def register_roles
  yield(@role_registry)
  true
end

#registered_curation_concern_typesArray<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

Returns:

  • (Array<String>)

    the class names of the registered curation concerns



249
250
251
# File 'lib/hyrax/configuration.rb', line 249

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

Returns:

  • (Boolean)


340
341
342
343
# File 'lib/hyrax/configuration.rb', line 340

def work_requires_files?
  return true if @work_requires_files.nil?
  @work_requires_files
end