bulkrax 9.0.2 → 9.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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -0
  3. data/app/assets/javascripts/bulkrax/datatables.js +12 -0
  4. data/app/assets/javascripts/bulkrax/importers.js.erb +4 -1
  5. data/app/factories/bulkrax/object_factory.rb +36 -2
  6. data/app/factories/bulkrax/object_factory_interface.rb +26 -0
  7. data/app/factories/bulkrax/valkyrie_object_factory.rb +109 -27
  8. data/app/jobs/bulkrax/create_relationships_job.rb +123 -76
  9. data/app/jobs/bulkrax/delete_job.rb +11 -0
  10. data/app/jobs/bulkrax/importer_job.rb +1 -0
  11. data/app/matchers/bulkrax/application_matcher.rb +2 -1
  12. data/app/models/bulkrax/csv_entry.rb +41 -10
  13. data/app/models/bulkrax/importer.rb +9 -1
  14. data/app/models/bulkrax/status.rb +1 -1
  15. data/app/models/concerns/bulkrax/export_behavior.rb +28 -15
  16. data/app/models/concerns/bulkrax/file_set_entry_behavior.rb +13 -4
  17. data/app/models/concerns/bulkrax/importer_exporter_behavior.rb +1 -1
  18. data/app/parsers/bulkrax/application_parser.rb +22 -4
  19. data/app/parsers/bulkrax/csv_parser.rb +36 -6
  20. data/app/parsers/bulkrax/oai_dc_parser.rb +0 -2
  21. data/app/parsers/bulkrax/xml_parser.rb +1 -1
  22. data/app/services/bulkrax/factory_class_finder.rb +56 -15
  23. data/app/services/hyrax/custom_queries/find_by_source_identifier.rb +6 -11
  24. data/app/services/wings/custom_queries/find_by_source_identifier.rb +15 -6
  25. data/app/views/bulkrax/entries/show.html.erb +15 -9
  26. data/app/views/bulkrax/importers/_bagit_fields.html.erb +1 -1
  27. data/app/views/bulkrax/importers/_csv_fields.html.erb +1 -1
  28. data/app/views/bulkrax/importers/_oai_fields.html.erb +1 -1
  29. data/app/views/bulkrax/importers/_xml_fields.html.erb +1 -1
  30. data/app/views/bulkrax/importers/show.html.erb +4 -4
  31. data/app/views/bulkrax/shared/_entries_tab.html.erb +1 -1
  32. data/config/locales/bulkrax.en.yml +5 -3
  33. data/lib/bulkrax/engine.rb +1 -1
  34. data/lib/bulkrax/version.rb +1 -1
  35. data/lib/bulkrax.rb +6 -11
  36. data/lib/generators/bulkrax/templates/bin/importer +1 -5
  37. metadata +8 -3
  38. data/app/factories/bulkrax/valkyrize-hyku.code-workspace +0 -19
@@ -38,7 +38,7 @@ module Bulkrax
38
38
  # We aren't right now because so many Bulkrax users are in between Fedora and Valkyrie
39
39
  if model.casecmp('collection').zero? || model.casecmp('collectionresource').zero?
40
40
  @collections << r
41
- elsif model.casecmp('fileset').zero?
41
+ elsif model.casecmp('fileset').zero? || model.casecmp('hyrax::fileset').zero?
42
42
  @file_sets << r
43
43
  else
44
44
  @works << r
@@ -248,14 +248,22 @@ module Bulkrax
248
248
  if file_sets.nil? # for valkyrie
249
249
  file_sets = record.respond_to?(:file_sets) ? record.file_sets : record.members&.select(&:file_set?)
250
250
  end
251
- file_sets << record.thumbnail if exporter.include_thumbnails && record.thumbnail.present? && record.work?
251
+
252
+ if importerexporter.include_thumbnails?
253
+ thumbnail = Bulkrax.object_factory.thumbnail_for(resource: record)
254
+ file_sets << thumbnail if thumbnail.present?
255
+ end
256
+
252
257
  file_sets.each do |fs|
