bulkrax 5.0.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/bulkrax/entries_controller.rb +4 -2
- data/app/controllers/bulkrax/exporters_controller.rb +13 -9
- data/app/controllers/bulkrax/importers_controller.rb +10 -10
- data/app/helpers/bulkrax/application_helper.rb +1 -1
- data/app/helpers/bulkrax/importers_helper.rb +2 -2
- data/app/helpers/bulkrax/validation_helper.rb +4 -4
- data/app/jobs/bulkrax/create_relationships_job.rb +78 -59
- data/app/jobs/bulkrax/delete_job.rb +1 -1
- data/app/jobs/bulkrax/export_work_job.rb +2 -2
- data/app/jobs/bulkrax/import_file_set_job.rb +1 -1
- data/app/jobs/bulkrax/import_work_job.rb +20 -7
- data/app/jobs/bulkrax/importer_job.rb +2 -2
- data/app/jobs/bulkrax/schedule_relationships_job.rb +2 -1
- data/app/matchers/bulkrax/application_matcher.rb +1 -0
- data/app/models/bulkrax/csv_entry.rb +93 -24
- data/app/models/bulkrax/exporter.rb +18 -19
- data/app/models/bulkrax/importer.rb +5 -5
- data/app/models/bulkrax/importer_run.rb +6 -0
- data/app/models/bulkrax/oai_entry.rb +14 -2
- data/app/models/bulkrax/pending_relationship.rb +4 -0
- data/app/models/concerns/bulkrax/dynamic_record_lookup.rb +3 -1
- data/app/models/concerns/bulkrax/export_behavior.rb +6 -4
- data/app/models/concerns/bulkrax/has_matchers.rb +1 -0
- data/app/models/concerns/bulkrax/import_behavior.rb +6 -3
- data/app/models/concerns/bulkrax/importer_exporter_behavior.rb +9 -1
- data/app/models/concerns/bulkrax/status_info.rb +9 -4
- data/app/parsers/bulkrax/application_parser.rb +14 -16
- data/app/parsers/bulkrax/bagit_parser.rb +6 -17
- data/app/parsers/bulkrax/csv_parser.rb +43 -111
- data/app/parsers/bulkrax/oai_dc_parser.rb +2 -2
- data/app/parsers/bulkrax/parser_export_record_set.rb +281 -0
- data/app/parsers/bulkrax/xml_parser.rb +9 -5
- data/app/services/bulkrax/remove_relationships_for_importer.rb +4 -2
- data/app/views/bulkrax/entries/show.html.erb +1 -1
- data/app/views/bulkrax/exporters/_form.html.erb +60 -45
- data/app/views/bulkrax/exporters/edit.html.erb +1 -1
- data/app/views/bulkrax/exporters/index.html.erb +2 -2
- data/app/views/bulkrax/exporters/new.html.erb +1 -1
- data/app/views/bulkrax/exporters/show.html.erb +3 -3
- data/app/views/bulkrax/importers/_bagit_fields.html.erb +13 -12
- data/app/views/bulkrax/importers/_csv_fields.html.erb +13 -12
- data/app/views/bulkrax/importers/_form.html.erb +5 -5
- data/app/views/bulkrax/importers/_oai_fields.html.erb +12 -10
- data/app/views/bulkrax/importers/_xml_fields.html.erb +12 -11
- data/app/views/bulkrax/importers/show.html.erb +18 -16
- data/app/views/bulkrax/shared/_collection_entries_tab.html.erb +6 -6
- data/app/views/bulkrax/shared/_file_set_entries_tab.html.erb +6 -6
- data/app/views/bulkrax/shared/_work_entries_tab.html.erb +6 -6
- data/config/locales/bulkrax.en.yml +26 -0
- data/lib/bulkrax/entry_spec_helper.rb +190 -0
- data/lib/bulkrax/version.rb +1 -1
- data/lib/bulkrax.rb +124 -45
- data/lib/generators/bulkrax/templates/config/initializers/bulkrax.rb +1 -1
- data/lib/tasks/reset.rake +1 -1
- metadata +5 -3
@@ -0,0 +1,190 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'oai'
|
4
|
+
require 'xml/libxml'
|
5
|
+
|
6
|
+
module Bulkrax
|
7
|
+
##
|
8
|
+
# The purpose of this module is to provide some testing facilities for those that include the
|
9
|
+
# Bulkrax gem in their application.
|
10
|
+
#
|
11
|
+
# This module came about through a desire to expose a quick means of vetting the accuracy of the
|
12
|
+
# different parsers.
|
13
|
+
module EntrySpecHelper
|
14
|
+
##
|
15
|
+
# @api public
|
16
|
+
# @since v5.0.1
|
17
|
+
#
|
18
|
+
# The purpose of this method is encapsulate the logic of creating the appropriate Bulkrax::Entry
|
19
|
+
# object based on the given data, identifier, and parser_class_name.
|
20
|
+
#
|
21
|
+
# From that entry, you should be able to test how {Bulkrax::Entry#build_metadata} populates the
|
22
|
+
# {Bulkrax::Entry#parsed_metadata} variable. Other uses may emerge.
|
23
|
+
#
|
24
|
+
# @param data [Object] the data that we use to populate the raw metadata. Due to implementation
|
25
|
+
# details of each entry, the data will be of different formats.
|
26
|
+
#
|
27
|
+
# @param identifier [String, Integer] The identifier of the entry. This might also be found in
|
28
|
+
# the metadata of the entry, but for instantiation purposes we need this value.
|
29
|
+
# @param parser_class_name [String] The name of the parser class you're wanting to test.
|
30
|
+
# @param type [Sybmol] The type of entry (e.g. :entry, :collection, :file_set) for testing.
|
31
|
+
# @param options [Hash<Symbol,Object>] these are to be passed along into the instantiation of
|
32
|
+
# the various classes. See implementation details.
|
33
|
+
#
|
34
|
+
# @return [Bulkrax::Entry]
|
35
|
+
def self.entry_for(data:, identifier:, parser_class_name:, type: :entry, **options)
|
36
|
+
importer = importer_for(parser_class_name: parser_class_name, **options)
|
37
|
+
entry_type_method_name = ENTRY_TYPE_TO_METHOD_NAME_MAP.fetch(type)
|
38
|
+
entry_class = importer.parser.public_send(entry_type_method_name)
|
39
|
+
|
40
|
+
# Using an instance of the entry_class to dispatch to different
|
41
|
+
entry_for_dispatch = entry_class.new
|
42
|
+
|
43
|
+
# Using the {is_a?} test we get the benefit of inspecting an object's inheritance path
|
44
|
+
# (e.g. ancestry). The logic, as implemented, also provides a mechanism for folks in their
|
45
|
+
# applications to add a {class_name_entry_for}; something that I suspect isn't likely
|
46
|
+
# but given the wide variety of underlying needs I could see happening and I want to encourage
|
47
|
+
# patterned thinking to fold that different build method into this structure.
|
48
|
+
key = entry_class_to_symbol_map.keys.detect { |class_name| entry_for_dispatch.is_a?(class_name.constantize) }
|
49
|
+
|
50
|
+
# Yes, we'll raise an error if we didn't find a corresponding key. And that's okay.
|
51
|
+
symbol = entry_class_to_symbol_map.fetch(key)
|
52
|
+
|
53
|
+
send("build_#{symbol}_entry_for",
|
54
|
+
importer: importer,
|
55
|
+
identifier: identifier,
|
56
|
+
entry_class: entry_class,
|
57
|
+
data: data,
|
58
|
+
**options)
|
59
|
+
end
|
60
|
+
|
61
|
+
# @api public
|
62
|
+
#
|
63
|
+
# @param parser_class_name [String]
|
64
|
+
# @param parser_fields [Hash<String,Hash>]
|
65
|
+
#
|
66
|
+
# @return [Bulkrax::Exporter]
|
67
|
+
def self.exporter_for(parser_class_name:, parser_fields: {}, **options)
|
68
|
+
Bulkrax::Exporter.new(
|
69
|
+
name: options.fetch(:exporter_name, "Test importer for identifier"),
|
70
|
+
user: options.fetch(:exporter_user, User.new(email: "hello@world.com")),
|
71
|
+
limit: options.fetch(:exporter_limit, 1),
|
72
|
+
parser_klass: parser_class_name,
|
73
|
+
field_mapping: options.fetch(:exporter_field_mappings) { Bulkrax.field_mappings.fetch(parser_class_name) },
|
74
|
+
parser_fields: parser_fields
|
75
|
+
)
|
76
|
+
end
|
77
|
+
|
78
|
+
ENTRY_TYPE_TO_METHOD_NAME_MAP = {
|
79
|
+
entry: :entry_class,
|
80
|
+
collection: :collection_entry_class,
|
81
|
+
file_set: :file_set_entry_class
|
82
|
+
}.freeze
|
83
|
+
|
84
|
+
DEFAULT_ENTRY_CLASS_TO_SYMBOL_MAP = {
|
85
|
+
'Bulkrax::OaiEntry' => :oai,
|
86
|
+
'Bulkrax::XmlEntry' => :xml,
|
87
|
+
'Bulkrax::CsvEntry' => :csv
|
88
|
+
}.freeze
|
89
|
+
|
90
|
+
# Present implementations of entry classes tend to inherit from the below listed class names.
|
91
|
+
# We're not looking to register all descendents of the {Bulkrax::Entry} class, but instead find
|
92
|
+
# the ancestor where there is significant deviation.
|
93
|
+
def self.entry_class_to_symbol_map
|
94
|
+
@entry_class_to_symbol_map || DEFAULT_ENTRY_CLASS_TO_SYMBOL_MAP
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.entry_class_to_symbol_map=(value)
|
98
|
+
@entry_class_to_symbol_map = value
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.importer_for(parser_class_name:, parser_fields: {}, **options)
|
102
|
+
# Ideally, we could pass in the field_mapping. However, there is logic that ignores the
|
103
|
+
# parser's field_mapping and directly asks for Bulkrax's field_mapping (e.g. model_mapping
|
104
|
+
# method).
|
105
|
+
Rails.logger.warn("You passed :importer_field_mapping as an option. This may not fully work as desired.") if options.key?(:importer_field_mapping)
|
106
|
+
Bulkrax::Importer.new(
|
107
|
+
name: options.fetch(:importer_name, "Test importer for identifier"),
|
108
|
+
admin_set_id: options.fetch(:importer_admin_set_id, "admin_set/default"),
|
109
|
+
user: options.fetch(:importer_user, User.new(email: "hello@world.com")),
|
110
|
+
limit: options.fetch(:importer_limits, 1),
|
111
|
+
parser_klass: parser_class_name,
|
112
|
+
field_mapping: options.fetch(:importer_field_mappings) { Bulkrax.field_mappings.fetch(parser_class_name) },
|
113
|
+
parser_fields: parser_fields
|
114
|
+
).tap do |importer|
|
115
|
+
# Why are we saving the importer and a run? We might want to delve deeper into the call
|
116
|
+
# stack. See https://github.com/scientist-softserv/adventist-dl/pull/266
|
117
|
+
importer.save!
|
118
|
+
# Later on, we might to want a current run
|
119
|
+
importer.importer_runs.create!
|
120
|
+
end
|
121
|
+
end
|
122
|
+
private_class_method :importer_for
|
123
|
+
|
124
|
+
##
|
125
|
+
# @api private
|
126
|
+
#
|
127
|
+
# @param data [Hash<Symbol,String>] we're expecting a hash with keys that are symbols and then
|
128
|
+
# values that are strings.
|
129
|
+
#
|
130
|
+
# @return [Bulkrax::CsvEntry]
|
131
|
+
#
|
132
|
+
# @note As a foible of this implementation, you'll need to include along a CSV to establish the
|
133
|
+
# columns that you'll parse (e.g. the first row
|
134
|
+
def self.build_csv_entry_for(importer:, data:, identifier:, entry_class:, **_options)
|
135
|
+
entry_class.new(
|
136
|
+
importerexporter: importer,
|
137
|
+
identifier: identifier,
|
138
|
+
raw_metadata: data
|
139
|
+
)
|
140
|
+
end
|
141
|
+
|
142
|
+
##
|
143
|
+
# @api private
|
144
|
+
#
|
145
|
+
# @param data [String] we're expecting a string that is well-formed XML for OAI parsing.
|
146
|
+
#
|
147
|
+
# @return [Bulkrax::OaiEntry]
|
148
|
+
def self.build_oai_entry_for(importer:, data:, identifier:, entry_class:, **options)
|
149
|
+
# The raw record assumes we take the XML data, parse it and then send that to the
|
150
|
+
# OAI::GetRecordResponse object.
|
151
|
+
doc = XML::Parser.string(data)
|
152
|
+
raw_record = OAI::GetRecordResponse.new(doc.parse)
|
153
|
+
|
154
|
+
raw_metadata = {
|
155
|
+
importer.parser.source_identifier.to_s => identifier,
|
156
|
+
"data" => data,
|
157
|
+
"collections" => options.fetch(:raw_metadata_collections, []),
|
158
|
+
"children" => options.fetch(:raw_metadata_children, [])
|
159
|
+
}
|
160
|
+
|
161
|
+
entry_class.new(
|
162
|
+
raw_record: raw_record,
|
163
|
+
importerexporter: importer,
|
164
|
+
identifier: identifier,
|
165
|
+
raw_metadata: raw_metadata
|
166
|
+
)
|
167
|
+
end
|
168
|
+
|
169
|
+
##
|
170
|
+
# @api private
|
171
|
+
#
|
172
|
+
# @param data [String] we're expecting a string that is well-formed XML.
|
173
|
+
#
|
174
|
+
# @return [Bulkrax::XmlEntry]
|
175
|
+
def self.build_xml_entry_for(importer:, data:, identifier:, entry_class:, **options)
|
176
|
+
raw_metadata = {
|
177
|
+
importer.parser.source_identifier.to_s => identifier,
|
178
|
+
"data" => data,
|
179
|
+
"collections" => options.fetch(:raw_metadata_collections, []),
|
180
|
+
"children" => options.fetch(:raw_metadata_children, [])
|
181
|
+
}
|
182
|
+
|
183
|
+
entry_class.new(
|
184
|
+
importerexporter: importer,
|
185
|
+
identifier: identifier,
|
186
|
+
raw_metadata: raw_metadata
|
187
|
+
)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
data/lib/bulkrax/version.rb
CHANGED
data/lib/bulkrax.rb
CHANGED
@@ -6,31 +6,91 @@ require 'active_support/all'
|
|
6
6
|
|
7
7
|
# rubocop:disable Metrics/ModuleLength
|
8
8
|
module Bulkrax
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
9
|
+
extend self # rubocop:disable Style/ModuleFunction
|
10
|
+
extend Forwardable
|
11
|
+
|
12
|
+
##
|
13
|
+
# @api public
|
14
|
+
class Configuration
|
15
|
+
attr_accessor :api_definition,
|
16
|
+
:curation_concerns,
|
17
|
+
:default_field_mapping,
|
18
|
+
:default_work_type,
|
19
|
+
:export_path,
|
20
|
+
:field_mappings,
|
21
|
+
:file_model_class,
|
22
|
+
:fill_in_blank_source_identifiers,
|
23
|
+
:generated_metadata_mapping,
|
24
|
+
:import_path,
|
25
|
+
:multi_value_element_join_on,
|
26
|
+
:multi_value_element_split_on,
|
27
|
+
:object_factory,
|
28
|
+
:parsers,
|
29
|
+
:qa_controlled_properties,
|
30
|
+
:related_children_field_mapping,
|
31
|
+
:related_parents_field_mapping,
|
32
|
+
:relationship_job_class,
|
33
|
+
:removed_image_path,
|
34
|
+
:required_elements,
|
35
|
+
:reserved_properties,
|
36
|
+
:server_name
|
37
|
+
end
|
38
|
+
|
39
|
+
def config
|
40
|
+
@config ||= Configuration.new
|
41
|
+
yield @config if block_given?
|
42
|
+
@config
|
43
|
+
end
|
44
|
+
alias setup config
|
45
|
+
|
46
|
+
def_delegators :@config,
|
47
|
+
:api_definition,
|
48
|
+
:api_definition=,
|
49
|
+
:curation_concerns,
|
50
|
+
:curation_concerns=,
|
51
|
+
:default_field_mapping,
|
52
|
+
:default_field_mapping=,
|
53
|
+
:default_work_type,
|
54
|
+
:default_work_type=,
|
55
|
+
:export_path,
|
56
|
+
:export_path=,
|
57
|
+
:field_mappings,
|
58
|
+
:field_mappings=,
|
59
|
+
:file_model_class,
|
60
|
+
:file_model_class=,
|
61
|
+
:fill_in_blank_source_identifiers,
|
62
|
+
:fill_in_blank_source_identifiers=,
|
63
|
+
:generated_metadata_mapping,
|
64
|
+
:generated_metadata_mapping=,
|
65
|
+
:import_path,
|
66
|
+
:import_path=,
|
67
|
+
:multi_value_element_join_on,
|
68
|
+
:multi_value_element_join_on=,
|
69
|
+
:multi_value_element_split_on,
|
70
|
+
:multi_value_element_split_on=,
|
71
|
+
:object_factory,
|
72
|
+
:object_factory=,
|
73
|
+
:parsers,
|
74
|
+
:parsers=,
|
75
|
+
:qa_controlled_properties,
|
76
|
+
:qa_controlled_properties=,
|
77
|
+
:related_children_field_mapping,
|
78
|
+
:related_children_field_mapping=,
|
79
|
+
:related_parents_field_mapping,
|
80
|
+
:related_parents_field_mapping=,
|
81
|
+
:relationship_job_class,
|
82
|
+
:relationship_job_class=,
|
83
|
+
:removed_image_path,
|
84
|
+
:removed_image_path=,
|
85
|
+
:required_elements,
|
86
|
+
:required_elements=,
|
87
|
+
:reserved_properties,
|
88
|
+
:reserved_properties=,
|
89
|
+
:server_name,
|
90
|
+
:server_name=
|
91
|
+
|
92
|
+
config do |conf|
|
93
|
+
conf.parsers = [
|
34
94
|
{ name: "OAI - Dublin Core", class_name: "Bulkrax::OaiDcParser", partial: "oai_fields" },
|
35
95
|
{ name: "OAI - Qualified Dublin Core", class_name: "Bulkrax::OaiQualifiedDcParser", partial: "oai_fields" },
|
36
96
|
{ name: "CSV - Comma Separated Values", class_name: "Bulkrax::CsvParser", partial: "csv_fields" },
|
@@ -38,16 +98,34 @@ module Bulkrax
|
|
38
98
|
{ name: "XML", class_name: "Bulkrax::XmlParser", partial: "xml_fields" }
|
39
99
|
]
|
40
100
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
101
|
+
conf.import_path = Bulkrax.import_path || 'tmp/imports'
|
102
|
+
conf.export_path = Bulkrax.export_path || 'tmp/exports'
|
103
|
+
conf.removed_image_path = Bulkrax::Engine.root.join('spec', 'fixtures', 'removed.png').to_s
|
104
|
+
conf.server_name = 'bulkrax@example.com'
|
105
|
+
conf.relationship_job_class = "Bulkrax::CreateRelationshipsJob"
|
106
|
+
conf.required_elements = ['title']
|
107
|
+
|
108
|
+
def conf.curation_concerns
|
109
|
+
@curation_concerns ||= defined?(::Hyrax) ? ::Hyrax.config.curation_concerns : []
|
110
|
+
end
|
111
|
+
|
112
|
+
def conf.curation_concerns=(val)
|
113
|
+
@curation_concerns = val
|
114
|
+
end
|
115
|
+
|
116
|
+
def conf.file_model_class
|
117
|
+
@file_model_class ||= defined?(::Hyrax) ? ::FileSet : File
|
118
|
+
end
|
119
|
+
|
120
|
+
def conf.file_model_class=(val)
|
121
|
+
@file_model_class = val
|
122
|
+
end
|
45
123
|
|
46
124
|
# Hash of Generic field_mappings for use in the view
|
47
|
-
# There must be one field_mappings hash per view
|
125
|
+
# There must be one field_mappings hash per view partial
|
48
126
|
# Based on Hyrax CoreMetadata && BasicMetadata
|
49
127
|
# Override at application level to change
|
50
|
-
|
128
|
+
conf.field_mappings = {
|
51
129
|
"Bulkrax::OaiDcParser" => {
|
52
130
|
"contributor" => { from: ["contributor"] },
|
53
131
|
# no appropriate mapping for coverage (based_near needs id)
|
@@ -95,7 +173,7 @@ module Bulkrax
|
|
95
173
|
}
|
96
174
|
|
97
175
|
# Lambda to set the default field mapping
|
98
|
-
|
176
|
+
conf.default_field_mapping = lambda do |field|
|
99
177
|
return if field.blank?
|
100
178
|
{
|
101
179
|
field.to_s =>
|
@@ -110,7 +188,7 @@ module Bulkrax
|
|
110
188
|
end
|
111
189
|
|
112
190
|
# Properties that should not be used in imports. They are reserved for use by Hyrax.
|
113
|
-
|
191
|
+
conf.reserved_properties = %w[
|
114
192
|
create_date
|
115
193
|
modified_date
|
116
194
|
date_modified
|
@@ -133,10 +211,10 @@ module Bulkrax
|
|
133
211
|
# List of Questioning Authority properties that are controlled via YAML files in
|
134
212
|
# the config/authorities/ directory. For example, the :rights_statement property
|
135
213
|
# is controlled by the active terms in config/authorities/rights_statements.yml
|
136
|
-
|
214
|
+
conf.qa_controlled_properties = %w[rights_statement license]
|
137
215
|
end
|
138
216
|
|
139
|
-
def
|
217
|
+
def api_definition
|
140
218
|
@api_definition ||= ActiveSupport::HashWithIndifferentAccess.new(
|
141
219
|
YAML.safe_load(
|
142
220
|
ERB.new(
|
@@ -149,9 +227,9 @@ module Bulkrax
|
|
149
227
|
DEFAULT_MULTI_VALUE_ELEMENT_JOIN_ON = ' | '
|
150
228
|
# Specify the delimiter for joining an attribute's multi-value array into a string.
|
151
229
|
#
|
152
|
-
# @note the specific
|
230
|
+
# @note the specific delimiter should likely be present in the multi_value_element_split_on
|
153
231
|
# expression.
|
154
|
-
def
|
232
|
+
def multi_value_element_join_on
|
155
233
|
@multi_value_element_join_on ||= DEFAULT_MULTI_VALUE_ELEMENT_JOIN_ON
|
156
234
|
end
|
157
235
|
|
@@ -161,7 +239,7 @@ module Bulkrax
|
|
161
239
|
#
|
162
240
|
# @note The "true" value is to preserve backwards compatibility.
|
163
241
|
# @see DEFAULT_MULTI_VALUE_ELEMENT_JOIN_ON
|
164
|
-
def
|
242
|
+
def multi_value_element_split_on
|
165
243
|
if @multi_value_element_join_on.is_a?(TrueClass)
|
166
244
|
DEFAULT_MULTI_VALUE_ELEMENT_SPLIT_ON
|
167
245
|
else
|
@@ -169,23 +247,24 @@ module Bulkrax
|
|
169
247
|
end
|
170
248
|
end
|
171
249
|
|
172
|
-
# this function maps the vars from your app into your engine
|
173
|
-
def self.setup
|
174
|
-
yield self
|
175
|
-
end
|
176
|
-
|
177
250
|
# Responsible for stripping hidden characters from the given string.
|
178
251
|
#
|
179
252
|
# @param value [#to_s]
|
180
253
|
# @return [String] with hidden characters removed
|
181
254
|
#
|
182
255
|
# @see https://github.com/samvera-labs/bulkrax/issues/688
|
183
|
-
def
|
256
|
+
def normalize_string(value)
|
184
257
|
# Removing [Byte Order Mark (BOM)](https://en.wikipedia.org/wiki/Byte_order_mark)
|
185
258
|
value.to_s.delete("\xEF\xBB\xBF")
|
186
259
|
end
|
187
260
|
|
188
|
-
|
261
|
+
def fallback_user_for_importer_exporter_processing
|
262
|
+
return User.batch_user if defined?(Hyrax) && User.respond_to?(:batch_user)
|
263
|
+
|
264
|
+
raise "We have no fallback user available for Bulkrax.fallback_user_for_importer_exporter_processing"
|
265
|
+
end
|
266
|
+
|
267
|
+
# This class confirms to the Active::Support.serialize interface. It's job is to ensure that we
|
189
268
|
# don't have keys with the tricksy Byte Order Mark character.
|
190
269
|
#
|
191
270
|
# @see https://api.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Serialization/ClassMethods.html#method-i-serialize
|
@@ -72,7 +72,7 @@ Bulkrax.setup do |config|
|
|
72
72
|
# config.qa_controlled_properties += ['my_field']
|
73
73
|
|
74
74
|
# Specify the delimiter regular expression for splitting an attribute's values into a multi-value array.
|
75
|
-
# config.multi_value_element_split_on =
|
75
|
+
# config.multi_value_element_split_on = /\s*[:;|]\s*/.freeze
|
76
76
|
|
77
77
|
# Specify the delimiter for joining an attribute's multi-value array into a string. Note: the
|
78
78
|
# specific delimeter should likely be present in the multi_value_element_split_on expression.
|
data/lib/tasks/reset.rake
CHANGED
@@ -32,7 +32,7 @@ namespace :hyrax do
|
|
32
32
|
Mailboxer::Notification.delete_all
|
33
33
|
Mailboxer::Conversation::OptOut.delete_all
|
34
34
|
Mailboxer::Conversation.delete_all
|
35
|
-
AccountElevator.switch!(
|
35
|
+
AccountElevator.switch!(Site.instance.account) if defined?(AccountElevator)
|
36
36
|
# we need to wait till Fedora is done with its cleanup
|
37
37
|
# otherwise creating the admin set will fail
|
38
38
|
while AdminSet.exists?(AdminSet::DEFAULT_ID)
|
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: 5.
|
4
|
+
version: 5.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Kaufman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -327,6 +327,7 @@ files:
|
|
327
327
|
- app/parsers/bulkrax/csv_parser.rb
|
328
328
|
- app/parsers/bulkrax/oai_dc_parser.rb
|
329
329
|
- app/parsers/bulkrax/oai_qualified_dc_parser.rb
|
330
|
+
- app/parsers/bulkrax/parser_export_record_set.rb
|
330
331
|
- app/parsers/bulkrax/xml_parser.rb
|
331
332
|
- app/services/bulkrax/remove_relationships_for_importer.rb
|
332
333
|
- app/views/bulkrax/entries/_parsed_metadata.html.erb
|
@@ -396,6 +397,7 @@ files:
|
|
396
397
|
- db/migrate/20220609001128_rename_bulkrax_importer_run_to_importer_run.rb
|
397
398
|
- lib/bulkrax.rb
|
398
399
|
- lib/bulkrax/engine.rb
|
400
|
+
- lib/bulkrax/entry_spec_helper.rb
|
399
401
|
- lib/bulkrax/version.rb
|
400
402
|
- lib/generators/bulkrax/install_generator.rb
|
401
403
|
- lib/generators/bulkrax/templates/README
|
@@ -425,7 +427,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
425
427
|
- !ruby/object:Gem::Version
|
426
428
|
version: '0'
|
427
429
|
requirements: []
|
428
|
-
rubygems_version: 3.
|
430
|
+
rubygems_version: 3.1.6
|
429
431
|
signing_key:
|
430
432
|
specification_version: 4
|
431
433
|
summary: Import and export tool for Hyrax and Hyku
|