zizia 2.1.0.alpha.08 → 2.1.0.alpha.09

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f01e21a72b0a90ff796529c072cf9c5a68d5509d054e125112bb43cd30544699
4
- data.tar.gz: f251b98deed66733a0a2b1634fac07b330dac06c7c781a28ee5ce39ad369150a
3
+ metadata.gz: df38310eefb6cf286ea8be271801a25f0220b895f75606152d24da1d229516f7
4
+ data.tar.gz: 38c2bece99c72f109498e1a2778528a1d4a1d0909745c72eb347c9c60bc40679
5
5
  SHA512:
6
- metadata.gz: 300027bae9529295cbedfb3802a07321ce31a56c8af99293d72b009c6f44b04d231c6ae7446d461455d923d606e84ec20b7ae5fa7069ca553941849e9a04d1e7
7
- data.tar.gz: 51f2ae499e189a88ab984d59e80f59ff6763680f2c8fbc71c4ba73f358e168aa421b38116218493764beaadfa75d4c3c39bc9c66f4b45ecc34392cc73a005dc7
6
+ metadata.gz: 2ceffb44d966e00d57549a94b2f107e0b33be5fd90dde44988668791951e3711f61fb60802045dbad4c5b415d251be0c2b26908c7b6ed18d19a61890170a5a0b
7
+ data.tar.gz: a819a0a23c09bf88e9ab15cd99d85c5dba0c52ae5cb962af5c2f163c9b666871dc3dda2fb8f7ebfdf57e28e31a03bed17a33fd049623e7e3b150a6101b87d6af
data/.circleci/config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  version: 2.1
2
2
  orbs:
3
- samvera: samvera/circleci-orb@dev:fix-bundle-cache
3
+ samvera: samvera/circleci-orb@0.3.1
4
4
  jobs:
5
5
  build:
6
6
  parameters:
data/README.md CHANGED
@@ -11,7 +11,7 @@ information. See the <a href="https://curationexperts.github.io/zizia/">Getting
11
11
 
12
12
 