253
258
  path = File.join(exporter_export_path, folder_count, 'files')
254
259
  FileUtils.mkdir_p(path) unless File.exist? path
260
+
261
+ original_file = Bulkrax.object_factory.original_file(fileset: fs)
262
+ next if original_file.blank?
255
263
  file = filename(fs)
256
- next if file.blank? || fs.original_file.blank?
257
264
 
258
- io = fs.original_file.respond_to?(:uri) ? open(fs.original_file.uri) : fs.original_file.file.io
265
+ io = original_file.respond_to?(:uri) ? open(original_file.uri) : original_file.file.io
266
+
259
267
  File.open(File.join(path, file), 'wb') do |f|
260
268
  f.write(io.read)
261
269
  f.close
@@ -263,6 +271,8 @@ module Bulkrax
263
271
  end
264
272
  rescue Ldp::Gone
265
273
  return
274
+ rescue StandardError => e
275
+ raise StandardError, "Unable to retrieve files for identifier #{identifier} - #{e.message}"
266
276
  end
267
277
 
268
278
  def export_key_allowed(key)
@@ -341,7 +351,16 @@ module Bulkrax
341
351
  file_mapping = Bulkrax.field_mappings.dig(self.class.to_s, 'file', :from)&.first&.to_sym || :file
342
352
  next if r[file_mapping].blank?
343
353
 
344
- r[file_mapping].split(Bulkrax.multi_value_element_split_on).map do |f|
354
+ split_value = Bulkrax.field_mappings.dig(self.class.to_s, :file, :split)
355
+ split_pattern = case split_value
356
+ when Regexp
357
+ split_value
358
+ when String
359
+ Regexp.new(split_value)
360
+ else
361
+ Bulkrax.multi_value_element_split_on
362
+ end
363
+ r[file_mapping].split(split_pattern).map do |f|
345
364
  file = File.join(path_to_files, f.tr(' ', '_'))
346
365
  if File.exist?(file) # rubocop:disable Style/GuardClause
347
366
  file
@@ -360,6 +379,11 @@ module Bulkrax
360
379
  @path_to_files = File.join(
361
380
  zip? ? importer_unzip_path : File.dirname(import_file_path), 'files', filename
362
381
  )
382
+
383
+ return @path_to_files if File.exist?(@path_to_files)
384
+
385
+ # TODO: This method silently returns nil if there is no file & no zip file
386
+ File.join(importer_unzip_path, 'files', filename) if file? && zip?
363
387
  end
364
388
 
365
389
  private
@@ -379,9 +403,15 @@ module Bulkrax
379
403
  # We expect a single CSV at the top level of the zip in the CSVParser
380
404
  # but we are willing to go look for it if need be
381
405
  def real_import_file_path
382
- return Dir["#{importer_unzip_path}/**/*.csv"].first if file? && zip?
406
+ return Dir["#{importer_unzip_path}/**/*.csv"].reject { |path| in_files_dir?(path) }.first if file? && zip?
383
407
 
384
408
  parser_fields['import_file_path']
385
409
  end
410
+
411
+ # If there are CSVs that are meant to be attachments in the files directory,
412
+ # we don't want to consider them as the import CSV
413
+ def in_files_dir?(path)
414
+ File.dirname(path).ends_with?('files')
415
+ end
386
416
  end
387
417
  end
@@ -61,8 +61,6 @@ module Bulkrax
61
61
  ['contributor', 'coverage', 'creator', 'date', 'description', 'format', 'identifier', 'language', 'publisher', 'relation', 'rights', 'source', 'subject', 'title', 'type']
62
62
  end
63
63
 
64
- delegate :list_sets, to: :client
65
-
66
64
  def create_objects(types = [])
67
65
  types.each do |object_type|
68
66
  send("create_#{object_type.pluralize}")
@@ -103,7 +103,7 @@ module Bulkrax
103
103
  end
104
104
 
105
105
  def good_file_type?(path)
