lib/assembly-objectfile/content_metadata.rb in assembly-objectfile-1.9.0 vs lib/assembly-objectfile/content_metadata.rb in assembly-objectfile-1.10.0

- old
+ new

@@ -1,8 +1,9 @@ # frozen_string_literal: true require 'nokogiri' +require 'deprecation' require 'active_support' require 'assembly-objectfile/content_metadata/file' require 'assembly-objectfile/content_metadata/file_set' require 'assembly-objectfile/content_metadata/file_set_builder' require 'assembly-objectfile/content_metadata/config' @@ -11,10 +12,11 @@ module Assembly SPECIAL_DPG_FOLDERS = %w[31 44 50].freeze # these special dpg folders will force any files contained in them into their own resources, regardless of filenaming convention # these are used when :bundle=>:dpg only DEPRECATED_STYLES = %i[book_with_pdf book_as_image].freeze + VALID_STYLES = %i[simple_image simple_book file map document 3d].freeze # This class generates content metadata for image files class ContentMetadata # Generates image content XML metadata for a repository object. # This method only produces content metadata for images @@ -58,11 +60,10 @@ include_root_xml: nil) common_path = find_common_path(objects) unless preserve_common_paths # find common paths to all files provided if needed filesets = FileSetBuilder.build(bundle: bundle, objects: objects, style: style) - config = Config.new(auto_labels: auto_labels, flatten_folder_structure: flatten_folder_structure, add_file_attributes: add_file_attributes, file_attributes: file_attributes, add_exif: add_exif, @@ -96,24 +97,19 @@ Assembly::ObjectFile.common_path(all_paths) # find common paths to all files provided if needed end private_class_method :find_common_path def self.object_level_type(style) - puts "WARNING - the style #{style} is now deprecated and should not be used." if DEPRECATED_STYLES.include? style + Deprecation.warn(self, "the style #{style} is now deprecated and should not be used. This will be removed in assembly-objectfile 2.0") if DEPRECATED_STYLES.include? style + raise "Supplied style (#{style}) not valid" unless (VALID_STYLES + DEPRECATED_STYLES).include? style case style when :simple_image 'image' - when :file - 'file' when :simple_book, :book_with_pdf, :book_as_image 'book' - when :map - 'map' - when :'3d' - '3d' else - raise "Supplied style (#{style}) not valid" + style.to_s end end end # class end # module