darlingtonia 3.0.3 → 3.0.4

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: fccf4f74b294b16ddf86169a11cf05fa000acb4d76f2d3e0e53478570925ffbc
4
- data.tar.gz: f572b72305be4c963cfeafd03375920740fc37b19c6eb9a9fe670c427a704cf7
3
+ metadata.gz: b417d442d5f092672b0843b6e4f724a6fed90c0913a8470976edb5b17c367b25
4
+ data.tar.gz: b6240dd8d7c293f128f8905bd2dcd1e664ef90d0b81b892ee3a3e30a3d67b9bc
5
5
  SHA512:
6
- metadata.gz: afd4ad7a896b84d6b51a048cdbfb0d74beb87fc4296296625267741323804ba55e0b78aeb400195e930fcea6401c7323f534d3aba443989237ee783177eca593
7
- data.tar.gz: d2297c4746b3b797ee90750baad25ec5fa326da33963bf67f73e05b31d1cb2655d0a34876dc3fbeba1e5e78838733699bae9442ce839d63161a685a6bc529bfe
6
+ metadata.gz: 39cb14bd001b7359b69284a45fbe8642a0e4a797a67ecccd66bc3e1722576eb63994e8efa16cfad8257c6e1fdbcb94a5141d1224b6ac05b2a360ca897ed88a8f
7
+ data.tar.gz: 4b99fc45b3434de8fbf398a8397c689ce49617bb081f2047dc4f483cbcc8fdd2922f26d356b81c54debc4943c084ffd52d75805e6cf6570cd04db465c7a3d2cf
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ 3.0.4 - Fri Feb 22, 2019
2
+
3
+ * Allow subclassed libraries not to have a files field
4
+
5
+ It should be fine to use HyraxRecordImporter with a customized mapper
6
+ that does not contain a field called files. There are other strategies
7
+ for attaching files, such as the remote_files strategy used at UCLA in
8
+ the Californica project.
9
+
1
10
  3.0.3 - Thu Feb 21, 2019
2
11
 
3
12
  * Bug fix: Ensure there is no files metadata field passed
@@ -86,6 +86,7 @@ module Darlingtonia
86
86
  # @param [Darlingtonia::InputRecord]
87
87
  # @return [Array] an array of Hyrax::UploadedFile ids
88
88
  def create_upload_files(record)
89
+ return unless record.mapper.respond_to?(:files)
89
90
  files_to_attach = record.mapper.files
90
91
  return [] if files_to_attach.nil? || files_to_attach.empty?
91
92
 
@@ -178,7 +179,7 @@ module Darlingtonia
178
179
  attrs)
179
180
 
180
181
  if Hyrax::CurationConcern.actor.create(actor_env)
181
- info_stream << "event: record_created, batch_id: #{batch_id}, record_id: #{created.id}, collection_id: #{collection_id}, record_title: #{attrs[:title].first}"
182
+ info_stream << "event: record_created, batch_id: #{batch_id}, record_id: #{created.id}, collection_id: #{collection_id}, record_title: #{attrs[:title]&.first}"
182
183
  @success_count += 1
183
184
  else
184
185
  created.errors.each do |attr, msg|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Darlingtonia
4
- VERSION = '3.0.3'
4
+ VERSION = '3.0.4'
5
5
  end
@@ -40,6 +40,29 @@ describe Darlingtonia::HyraxRecordImporter, :clean do
40
40
  end
41
41
  end
42
42
 
43
+ # Instead of having a files field in the mapper, which will create a
44
+ # Hyrax::UploadedFile for each file before attaching it, some importers will
45
+ # use a remote_files strategy and instead treat each file as a remote file and
46
+ # fetch it at object creation time. This might be faster, and we might eventually
47
+ # want to adopt it as our default. For now, do not raise an error if there is no
48
+ # `files` field in the mapper being used.
49
+ context 'with no files filed in the mapper' do
50
+ let(:metadata) do
51
+ {
52
+ 'title' => 'A Title',
53
+ 'language' => 'English',
54
+ 'visibility' => 'open'
55
+ }
56
+ end
57
+ let(:record) { Darlingtonia::InputRecord.from(metadata: metadata, mapper: Darlingtonia::MetadataMapper.new) }
58
+
59
+ it 'creates a work for record' do
60
+ expect { importer.import(record: record) }
61
+ .to change { Work.count }
62
+ .by 1
63
+ end
64
+ end
65
+
43
66
  context 'with attached files' do
44
67
  before do
45
68
  ENV['IMPORT_PATH'] = File.expand_path('../fixtures/images', File.dirname(__FILE__))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: darlingtonia
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Data Curation Experts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-21 00:00:00.000000000 Z
11
+ date: 2019-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active-fedora