106
- %w[.xml .xls .xsd].include?(File.extname(path)) || ::Marcel::MimeType.for(path).include?('application/xml')
106
+ %w[.xml .xls .xsd].include?(File.extname(path)) || ::Marcel::MimeType.for(path: path).include?('application/xml')
107
107
  end
108
108
 
109
109
  def total
@@ -66,27 +66,68 @@ module Bulkrax
66
66
  entry.default_work_type.constantize
67
67
  end
68
68
 
69
+ private
70
+
69
71
  ##
70
72
  # @api private
71
73
  # @return [String]
72
74
  def name
73
- fc = if entry.parsed_metadata&.[]('model').present?
74
- Array.wrap(entry.parsed_metadata['model']).first
75
- elsif entry.importerexporter&.mapping&.[]('work_type').present?
76
- # Because of delegation's nil guard, we're reaching rather far into the implementation
77
- # details.
78
- Array.wrap(entry.parsed_metadata['work_type']).first
79
- else
80
- entry.default_work_type
81
- end
82
-
83
- # Let's coerce this into the right shape; we're not mutating the string because it might well
84
- # be frozen.
85
- fc = fc.tr(' ', '_')
86
- fc = fc.downcase if fc.match?(/[-_]/)
87
- fc.camelcase
75
+ # Try each strategy in order until one returns a value
76
+ fc = find_factory_class_name || entry.default_work_type
77
+
78
+ # Normalize the string format
79
+ normalize_class_name(fc)
88
80
  rescue
89
81
  entry.default_work_type
90
82
  end
83
+
84
+ ##
85
+ # Try each strategy in sequence to find a factory class name
86
+ # @return [String, nil] the factory class name or nil if none found
87
+ def find_factory_class_name
88
+ prioritized_strategies = [
89
+ :model_from_parsed_metadata,
90
+ :work_type_from_parsed_metadata,
91
+ :model_from_raw_metadata,
92
+ :model_from_mapped_field
93
+ ]
94
+
95
+ # Return the first non-nil result
96
+ prioritized_strategies.each do |strategy|
97
+ result = send(strategy)
98
+ return result if result.present?
99
+ end
100
+
101
+ nil
102
+ end
103
+
104
+ def model_from_parsed_metadata
105
+ Array.wrap(entry.parsed_metadata['model']).first if entry.parsed_metadata&.[]('model').present?
106
+ end
107
+
108
+ def work_type_from_parsed_metadata
109
+ Array.wrap(entry.parsed_metadata['work_type']).first if entry.importerexporter&.mapping&.[]('work_type').present?
110
+ end
111
+
112
+ def model_from_raw_metadata
113
+ Array.wrap(entry.raw_metadata&.[]('model'))&.first if entry.raw_metadata&.[]('model').present?
114
+ end
115
+
116
+ def model_from_mapped_field
117
+ return nil unless entry.parser.model_field_mappings.any? { |field| entry.raw_metadata&.[](field).present? }
118
+ field = entry.parser.model_field_mappings.find { |f| entry.raw_metadata&.[](f).present? }
119
+ Array.wrap(entry.raw_metadata[field]).first
120
+ end
121
+
122
+ ##
123
+ # Normalize a class name string to proper format
124
+ # @param name [String] the class name to normalize
125
+ # @return [String] the normalized class name
126
+ def normalize_class_name(name)
127
+ name = name.to_s
128
+ name = name.tr(' ', '_')
129
+ name = name.downcase if name.match?(/[-_]/)
130
+ name.camelcase
131
+ end
91
132
  end
92
133
  end
@@ -6,7 +6,7 @@ module Hyrax
6
6
  # @see https://github.com/samvera/valkyrie/wiki/Queries#custom-queries
7
7
  class FindBySourceIdentifier
8
8
  def self.queries
9
- [:find_by_model_and_property_value]
9
+ [:find_by_property_value]
10
10
  end
11
11
 
12
12
  def initialize(query_service:)
@@ -18,30 +18,25 @@ module Hyrax
18
18
  delegate :orm_class, to: :resource_factory
19
19
 
20
20
  ##
