hydra-works 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +4 -0
- data/Rakefile +15 -19
- data/lib/hydra/works/models/concerns/work_behavior.rb +12 -0
- data/lib/hydra/works/services/add_file_to_file_set.rb +4 -4
- data/lib/hydra/works/version.rb +1 -1
- data/spec/hydra/works/models/collection_spec.rb +9 -0
- data/spec/hydra/works/models/work_spec.rb +1 -1
- data/spec/hydra/works/services/characterization_service_spec.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cefb87e089349c82c73439d52e233d4bb75a7d3
|
4
|
+
data.tar.gz: db102c0181dbb73a50e18980d97567466446bd8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 020a75d61769ec1ec016b6a08faab106c620684f3648836cf70d2764b447a754ea1127259f4eaca6fe36dea5ac219d423caf61f4898adc39aa6bd18b7fcb03c8
|
7
|
+
data.tar.gz: 10995a20095c6b0690c957b4fa31fbf3f9ce90b62f2107a90666db92fc98cbef43a97323bccb64f1eb8a1ab63632aa65cff9868b91e29da350753c8378f8a8c5
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/Rakefile
CHANGED
@@ -4,30 +4,26 @@ require 'rspec/core/rake_task'
|
|
4
4
|
require 'rubocop/rake_task'
|
5
5
|
require 'solr_wrapper'
|
6
6
|
require 'fcrepo_wrapper'
|
7
|
+
require 'active_fedora/rake_support'
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
namespace :works do
|
10
|
+
desc 'Run style checker'
|
11
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
12
|
+
task.requires << 'rubocop-rspec'
|
13
|
+
task.fail_on_error = true
|
14
|
+
end
|
13
15
|
|
14
|
-
|
15
|
-
task :spec do
|
16
|
-
Rake::Task['rubocop'].invoke
|
17
|
-
RSpec::Core::RakeTask.new(:spec)
|
18
|
-
end
|
16
|
+
RSpec::Core::RakeTask.new(:rspec)
|
19
17
|
|
20
|
-
desc '
|
21
|
-
task :
|
22
|
-
|
23
|
-
|
24
|
-
SolrWrapper.wrap(solr_params) do |solr|
|
25
|
-
solr.with_collection(name: 'hydra-test', dir: File.join(File.expand_path('.', File.dirname(__FILE__)), 'solr', 'config')) do
|
26
|
-
FcrepoWrapper.wrap(fcrepo_params) do
|
27
|
-
Rake::Task['spec'].invoke
|
28
|
-
end
|
18
|
+
desc 'Start up Solr & FCRepo and run the test suite'
|
19
|
+
task :spec do
|
20
|
+
with_test_server do
|
21
|
+
Rake::Task['works:rspec'].invoke
|
29
22
|
end
|
30
23
|
end
|
31
24
|
end
|
32
25
|
|
26
|
+
desc 'Spin up Solr & Fedora and run the test suite'
|
27
|
+
task ci: ['works:rubocop', 'works:spec']
|
28
|
+
|
33
29
|
task default: :ci
|
@@ -18,6 +18,7 @@ module Hydra::Works
|
|
18
18
|
|
19
19
|
included do
|
20
20
|
type [Hydra::PCDM::Vocab::PCDMTerms.Object, Vocab::WorksTerms.Work]
|
21
|
+
before_destroy :remove_from_parents
|
21
22
|
end
|
22
23
|
|
23
24
|
def works
|
@@ -70,5 +71,16 @@ module Hydra::Works
|
|
70
71
|
def in_works
|
71
72
|
ordered_by.select { |parent| parent.class.included_modules.include?(Hydra::Works::WorkBehavior) }.to_a
|
72
73
|
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
# Remove this object from parent works or collections
|
78
|
+
def remove_from_parents
|
79
|
+
ordered_by.each do |parent|
|
80
|
+
parent.ordered_members.delete(self) # Delete the list node
|
81
|
+
parent.members.delete(self) # Delete the indirect container Proxy
|
82
|
+
parent.save! # record the changes to the ordered members
|
83
|
+
end
|
84
|
+
end
|
73
85
|
end
|
74
86
|
end
|
@@ -57,13 +57,13 @@ module Hydra::Works
|
|
57
57
|
# @param object for mimetype to be determined. Attempts to use methods: :mime_type, :content_type, and :path.
|
58
58
|
def determine_mime_type(file)
|
59
59
|
if file.respond_to? :mime_type
|
60
|
-
|
60
|
+
file.mime_type
|
61
61
|
elsif file.respond_to? :content_type
|
62
|
-
|
62
|
+
file.content_type
|
63
63
|
elsif file.respond_to? :path
|
64
|
-
|
64
|
+
Hydra::PCDM::GetMimeTypeForFile.call(file.path)
|
65
65
|
else
|
66
|
-
|
66
|
+
'application/octet-stream'
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
data/lib/hydra/works/version.rb
CHANGED
@@ -69,6 +69,15 @@ describe Hydra::Works::Collection do
|
|
69
69
|
it 'returns only works' do
|
70
70
|
expect(subject).to eq [work1, work2]
|
71
71
|
end
|
72
|
+
|
73
|
+
context "after deleting a member" do
|
74
|
+
before do
|
75
|
+
collection.save
|
76
|
+
work1.destroy
|
77
|
+
collection.reload
|
78
|
+
end
|
79
|
+
it { is_expected.to eq [work2] }
|
80
|
+
end
|
72
81
|
end
|
73
82
|
end
|
74
83
|
|
@@ -207,7 +207,7 @@ describe Hydra::Works::Work do
|
|
207
207
|
end
|
208
208
|
end
|
209
209
|
|
210
|
-
describe '
|
210
|
+
describe 'parent work and collection accessors' do
|
211
211
|
let(:collection1) { Hydra::Works::Collection.new }
|
212
212
|
before do
|
213
213
|
collection1.ordered_members << work2
|
@@ -93,8 +93,8 @@ describe Hydra::Works::CharacterizationService do
|
|
93
93
|
allow(characterization).to receive(:characterize).and_return(fits_response)
|
94
94
|
end
|
95
95
|
|
96
|
-
it 'does not explode with an error
|
97
|
-
expect { described_class.run(file_set) }.
|
96
|
+
it 'does not explode with an error' do
|
97
|
+
expect { described_class.run(file_set) }.not_to raise_error
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-works
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hydra-pcdm
|
@@ -340,3 +340,4 @@ test_files:
|
|
340
340
|
- spec/hydra/works_spec.rb
|
341
341
|
- spec/spec_helper.rb
|
342
342
|
- spec/support/file_set_helper.rb
|
343
|
+
has_rdoc:
|