class WaxTasks::Collection
Constants
- DEFAULT_VARIANTS
- IMAGE_DERIVATIVE_DIRECTORY
Attributes
config[R]
ext[R]
iiif_derivative_source[R]
imagedata_source[R]
metadata_source[R]
name[R]
page_source[R]
search_fields[R]
simple_derivative_source[R]
Public Class Methods
new(name, config, source, collections_dir, ext)
click to toggle source
# File lib/wax_tasks/collection.rb, line 21 def initialize(name, config, source, collections_dir, ext) @name = name @config = config @page_extension = ext @site_source = source @page_source = Utils.safe_join source, collections_dir, "_#{@name}" @metadata_source = Utils.safe_join source, '_data', config.dig('metadata', 'source') @imagedata_source = Utils.safe_join source, '_data', config.dig('images', 'source') @iiif_derivative_source = Utils.safe_join source, IMAGE_DERIVATIVE_DIRECTORY, 'iiif' @simple_derivative_source = Utils.safe_join source, IMAGE_DERIVATIVE_DIRECTORY, 'simple' @search_fields = %w[pid label thumbnail permalink collection] @image_variants = image_variants end
Public Instance Methods
clobber_derivatives()
click to toggle source
# File lib/wax_tasks/collection.rb, line 52 def clobber_derivatives [@iiif_derivative_source, @simple_derivative_source].each do |dir| if Dir.exist? dir puts Rainbow("Removing derivatives from #{dir}").cyan FileUtils.remove_dir dir, true end end end
clobber_pages()
click to toggle source
# File lib/wax_tasks/collection.rb, line 44 def clobber_pages return unless Dir.exist? @page_source puts Rainbow("Removing pages from #{@page_source}").cyan FileUtils.remove_dir @page_source, true end
image_variants()
click to toggle source
# File lib/wax_tasks/collection.rb, line 37 def image_variants vars = @config.dig('images', 'variants') || {} DEFAULT_VARIANTS.merge vars end