21
- # @param model [Class, #internal_resource]
22
21
  # @param property [#to_s] the name of the property we're attempting to
23
22
  # query.
24
23
  # @param value [#to_s] the propety's value that we're trying to match.
25
24
  #
26
25
  # @return [NilClass] when no record was found
27
26
  # @return [Valkyrie::Resource] when a record was found
28
- #
29
- # @note This is not a real estate transaction nor a Zillow lookup.
30
- def find_by_model_and_property_value(model:, property:, value:)
31
- sql_query = sql_for_find_by_model_and_property_value
32
- # NOTE: Do we need to ask the model for it's internal_resource?
33
- # TODO: no => undefined method `internal_resource' for Image:Class
34
- query_service.run_query(sql_query, model, property, value).first
27
+ def find_by_property_value(property:, value:, **)
28
+ sql_query = sql_for_find_by_property_value
29
+ query_service.run_query(sql_query, property, value.to_s).first
35
30
  end
36
31
 
37
32
  private
38
33
 
39
- def sql_for_find_by_model_and_property_value
34
+ def sql_for_find_by_property_value
40
35
  # NOTE: This is querying the first element of the property, but we might
41
36
  # want to check all of the elements.
42
37
  <<-SQL
43
38
  SELECT * FROM orm_resources
44
- WHERE internal_resource = ? AND metadata -> ? ->> 0 = ?
39
+ WHERE metadata -> ? ->> 0 = ?
45
40
  LIMIT 1;
46
41
  SQL
47
42
  end
@@ -6,7 +6,7 @@ module Wings
6
6
  # Custom query override specific to Wings
7
7
 
8
8
  def self.queries
9
- [:find_by_model_and_property_value]
9
+ [:find_by_property_value]
10
10
  end
11
11
 
12
12
  attr_reader :query_service
@@ -16,11 +16,20 @@ module Wings
16
16
  @query_service = query_service
17
17
  end
18
18
 
19
- def find_by_model_and_property_value(model:, property:, value:, use_valkyrie: Hyrax.config.use_valkyrie?)
20
- # NOTE: This is using the Bulkrax::ObjectFactory (e.g. the one
21
- # envisioned for ActiveFedora). In doing this, we avoid the situation
22
- # where Bulkrax::ValkyrieObjectFactory calls this custom query.
23
- af_object = Bulkrax::ObjectFactory.search_by_property(value: value, klass: model, field: property)
19
+ # rubocop:disable Lint/UnusedMethodArgument
20
+ def find_by_property_value(property:, value:, search_field:, use_valkyrie: Hyrax.config.use_valkyrie?)
21
+ # rubocop:enable Lint/UnusedMethodArgument
22
+ # NOTE: This is using the Bulkrax::ObjectFactory (e.g. the one envisioned for ActiveFedora).
23
+ # In doing this, we avoid the situation where Bulkrax::ValkyrieObjectFactory calls this custom query.
24
+
25
+ # This is doing a solr search first, so we have to use the search_field instead of the property for "field"
26
+ # If it cannot find the object in Solr, it falls back to an ActiveFedora search, if the object is an ActiveFedora object
27
+ af_object = Bulkrax::ObjectFactory.search_by_property(
28
+ value: value,
29
+ klass: ActiveFedora::Base,
30
+ field: search_field,
31
+ name_field: property
32
+ )
24
33
 
25
34
  return if af_object.blank?
26
35
  return af_object unless use_valkyrie
@@ -33,17 +33,23 @@
33
33
 
34
34
  <p class='bulkrax-p-align'>
35
35
  <% if @importer.present? %>
