bulkrax 8.2.1 → 8.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f2cc08d07d9dcc8bd23ffcbb4bffb003a29526e10eee216eafe38218cf210e4
4
- data.tar.gz: ebb308781109821d73da4f26e1a836ff6ee7ae1052145808321b385380b57e17
3
+ metadata.gz: 35107691013ec9d3827b2e217fb19fc9a5332a6737c63345ebd15f78cb6f2625
4
+ data.tar.gz: 3ae32479f173a61e1c73eb63d615099d09645f2b69aebcfc0c553787db9c4de3
5
5
  SHA512:
6
- metadata.gz: b1e760746c5afdf36af2621ca6a2b13d6c1c81f5a5a1e291ec290c53c0bbe2219d346aa0dc54db8b2bf17f11e5aea13594058d0bae55518bf5fa857e8190661f
7
- data.tar.gz: d840b1bdcb3c20ca939f778e3e6e5bbb490e890224ec5c912dcf881489e34a58b6d957395387a358fa8930023a93f8f15077ac7f5146a7d87fa0e7a59b6d71e8
6
+ metadata.gz: 006d594d7fe8dd7b0efab965bf4662804ad77e5455d7772b402da5091824c1809652ede97195a1cc47e423eb417d15f44a092b2e7642d9525c76439305a6dfa0
7
+ data.tar.gz: 7cc96869b7dd2f382513568fb8bd4224c906d8e67506cfb292f8c3c2c26c8f98c1bf10b2e47b76aa47b73c184e589d0325ba7246f5fd89c1ad98f2bc7d1fa5b5
@@ -132,7 +132,7 @@ module Bulkrax
132
132
  status_message: status_message_for(e),
133
133
  type: e.type,
134
134
  updated_at: e.updated_at,
135
- errors: e.latest_status&.error_class&.present? ? view_context.link_to(e.latest_status.error_class, view_context.item_entry_path(item, e), title: e.latest_status.error_message) : "",
135
+ errors: e.status_message == 'Failed' ? view_context.link_to(e.error_class, view_context.item_entry_path(item, e)) : "",
136
136
  actions: entry_util_links(e, item)
137
137
  }
138
138
  end
@@ -165,7 +165,10 @@ module Bulkrax
165
165
  end
166
166
 
167
167
  def delete(_user)
168
- find&.delete
168
+ obj = find
169
+ return false unless obj
170
+
171
+ obj.delete(eradicate: true)
169
172
  end
170
173
 
171
174
  private
@@ -10,11 +10,11 @@ module Bulkrax
10
10
  om = parent.ordered_members.to_a
11
11
  om.delete(file_set)
12
12
  parent.ordered_members = om
13
- elsif parent.respond_to?(:member_ids)
13
+ parent.save
14
+ elsif parent&.respond_to?(:member_ids)
14
15
  parent.member_ids.delete(file_set.id)
15
16
  Hyrax.persister.save(resource: parent)
16
17
  end
17
- parent.save
18
18
  end
19
19
 
20
20
  super
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Bulkrax
4
4
  class Status < ApplicationRecord
5
- belongs_to :statusable, polymorphic: true, denormalize: { fields: %i[status_message], if: :latest? }
5
+ belongs_to :statusable, polymorphic: true, denormalize: { fields: %i[status_message error_class], if: :latest? }
6
6
  belongs_to :runnable, polymorphic: true
7
7
  serialize :error_backtrace, Array
8
8
 
@@ -26,11 +26,15 @@ module Bulkrax
26
26
 
27
27
  # Prepend the file_set id to ensure a unique filename and also one that is not longer than 255 characters
28
28
  def filename(file_set)
29
- # NOTE: Will this work with Valkyrie?
30
29
  return if file_set.original_file.blank?
31
- fn = file_set.original_file.file_name.first
32
- mime = ::Marcel::MimeType.for(file_set.original_file.mime_type)
33
- ext_mime = ::Marcel::MimeType.for(file_set.original_file.file_name)
30
+ if file_set.original_file.respond_to?(:original_filename) # valkyrie
31
+ fn = file_set.original_file.original_filename
32
+ mime = ::Marcel::MimeType.for(file_set.original_file.file.io)
33
+ else # original non valkyrie version
34
+ fn = file_set.original_file.file_name.first
35
+ mime = ::Marcel::MimeType.for(declared_type: file_set.original_file.mime_type)
36
+ end
37
+ ext_mime = ::Marcel::MimeType.for(name: fn)
34
38
  if fn.include?(file_set.id) || importerexporter.metadata_only?
35
39
  filename = "#{fn}.#{mime.to_sym}"
36
40
  filename = fn if mime.to_s == ext_mime.to_s
@@ -244,7 +244,10 @@ module Bulkrax
244
244
  record = Bulkrax.object_factory.find(identifier)