13
13
  [![Gem Version](https://badge.fury.io/rb/zizia.svg)](https://badge.fury.io/rb/zizia)
14
- [![Build Status](https://travis-ci.org/curationexperts/zizia.svg?branch=master)](https://travis-ci.org/curationexperts/zizia)
14
+ [![CircleCI](https://circleci.com/gh/curationexperts/zizia.svg?style=svg)](https://circleci.com/gh/curationexperts/zizia)
15
15
  [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/gems/zizia) [![Coverage Status](https://coveralls.io/repos/github/curationexperts/zizia/badge.svg?branch=coveralls)](https://coveralls.io/github/curationexperts/zizia?branch=coveralls)
16
16
 
17
17
  </td></tr>
@@ -24,7 +24,7 @@ class ModularImporter
24
24
 
25
25
  file = File.open(@csv_file)
26
26
 
27
- Zizia.config.default_info_stream << "event: start_import, batch_id: #{@csv_import.id}, collection_id: #{@collection_id}, user: #{@user_email}"
27
+ Zizia.config.default_info_stream << "[zizia] event: start_import, batch_id: #{@csv_import.id}, collection_id: #{@collection_id}, user: #{@user_email}"
28
28
  Zizia::Importer.new(parser: Zizia::CsvParser.new(file: file), record_importer: Zizia::HyraxRecordImporter.new(attributes: attrs)).import
29
29
  file.close
30
30
  end
@@ -193,7 +193,7 @@ module Zizia
193
193
  # We assume the object was created as expected if the actor stack returns true.
194
194
  # Note that for now the update stack will only update metadata and update collection membership, it will not re-import files.
195
195
  def update_for(existing_record:, update_record:)
196
- info_stream << "event: record_update_started, batch_id: #{batch_id}, collection_id: #{collection_id}, #{deduplication_field}: #{update_record.respond_to?(deduplication_field) ? update_record.send(deduplication_field) : update_record}"
196
+ info_stream << "[zizia] event: record_update_started, batch_id: #{batch_id}, collection_id: #{collection_id}, #{deduplication_field}: #{update_record.respond_to?(deduplication_field) ? update_record.send(deduplication_field) : update_record}"
197
197
  additional_attrs = {
198
198
  depositor: @depositor.user_key
199
199
  }
@@ -211,11 +211,11 @@ module Zizia
211
211
 
212
212
  actor_env = Hyrax::Actors::Environment.new(existing_record, ::Ability.new(@depositor), attrs)
213
213
  if metadata_only_middleware.update(actor_env)
214
- info_stream << "event: record_updated, batch_id: #{batch_id}, record_id: #{existing_record.id}, collection_id: #{collection_id}, #{deduplication_field}: #{existing_record.respond_to?(deduplication_field) ? existing_record.send(deduplication_field) : existing_record}"
214
+ info_stream << "[zizia] event: record_updated, batch_id: #{batch_id}, record_id: #{existing_record.id}, collection_id: #{collection_id}, #{deduplication_field}: #{existing_record.respond_to?(deduplication_field) ? existing_record.send(deduplication_field) : existing_record}"
215
215
  @success_count += 1
216
216
  else
217
217
  existing_record.errors.each do |attr, msg|
218
- error_stream << "event: validation_failed, batch_id: #{batch_id}, collection_id: #{collection_id}, attribute: #{attr.capitalize}, message: #{msg}, record_title: record_title: #{attrs[:title] ? attrs[:title] : attrs}"
218
+ error_stream << "[zizia] event: validation_failed, batch_id: #{batch_id}, collection_id: #{collection_id}, attribute: #{attr.capitalize}, message: #{msg}, record_title: record_title: #{attrs[:title] ? attrs[:title] : attrs}"
219
219
  end
220
220
  @failure_count += 1
221
221
  end
@@ -224,7 +224,7 @@ module Zizia
224
224
  # Create an object using the Hyrax actor stack
225
225
  # We assume the object was created as expected if the actor stack returns true.
226
226
  def create_for(record:)
227
- info_stream << "event: record_import_started, batch_id: #{batch_id}, collection_id: #{collection_id}, record_title: #{record.respond_to?(:title) ? record.title : record}"
227
+ info_stream << "[zizia] event: record_import_started, batch_id: #{batch_id}, collection_id: #{collection_id}, record_title: #{record.respond_to?(:title) ? record.title : record}"
228
228
 
229
229
  additional_attrs = {
230
230
  uploaded_files: create_upload_files(record),
@@ -248,11 +248,11 @@ module Zizia
248
248
  attrs)
249
249
 
250
250
  if Hyrax::CurationConcern.actor.create(actor_env)
251
- info_stream << "event: record_created, batch_id: #{batch_id}, record_id: #{created.id}, collection_id: #{collection_id}, record_title: #{attrs[:title]&.first}"
251
+ info_stream << "[zizia] event: record_created, batch_id: #{batch_id}, record_id: #{created.id}, collection_id: #{collection_id}, record_title: #{attrs[:title]&.first}"
252
252
  @success_count += 1
253
253
  else
254
254
  created.errors.each do |attr, msg|
255
- error_stream << "event: validation_failed, batch_id: #{batch_id}, collection_id: #{collection_id}, attribute: #{attr.capitalize}, message: #{msg}, record_title: record_title: #{attrs[:title] ? attrs[:title] : attrs}"
255
+ error_stream << "[zizia] event: validation_failed, batch_id: #{batch_id}, collection_id: #{collection_id}, attribute: #{attr.capitalize}, message: #{msg}, record_title: record_title: #{attrs[:title] ? attrs[:title] : attrs}"
256
256
  end
257
257
  @failure_count += 1
258
258
  end
@@ -40,8 +40,8 @@ module Zizia
40
40
 
41
41
  # Do not attempt to run an import if there are no records. Instead, just write to the log.
42
42
  def no_records_message
43
- @info_stream << "event: empty_import, batch_id: #{record_importer.batch_id}"
44
- @error_stream << "event: empty_import, batch_id: #{record_importer.batch_id}"
43
+ @info_stream << "[zizia] event: empty_import, batch_id: #{record_importer.batch_id}"
44
+ @error_stream << "[zizia] event: empty_import, batch_id: #{record_importer.batch_id}"
45
45
  end
46
46
 
47
47
  ##
@@ -51,11 +51,11 @@ module Zizia
51
51
  def import
52
52
  no_records_message && return unless records.count.positive?
53
53
  start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
54
- @info_stream << "event: start_import, batch_id: #{record_importer.batch_id}, expecting to import #{records.count} records."
54
+ @info_stream << "[zizia] event: start_import, batch_id: #{record_importer.batch_id}, expecting to import #{records.count} records."
55
55
  records.each { |record| record_importer.import(record: record) }
56
56
  end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
57
57
  elapsed_time = end_time - start_time
58
- @info_stream << "event: finish_import, batch_id: #{record_importer.batch_id}, successful_record_count: #{record_importer.success_count}, failed_record_count: #{record_importer.failure_count}, elapsed_time: #{elapsed_time}, elapsed_time_per_record: #{elapsed_time / records.count}"
58
+ @info_stream << "[zizia] event: finish_import, batch_id: #{record_importer.batch_id}, successful_record_count: #{record_importer.success_count}, failed_record_count: #{record_importer.failure_count}, elapsed_time: #{elapsed_time}, elapsed_time_per_record: #{elapsed_time / records.count}"
59
59
  end
60
60
  end
61
61
  end
data/lib/zizia/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zizia
4
- VERSION = '2.1.0.alpha.08'
4
+ VERSION = '2.1.0.alpha.09'
5
5
  end
@@ -5,7 +5,11 @@ require 'spec_helper'
5
5
  RSpec.describe Zizia::CsvTemplate do
6
6
  let(:csv_template) { described_class.new }
7
7
 
8
- it 'retruns a CSV string based on the headers in the Hyrax mapper' do
8
+ before do
9
+ Zizia.config.metadata_mapper_class = Zizia::HyraxBasicMetadataMapper
10
+ end
11
+
12
+ it 'returns a CSV string based on the headers in the Hyrax mapper' do
9
13
  expect(csv_template.to_s).to eq(Zizia::HyraxBasicMetadataMapper.new.fields.join(','))
10
14
  end
11
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zizia
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.alpha.08
4
+ version: 2.1.0.alpha.09
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-08-16 00:00:00.000000000 Z
11
+ date: 2019-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active-fedora