36
- <%# TODO Consider how to account for Bulkrax.collection_model_class %>
37
- <% factory_record = @entry.factory.find %>
38
- <% if factory_record.present? && @entry.factory_class %>
39
- <strong><%= @entry.factory_class.model_name.human %> Link:</strong>
40
- <% if defined?(Hyrax) && @entry.factory_class.model_name.human == 'Collection' %>
41
- <%= link_to @entry.factory_class.model_name.human, hyrax.polymorphic_path(factory_record) %>
36
+ <%# TODO Consider how to account for Bulkrax.collection_model_class %>
37
+ <% begin %>
38
+ <% factory_record = @entry.factory.find rescue nil %>
39
+ <% if factory_record.present? %>
40
+ <% factory_record_class = factory_record.class %>
41
+ <% factory_record_class_human = factory_record_class.model_name.human %>
42
+ <strong><%= factory_record_class_human %> Link:</strong>
43
+ <% if defined?(Hyrax) && factory_record_class_human == 'Collection' %>
44
+ <%= link_to factory_record_class_human, hyrax.polymorphic_path(factory_record) %>
45
+ <% else %>
46
+ <%= link_to factory_record_class_human, main_app.polymorphic_path(factory_record) %>
47
+ <% end %>
42
48
  <% else %>
43
- <%= link_to @entry.factory_class.model_name.human, main_app.polymorphic_path(factory_record) %>
49
+ <strong>Item Link:</strong> Item has not yet been imported successfully
44
50
  <% end %>
45
- <% else %>
46
- <strong>Item Link:</strong> Item has not yet been imported successfully
51
+ <% rescue => e %>
52
+ <strong>Item Link:</strong> Unable to retrieve item (<%= e.message %>)
47
53
  <% end %>
48
54
  <% else %>
49
55
  <% record = @entry&.hyrax_record %>
@@ -35,7 +35,7 @@
35
35
  input_html: { class: 'form-control' } ,
36
36
  required: false
37
37
  %>
38
- <%= fi.input :override_rights_statement, as: :boolean, hint: 'If checked, always use the selected rights statment. If unchecked, use rights or rights_statement from the record and only use the provided value if dc:rights is blank.', input_html: { checked: (importer.parser_fields['override_rights_statement'] == "1") } %>
38
+ <%= fi.input :override_rights_statement, as: :boolean, hint: 'If checked, always use the selected rights statement. If unchecked, use rights or rights_statement from the record and only use the provided value if dc:rights is blank.', input_html: { checked: (importer.parser_fields['override_rights_statement'] == "1") } %>
39
39
  <% end %>
40
40
  <h4>Bag or Bags to Import:</h4>
41
41
  <p>File upload and Cloud File upload must be a Zip file containing a single BagIt Bag, or a folder containing multiple BagIt Bags.</p>
@@ -20,7 +20,7 @@
20
20
  input_html: { class: 'form-control' },
21
21
  required: false
22
22
  %>
23
- <%= fi.input :override_rights_statement, as: :boolean, hint: 'If checked, always use the selected rights statment. If unchecked, use rights or rights_statement from the record and only use the provided value if dc:rights is blank.', input_html: { checked: (importer.parser_fields['override_rights_statement'] == "1") } %>
23
+ <%= fi.input :override_rights_statement, as: :boolean, hint: 'If checked, always use the selected rights statement. If unchecked, use rights or rights_statement from the record and only use the provided value if dc:rights is blank.', input_html: { checked: (importer.parser_fields['override_rights_statement'] == "1") } %>
24
24
  <% end %>
25
25
  <h4>Add CSV or ZIP File to Import:</h4>
26
26
  <%# accept a single file upload; data files and bags will need to be added another way %>
@@ -26,7 +26,7 @@
26
26
  input_html: { class: 'form-control' },
27
27
  required: false
28
28
  %>
29
- <%= fi.input :override_rights_statement, as: :boolean, hint: 'If checked, always use the selected rights statment. If unchecked, use dc:rights from the record and only use the provided value if dc:rights is blank.', input_html: { checked: (importer.parser_fields['override_rights_statement'] == "1") } %>
29
+ <%= fi.input :override_rights_statement, as: :boolean, hint: 'If checked, always use the selected rights statement. If unchecked, use dc:rights from the record and only use the provided value if dc:rights is blank.', input_html: { checked: (importer.parser_fields['override_rights_statement'] == "1") } %>
30
30
  <% end %>