245
245
  return unless record
246
246
 
247
- file_sets = record.file_set? ? Array.wrap(record) : record.file_sets
247
+ file_sets = Array.wrap(record) if record.file_set?
248
+ if file_sets.nil? # for valkyrie
249
+ file_sets = record.respond_to?(:file_sets) ? record.file_sets : record.members&.select(&:file_set?)
250
+ end
248
251
  file_sets << record.thumbnail if exporter.include_thumbnails && record.thumbnail.present? && record.work?
249
252
  file_sets.each do |fs|
250
253
  path = File.join(exporter_export_path, folder_count, 'files')
@@ -252,7 +255,7 @@ module Bulkrax
252
255
  file = filename(fs)
253
256
  next if file.blank? || fs.original_file.blank?
254
257
 
255
- io = open(fs.original_file.uri)
258
+ io = fs.original_file.respond_to?(:uri) ? open(fs.original_file.uri) : fs.original_file.file.io
256
259
  File.open(File.join(path, file), 'wb') do |f|
257
260
  f.write(io.read)
258
261
  f.close
@@ -173,7 +173,7 @@ module Bulkrax
173
173
  # @see https://github.com/samvera/hyrax/blob/64c0bbf0dc0d3e1b49f040b50ea70d177cc9d8f6/app/indexers/hyrax/work_indexer.rb#L15-L18
174
174
  def file_sets
175
175
  @file_sets ||= ParserExportRecordSet.in_batches(candidate_file_set_ids) do |batch_of_ids|
176
- fsq = "has_model_ssim:#{Bulkrax.file_model_internal_resource} AND id:(\"" + batch_of_ids.join('" OR "') + "\")"
176
+ fsq = "has_model_ssim:\"#{Bulkrax.file_model_internal_resource.demodulize}\" AND id:(\"" + batch_of_ids.join('" OR "') + "\")"
177
177
  fsq += extra_filters if extra_filters.present?
178
178
  Bulkrax.object_factory.query(
179
179
  fsq,
@@ -0,0 +1,7 @@
1
+ class EntryErrorDenormalization < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :bulkrax_entries, :error_class, :string unless column_exists?(:bulkrax_entries, :error_class)
4
+ add_column :bulkrax_importers, :error_class, :string unless column_exists?(:bulkrax_importers, :error_class)
5
+ add_column :bulkrax_exporters, :error_class, :string unless column_exists?(:bulkrax_exporters, :error_class)
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ class FasterFirstEntry < ActiveRecord::Migration[5.2]
3
+ def change
4
+ add_index :bulkrax_entries, [:importerexporter_id, :importerexporter_type, :id], name: 'index_bulkrax_entries_on_importerexporter_id_type_and_id' unless index_exists?(:bulkrax_entries, [:importerexporter_id, :importerexporter_type, :id],
5
+ name: 'index_bulkrax_entries_on_importerexporter_id_type_and_id')
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bulkrax
4
- VERSION = '8.2.1'
4
+ VERSION = '8.2.2'
5
5
  end
@@ -9,7 +9,7 @@ namespace :bulkrax do
9
9
  progress_mark: ' ',
10
10
  remainder_mark: "\u{FF65}")
11
11
  Bulkrax::Status.latest_by_statusable.includes(:statusable).find_each do |status|
12
- status.statusable.update(status_message: status.status_message)
12
+ status.statusable.update(status_message: status.status_message, error_class: status.error_class)
13
13
  @progress.increment
14
14
  end
15
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulkrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.2.1
4
+ version: 8.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Kaufman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-02 00:00:00.000000000 Z
11
+ date: 2024-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.4.6
33
+ version: 0.6.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.4.6
40
+ version: 0.6.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coderay
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -486,6 +486,8 @@ files:
486
486
  - db/migrate/20240823173525_add_error_tracking_to_pending_relationships.rb
487
487
  - db/migrate/20240916182737_add_last_imported_at_to_bulkrax_importers.rb
488
488
  - db/migrate/20240916182823_add_next_import_at_to_bulkrax_importers.rb
489
+ - db/migrate/20241203010707_entry_error_denormalization.rb
490
+ - db/migrate/20241205212513_faster_first_entry.rb
489
491
  - lib/bulkrax.rb
490
492
  - lib/bulkrax/engine.rb
491
493
  - lib/bulkrax/entry_spec_helper.rb
@@ -518,7 +520,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
518
520
  - !ruby/object:Gem::Version
519
521
  version: '0'
520
522
  requirements: []
521
- rubygems_version: 3.4.20
523
+ rubygems_version: 3.1.4
522
524
  signing_key:
523
525
  specification_version: 4
524
526
  summary: Import and export tool for Hyrax and Hyku