curation_concerns 1.7.6 → 1.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/app/jobs/characterize_job.rb +12 -5
- data/app/jobs/create_derivatives_job.rb +10 -5
- data/app/jobs/ingest_file_job.rb +13 -9
- data/app/services/curation_concerns/workflow/grant_edit_to_depositor.rb +1 -1
- data/lib/curation_concerns/version.rb +1 -1
- data/spec/services/curation_concerns/workflow/grant_edit_to_depositor_spec.rb +15 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60d64b0327762c6a74445d94e7933ac8fe6003e7
|
4
|
+
data.tar.gz: 8af9f568602191a9afaaa3fcee090c1e88ed4f67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f891d3bff4d44ed3a89b21911341304ac843466bda847cf5ba284e09690c708ee5e7efe069a2c99c36700342bf0ad211a15a4f5d077bdc9cf8ac99b99a1aba0d
|
7
|
+
data.tar.gz: 0819ec209d2471aec58f0c5c57cfc6cf16eaf28ec8fb61464653c400a873cfcd56aff481a3a60799a8fa0239c5cefb7f58aa04240782b1842d6d071779456366
|
data/.travis.yml
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
language: ruby
|
2
2
|
cache: bundler
|
3
3
|
sudo: false
|
4
|
+
|
4
5
|
rvm:
|
5
6
|
- 2.3.1
|
7
|
+
|
8
|
+
services: redis
|
9
|
+
|
6
10
|
env:
|
7
11
|
global:
|
8
12
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
@@ -11,5 +15,6 @@ env:
|
|
11
15
|
RDF_VERSION=1.99.1
|
12
16
|
- RAILS_VERSION=5.0.0.1
|
13
17
|
RDF_VERSION=2.1.1
|
18
|
+
|
14
19
|
before_script:
|
15
20
|
- jdk_switcher use oraclejdk8
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class CharacterizeJob < ActiveJob::Base
|
2
|
+
include CurationConcerns::Lockable
|
3
|
+
|
2
4
|
queue_as CurationConcerns.config.ingest_queue_name
|
3
5
|
|
4
6
|
# @param [FileSet] file_set
|
@@ -7,11 +9,16 @@ class CharacterizeJob < ActiveJob::Base
|
|
7
9
|
def perform(file_set, file_id, filepath = nil)
|
8
10
|
filename = CurationConcerns::WorkingDirectory.find_or_retrieve(file_id, file_set.id, filepath)
|
9
11
|
raise LoadError, "#{file_set.class.characterization_proxy} was not found" unless file_set.characterization_proxy?
|
10
|
-
|
11
|
-
|
12
|
-
file_set.
|
13
|
-
|
14
|
-
|
12
|
+
|
13
|
+
# Prevent other jobs from trying to modify the FileSet at the same time
|
14
|
+
acquire_lock_for(file_set.id) do
|
15
|
+
Hydra::Works::CharacterizationService.run(file_set.characterization_proxy, filename)
|
16
|
+
Rails.logger.debug "Ran characterization on #{file_set.characterization_proxy.id} (#{file_set.characterization_proxy.mime_type})"
|
17
|
+
file_set.characterization_proxy.save!
|
18
|
+
file_set.update_index
|
19
|
+
file_set.parent.in_collections.each(&:update_index) if file_set.parent
|
20
|
+
end
|
21
|
+
|
15
22
|
CreateDerivativesJob.perform_later(file_set, file_id, filename)
|
16
23
|
end
|
17
24
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class CreateDerivativesJob < ActiveJob::Base
|
2
|
+
include CurationConcerns::Lockable
|
3
|
+
|
2
4
|
queue_as CurationConcerns.config.ingest_queue_name
|
3
5
|
|
4
6
|
# @param [FileSet] file_set
|
@@ -8,12 +10,15 @@ class CreateDerivativesJob < ActiveJob::Base
|
|
8
10
|
return if file_set.video? && !CurationConcerns.config.enable_ffmpeg
|
9
11
|
filename = CurationConcerns::WorkingDirectory.find_or_retrieve(file_id, file_set.id, filepath)
|
10
12
|
|
11
|
-
|
13
|
+
# Prevent other jobs from trying to modify the FileSet at the same time
|
14
|
+
acquire_lock_for(file_set.id) do
|
15
|
+
file_set.create_derivatives(filename)
|
12
16
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
+
# Reload from Fedora and reindex for thumbnail and extracted text
|
18
|
+
file_set.reload
|
19
|
+
file_set.update_index
|
20
|
+
file_set.parent.update_index if parent_needs_reindex?(file_set)
|
21
|
+
end
|
17
22
|
end
|
18
23
|
|
19
24
|
# If this file_set is the thumbnail for the parent work,
|
data/app/jobs/ingest_file_job.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
class IngestFileJob < ActiveJob::Base
|
2
|
+
include CurationConcerns::Lockable
|
3
|
+
|
2
4
|
queue_as CurationConcerns.config.ingest_queue_name
|
3
5
|
|
4
6
|
# @param [FileSet] file_set
|
@@ -15,15 +17,17 @@ class IngestFileJob < ActiveJob::Base
|
|
15
17
|
local_file.mime_type = opts.fetch(:mime_type, nil)
|
16
18
|
local_file.original_name = opts.fetch(:filename, File.basename(filepath))
|
17
19
|
|
18
|
-
#
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
# Prevent other jobs from trying to modify the FileSet at the same time
|
21
|
+
acquire_lock_for(file_set.id) do
|
22
|
+
# Tell AddFileToFileSet service to skip versioning because versions will be minted by
|
23
|
+
# VersionCommitter when necessary during save_characterize_and_record_committer.
|
24
|
+
Hydra::Works::AddFileToFileSet.call(file_set,
|
25
|
+
local_file,
|
26
|
+
relation,
|
27
|
+
versioning: false)
|
28
|
+
# Persist changes to the file_set
|
29
|
+
file_set.save!
|
30
|
+
end
|
27
31
|
|
28
32
|
repository_file = file_set.send(relation)
|
29
33
|
|
@@ -2,7 +2,6 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
RSpec.describe CurationConcerns::Workflow::GrantEditToDepositor do
|
4
4
|
let(:depositor) { create(:user) }
|
5
|
-
let(:work) { create(:work_without_access, depositor: depositor.user_key) }
|
6
5
|
let(:user) { User.new }
|
7
6
|
|
8
7
|
describe ".call" do
|
@@ -12,9 +11,21 @@ RSpec.describe CurationConcerns::Workflow::GrantEditToDepositor do
|
|
12
11
|
user: user)
|
13
12
|
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
context "with no additional editors" do
|
15
|
+
let(:work) { create(:work_without_access, depositor: depositor.user_key) }
|
16
|
+
it "adds edit access" do
|
17
|
+
expect { subject }.to change { work.edit_users }.from([]).to([depositor.user_key])
|
18
|
+
expect(work).to be_valid
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "with an additional editor" do
|
23
|
+
let(:editor) { create(:user) }
|
24
|
+
let(:work) { create(:work_without_access, depositor: depositor.user_key, edit_users: [editor.user_key]) }
|
25
|
+
it "adds edit access" do
|
26
|
+
expect { subject }.to change { work.edit_users }.from([editor.user_key]).to([editor.user_key, depositor.user_key])
|
27
|
+
expect(work).to be_valid
|
28
|
+
end
|
18
29
|
end
|
19
30
|
end
|
20
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curation_concerns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zumwalt
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-04-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: hydra-head
|