31
31
  <%= fi.input :thumbnail_url, required: false, as: :string, input_html: { value: importer.parser_fields['thumbnail_url'] } %>
32
32
  <div class="help-block well well-sm">
@@ -41,7 +41,7 @@
41
41
  item_helper: rights_statements.method(:include_current_value),
42
42
  input_html: { class: 'form-control' },
43
43
  required: false %>
44
- <%= fi.input :override_rights_statement, as: :boolean, hint: 'If checked, always use the selected rights statment. If unchecked, use rights or rights_statement from the record and only use the provided value if dc:rights is blank.', input_html: { checked: (importer.parser_fields['override_rights_statement'] == "1") } %>
44
+ <%= fi.input :override_rights_statement, as: :boolean, hint: 'If checked, always use the selected rights statement. If unchecked, use rights or rights_statement from the record and only use the provided value if dc:rights is blank.', input_html: { checked: (importer.parser_fields['override_rights_statement'] == "1") } %>
45
45
  <% end %>
46
46
  <h4>XML and files to Import:</h4>
47
47
  <p>File upload and Cloud File upload MUST be a either a single XML file (for metadata only import) OR a Zip file containing the XML files and data files, each in a separate folder.</p>
@@ -1,10 +1,10 @@
1
- <div class="col-xs-12 main-header">
1
+ <div class="col-xs-12 main-header d-flex justify-content-between align-items-center">
2
2
  <h1><span class="fa fa-cloud-upload" aria-hidden="true"></span> Importer: <%= @importer.name %></h1>
3
3
  <div class="pull-right">
4
- <%= link_to 'Download Original File', importer_original_file_path(@importer.id), class: 'btn btn-primary', data: { turbolinks: false } if @importer.original_file %>
4
+ <%= link_to 'Download Original File', importer_original_file_path(@importer.id), class: 'btn btn-primary text-nowrap', data: { turbolinks: false } if @importer.original_file %>
5
5
  <% if @importer.failed_entries? %>
6
- <%= link_to 'Export Errored Entries', importer_export_errors_path(@importer.id), class: 'btn btn-primary', data: { turbolinks: false }%>
7
- <%= link_to 'Upload Corrected Entries', importer_upload_corrected_entries_path(@importer.id), class: 'btn btn-primary' if @importer.parser.is_a?(Bulkrax::CsvParser) %>
6
+ <%= link_to 'Export Errored Entries', importer_export_errors_path(@importer.id), class: 'btn btn-primary text-nowrap', data: { turbolinks: false }%>
7
+ <%= link_to 'Upload Corrected Entries', importer_upload_corrected_entries_path(@importer.id), class: 'btn btn-primary text-nowrap' if @importer.parser.is_a?(Bulkrax::CsvParser) %>
8
8
  <% end %>
9
9
  </div>
10
10
  </div>
@@ -12,5 +12,5 @@
12
12
  </tr>
13
13
  </thead>
14
14
  </table>
15
- <div id='importer-entry-classes' class='hidden'><%= [item.parser.entry_class.to_s, item.parser.collection_entry_class.to_s, item.parser.file_set_entry_class.to_s].compact.join('|') %></div>
15
+ <div id='importer-entry-classes' class='hidden d-none'><%= [item.parser.entry_class.to_s, item.parser.collection_entry_class.to_s, item.parser.file_set_entry_class.to_s].compact.join('|') %></div>
16
16
  </div>
@@ -1,9 +1,9 @@
1
1
  en:
2
- helpers:
3
- action:
2
+ helpers:
3
+ action:
4
4
  importer:
5
5
  new: "New"
6
- exporter:
6
+ exporter:
7
7
  new: "New"
8
8
  bulkrax:
9
9
  admin:
@@ -75,6 +75,8 @@ en:
75
75
  identifier: Identifier
76
76
  entry_id: Entry ID
77
77
  status: Status
78
+ type: Type
79
+ updated_at: Updated At
78
80
  errors: Errors
79
81
  status_set_at: Status Set At
80
82
  actions: Actions
