app/models/bulkrax/exporter.rb in bulkrax-1.0.2 vs app/models/bulkrax/exporter.rb in bulkrax-2.0.0

- old
+ new

@@ -12,21 +12,23 @@ has_many :entries, as: :importerexporter, dependent: :destroy validates :name, presence: true validates :parser_klass, presence: true - delegate :write, :create_from_collection, :create_from_importer, :create_from_worktype, to: :parser + delegate :write, :create_from_collection, :create_from_importer, :create_from_worktype, :create_from_all, to: :parser def export current_run && setup_export_path case self.export_from when 'collection' create_from_collection when 'importer' create_from_importer when 'worktype' create_from_worktype + when 'all' + create_from_all end rescue StandardError => e status_info(e) end @@ -75,11 +77,12 @@ def export_from_list [ [I18n.t('bulkrax.exporter.labels.importer'), 'importer'], [I18n.t('bulkrax.exporter.labels.collection'), 'collection'], - [I18n.t('bulkrax.exporter.labels.worktype'), 'worktype'] + [I18n.t('bulkrax.exporter.labels.worktype'), 'worktype'], + [I18n.t('bulkrax.exporter.labels.all'), 'all'] ] end def export_type_list [ @@ -103,20 +106,24 @@ def setup_export_path FileUtils.mkdir_p(exporter_export_path) unless File.exist?(exporter_export_path) end def exporter_export_path - @exporter_export_path ||= File.join(Bulkrax.export_path, self.id.to_s, self.exporter_runs.last.id.to_s) + @exporter_export_path ||= File.join(parser.base_path('export'), self.id.to_s, self.exporter_runs.last.id.to_s) end def exporter_export_zip_path - @exporter_export_zip_path ||= File.join(Bulkrax.export_path, "export_#{self.id}_#{self.exporter_runs.last.id}.zip") + @exporter_export_zip_path ||= File.join(parser.base_path('export'), "export_#{self.id}_#{self.exporter_runs.last.id}.zip") rescue - @exporter_export_zip_path ||= File.join(Bulkrax.export_path, "export_#{self.id}_0.zip") + @exporter_export_zip_path ||= File.join(parser.base_path('export'), "export_#{self.id}_0.zip") end def export_properties properties = Hyrax.config.registered_curation_concern_types.map { |work| work.constantize.properties.keys }.flatten.uniq.sort properties.reject { |prop| Bulkrax.reserved_properties.include?(prop) } + end + + def metadata_only? + export_type == 'metadata' end end end