bulkrax 8.2.0 → 8.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/app/controllers/concerns/bulkrax/datatables_behavior.rb +1 -1
- data/app/factories/bulkrax/object_factory.rb +4 -1
- data/app/jobs/bulkrax/delete_file_set_job.rb +2 -2
- data/app/models/bulkrax/status.rb +1 -1
- data/app/models/concerns/bulkrax/export_behavior.rb +8 -4
- data/app/parsers/bulkrax/csv_parser.rb +5 -2
- data/app/parsers/bulkrax/parser_export_record_set.rb +1 -1
- data/db/migrate/20241203010707_entry_error_denormalization.rb +7 -0
- data/db/migrate/20241205212513_faster_first_entry.rb +7 -0
- data/lib/bulkrax/version.rb +1 -1
- data/lib/bulkrax.rb +40 -3
- data/lib/tasks/bulkrax_tasks.rake +1 -1
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35107691013ec9d3827b2e217fb19fc9a5332a6737c63345ebd15f78cb6f2625
|
4
|
+
data.tar.gz: 3ae32479f173a61e1c73eb63d615099d09645f2b69aebcfc0c553787db9c4de3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 006d594d7fe8dd7b0efab965bf4662804ad77e5455d7772b402da5091824c1809652ede97195a1cc47e423eb417d15f44a092b2e7642d9525c76439305a6dfa0
|
7
|
+
data.tar.gz: 7cc96869b7dd2f382513568fb8bd4224c906d8e67506cfb292f8c3c2c26c8f98c1bf10b2e47b76aa47b73c184e589d0325ba7246f5fd89c1ad98f2bc7d1fa5b5
|
data/README.md
CHANGED
@@ -24,6 +24,14 @@ $ rails db:migrate
|
|
24
24
|
|
25
25
|
If using Sidekiq, set up queues for `import` and `export`.
|
26
26
|
|
27
|
+
### Bundle errors on ARM
|
28
|
+
|
29
|
+
If posix-spawn is failing to bundle on an ARM based processor, try the following
|
30
|
+
|
31
|
+
`bundle config build.posix-spawn --with-cflags="-Wno-incompatible-function-pointer-types"`
|
32
|
+
|
33
|
+
Then rebundle. See https://github.com/rtomayko/posix-spawn/issues/92
|
34
|
+
|
27
35
|
### Manual Installation
|
28
36
|
|
29
37
|
Add this line to your application's Gemfile:
|
@@ -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.
|
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
|
@@ -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
|
-
|
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
|
-
|
32
|
-
|
33
|
-
|
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 =
|
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
|
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
|
data/lib/bulkrax/version.rb
CHANGED
data/lib/bulkrax.rb
CHANGED
@@ -98,7 +98,20 @@ module Bulkrax
|
|
98
98
|
attr_writer :collection_model_class
|
99
99
|
|
100
100
|
def collection_model_internal_resource
|
101
|
-
|
101
|
+
# WARN: Using #try on :internal_resource can yield unexpected results.
|
102
|
+
# If the method is undefined, it can return a truthy value instead of
|
103
|
+
# the typical nil.
|
104
|
+
#
|
105
|
+
# E.g.
|
106
|
+
# ```ruby
|
107
|
+
# Hyrax::FileSet.try(:internal_resource) || 'hi'
|
108
|
+
# => #<Dry::Types::Result::Failure input=:internal_resource error=...
|
109
|
+
# ```
|
110
|
+
if collection_model_class.respond_to?(:internal_resource)
|
111
|
+
collection_model_class.internal_resource
|
112
|
+
else
|
113
|
+
collection_model_class.to_s
|
114
|
+
end
|
102
115
|
end
|
103
116
|
|
104
117
|
def file_model_class
|
@@ -108,7 +121,20 @@ module Bulkrax
|
|
108
121
|
attr_writer :file_model_class
|
109
122
|
|
110
123
|
def file_model_internal_resource
|
111
|
-
|
124
|
+
# WARN: Using #try on :internal_resource can yield unexpected results.
|
125
|
+
# If the method is undefined, it can return a truthy value instead of
|
126
|
+
# the typical nil.
|
127
|
+
#
|
128
|
+
# E.g.
|
129
|
+
# ```ruby
|
130
|
+
# Hyrax::FileSet.try(:internal_resource) || 'hi'
|
131
|
+
# => #<Dry::Types::Result::Failure input=:internal_resource error=...
|
132
|
+
# ```
|
133
|
+
if file_model_class.respond_to?(:internal_resource)
|
134
|
+
file_model_class.internal_resource
|
135
|
+
else
|
136
|
+
file_model_class.to_s
|
137
|
+
end
|
112
138
|
end
|
113
139
|
|
114
140
|
def curation_concerns
|
@@ -118,7 +144,18 @@ module Bulkrax
|
|
118
144
|
attr_writer :curation_concerns
|
119
145
|
|
120
146
|
def curation_concern_internal_resources
|
121
|
-
curation_concerns.map
|
147
|
+
curation_concerns.map do |cc|
|
148
|
+
# WARN: Using #try on :internal_resource can yield unexpected results.
|
149
|
+
# If the method is undefined, it can return a truthy value instead of
|
150
|
+
# the typical nil.
|
151
|
+
#
|
152
|
+
# E.g.
|
153
|
+
# ```ruby
|
154
|
+
# Hyrax::FileSet.try(:internal_resource) || 'hi'
|
155
|
+
# => #<Dry::Types::Result::Failure input=:internal_resource error=...
|
156
|
+
# ```
|
157
|
+
cc.respond_to?(:internal_resource) ? cc.internal_resource : cc.to_s
|
158
|
+
end.uniq
|
122
159
|
end
|
123
160
|
|
124
161
|
attr_writer :ingest_queue_name
|
@@ -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.
|
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-
|
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.
|
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.
|
40
|
+
version: 0.6.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: coderay
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,14 +134,14 @@ dependencies:
|
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version:
|
137
|
+
version: '5.0'
|
138
138
|
type: :runtime
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version:
|
144
|
+
version: '5.0'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: loofah
|
147
147
|
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
|
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
|