@@ -35,7 +35,7 @@ module Bulkrax
35
35
  ActionController::Base.view_paths = paths.uniq
36
36
 
37
37
  custom_query_strategies = {
38
- find_by_model_and_property_value: :find_single_or_nil
38
+ find_by_property_value: :find_single_or_nil
39
39
  }
40
40
 
41
41
  if defined?(::Goddess::CustomQueryContainer)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bulkrax
4
- VERSION = '9.0.2'
4
+ VERSION = '9.2.0'
5
5
  end
data/lib/bulkrax.rb CHANGED
@@ -107,11 +107,8 @@ module Bulkrax
107
107
  # Hyrax::FileSet.try(:internal_resource) || 'hi'
108
108
  # => #<Dry::Types::Result::Failure input=:internal_resource error=...
109
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
110
+ instance = collection_model_class.new
111
+ instance.respond_to?(:internal_resource) ? instance.internal_resource : collection_model_class.to_s
115
112
  end
116
113
 
117
114
  def file_model_class
@@ -130,11 +127,8 @@ module Bulkrax
130
127
  # Hyrax::FileSet.try(:internal_resource) || 'hi'
131
128
  # => #<Dry::Types::Result::Failure input=:internal_resource error=...
132
129
  # ```
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
130
+ instance = file_model_class.new
131
+ instance.respond_to?(:internal_resource) ? instance.internal_resource : file_model_class.to_s
138
132
  end
139
133
 
140
134
  def curation_concerns
@@ -154,7 +148,8 @@ module Bulkrax
154
148
  # Hyrax::FileSet.try(:internal_resource) || 'hi'
155
149
  # => #<Dry::Types::Result::Failure input=:internal_resource error=...
156
150
  # ```
157
- cc.respond_to?(:internal_resource) ? cc.internal_resource : cc.to_s
151
+ instance = cc.new
152
+ instance.respond_to?(:internal_resource) ? instance.internal_resource : cc.to_s
158
153
  end.uniq
159
154
  end
160
155
 
@@ -16,7 +16,7 @@ def main(opts = {})
16
16
  headers['Authorization'] = "Token: #{opts.delete(:auth_token)}"
17
17
  params = build_params(opts)
18
18
 
19
- logger.info("POST to #{url} - PARAMS #{params}")
19
+ Rails.logger.info("POST to #{url} - PARAMS #{params}")
20
20
 
21
21
  conn = Faraday.new(
22
22
  url: url,
@@ -92,10 +92,6 @@ def build_url(importer_id, url, port = nil)
92
92
  return url
93
93
  end
94
94
 
95
- def logger
96
- Rails.logger
97
- end
98
-
99
95
  def version
100
96
  puts "Bulkrax #{Bulkrax::VERSION}"
101
97
  puts "Slop #{Slop::VERSION}"
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: 9.0.2
4
+ version: 9.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: 2025-01-17 00:00:00.000000000 Z
11
+ date: 2025-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 5.1.6
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 7.0.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: 5.1.6
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 7.0.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bagit
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -345,7 +351,6 @@ files:
345
351
  - app/factories/bulkrax/object_factory.rb
346
352
  - app/factories/bulkrax/object_factory_interface.rb
347
353
  - app/factories/bulkrax/valkyrie_object_factory.rb
348
- - app/factories/bulkrax/valkyrize-hyku.code-workspace
349
354
  - app/helpers/bulkrax/application_helper.rb
350
355
  - app/helpers/bulkrax/exporters_helper.rb
351
356
  - app/helpers/bulkrax/importers_helper.rb
@@ -1,19 +0,0 @@
1
- {
2
- "folders": [
3
- {
4
- "path": "../../../../../hyku"
5
- },
6
- {
7
- "path": "../../../../hyrax"
8
- },
9
- {
10
- "path": "../../.."
11
- },
12
- {
13
- "path": "../../../../iiif_print"
14
- }
15
- ],
16
- "settings": {
17
- "github.copilot.inlineSuggest.enable": true
18
- }
19
- }