Sha256: 3abf8ead7c9d19b5255c172c8dfe0d3ead6cff1d1f952c568c338aea543bac16

Contents?: true

Size: 923 Bytes

Versions: 5

Compression:

Stored size: 923 Bytes

Contents

# load all custom initializers of plugins or themes
Rails.application.config.to_prepare do |_config|
  PluginRoutes.all_apps.each do |ap|
    next unless ap['path'].present?

    f = File.join(ap['path'], 'config', 'initializer.rb')
    eval(File.read(f)) if File.exist?(f)

    f = File.join(ap['path'], 'config', 'custom_models.rb')
    eval(File.read(f)) if File.exist?(f)
  end

  # This block can be overridden in the app initializer to wrap the sleep and delete_file in an async job,
  # something like this:
  #
  # CamaleonDeleteFileJob.set(wait: temporal_time).perform_later(file_key)
  # # put this in app/jobs/camaleon_delete_file_job.rb:
  # include CamaleonCms::UploaderHelper
  # cama_uploader.delete_file(file_key)
  CamaleonCmsUploader.delete_block do |settings, cama_uploader, file_key|
    next unless Rails.env.test?

    sleep(settings[:temporal_time])
    cama_uploader.delete_file(file_key)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
camaleon_cms-2.9.0 config/initializers/custom_initializers.rb
camaleon_cms-2.8.3 config/initializers/custom_initializers.rb
camaleon_cms-2.8.2 config/initializers/custom_initializers.rb
camaleon_cms-2.8.1 config/initializers/custom_initializers.rb
camaleon_cms-2.8.0 config/initializers/custom_initializers.rb