hydra-pcdm 0.3.2 → 0.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0be7a3fa222eb99a0aac81f40a4946f03231891
4
- data.tar.gz: c13f936e7d5b45e39e80108e91c7dc1a96f37336
3
+ metadata.gz: 34be4330f2d67658ff23d0ca81d507a8148cd017
4
+ data.tar.gz: 8a99d7df6d98e0b3d065c808da63b90dcc99fc81
5
5
  SHA512:
6
- metadata.gz: 91fa47b049b2886f33a8ff57e33c002926ebecc21d2209d6d50691b4ff8d4bc6c35be05f2a83e7ab64d87c43998b71c216687bf2db6f4d26ba990dcfb8dffc83
7
- data.tar.gz: 1a15fc8ebba626fa74a78931d88f4dab56ee2e0880293c587a4b19406859961d672bca76cd1b47f4da9c731f55159f52b6bf39b6d06e31f08430ff91ede3ea2d
6
+ metadata.gz: e0a70541608c6409dd236b136b1c0441200866887f5161d89132e52eb7c373a62ab9d296d8a243a8836515bb2dcc32d3571e5a4d92d1b7b3c8d01fc55d2bcdf0
7
+ data.tar.gz: 71ee5d660565ff2accb6f69f7342d9399f9f64c44ec1766a0d8d8d1129c4ff9ca68e5f470a48029ff825367f286c6aded5488a79418179efea17b0cc43c10509
data/README.md CHANGED
@@ -17,7 +17,7 @@ Add these lines to your application's Gemfile:
17
17
 
18
18
  ```ruby
19
19
  gem 'active-fedora', '~> 9.3'
20
- gem 'hydra-pcdm', '~> 0.1'
20
+ gem 'hydra-pcdm', '~> 0.4'
21
21
  ```
22
22
 
23
23
  And then execute:
data/Rakefile CHANGED
@@ -24,7 +24,7 @@ task ci: ['jetty:clean'] do
24
24
  error = Jettywrapper.wrap(jetty_params) do
25
25
  Rake::Task['spec'].invoke
26
26
  end
27
- fail "test failures: #{error}" if error
27
+ raise "test failures: #{error}" if error
28
28
  end
29
29
 
30
30
  task default: :ci
@@ -50,15 +50,5 @@ module Hydra::PCDM
50
50
  def pcdm_collection?
51
51
  true
52
52
  end
53
-
54
- def child_collections
55
- warn '[DEPRECATION] `child_collections` is deprecated in Hydra::PCDM. Please use `collections` instead. This has a target date for removal of 10-31-2015'
56
- ordered_collections
57
- end
58
-
59
- def child_collection_ids
60
- warn '[DEPRECATION] `child_collection_ids` is deprecated in Hydra::PCDM. Please use `collection_ids` instead. This has a target date for removal of 10-31-2015'
61
- ordered_collection_ids
62
- end
63
53
  end
64
54
  end
@@ -40,12 +40,7 @@ module Hydra::PCDM
40
40
  end
41
41
 
42
42
  def in_objects
43
- ordered_by.select(&:pcdm_object?).to_a
44
- end
45
-
46
- def parent_objects
47
- warn '[DEPRECATION] `parent_objects` is deprecated in Hydra::PCDM. Please use `in_objects` instead. This has a target date for removal of 10-31-2015'
48
- in_objects
43
+ member_of.select(&:pcdm_object?).to_a
49
44
  end
50
45
 
51
46
  # Returns directly contained files that have the requested RDF Type
@@ -48,29 +48,14 @@ module Hydra::PCDM
48
48
  ordered_objects.map(&:id)
49
49
  end
50
50
 
51
- def parents
52
- warn '[DEPRECATION] `parents` is deprecated in Hydra::PCDM. Please use `ordered_by` instead. This has a target date for removal of 10-31-2015'
53
- ordered_by.to_a
54
- end
55
-
56
51
  def in_collections
57
52
  member_of.select(&:pcdm_collection?).to_a
58
53
  end
59
54
 
60
- def parent_collections
61
- warn '[DEPRECATION] `parent_collections` is deprecated in Hydra::PCDM. Please use `in_collections` instead. This has a target date for removal of 10-31-2015'
62
- in_collections
63
- end
64
-
65
55
  def in_collection_ids
66
56
  in_collections.map(&:id)
67
57
  end
68
58
 
69
- def parent_collection_ids
70
- warn '[DEPRECATION] `parent_collection_ids` is deprecated in Hydra::PCDM. Please use `in_collection_ids` instead. This has a target date for removal of 10-31-2015'
71
- in_collection_ids
72
- end
73
-
74
59
  def ancestor?(record)
75
60
  ancestor_checker.ancestor?(record)
76
61
  end
@@ -78,15 +63,5 @@ module Hydra::PCDM
78
63
  def ancestor_checker
79
64
  @ancestor_checker ||= ::Hydra::PCDM::AncestorChecker.new(self)
80
65
  end
81
-
82
- def child_objects
83
- warn '[DEPRECATION] `child_objects` is deprecated in Hydra::PCDM. Please use `objects` instead. This has a target date for removal of 10-31-2015'
84
- ordered_objects
85
- end
86
-
87
- def child_object_ids
88
- warn '[DEPRECATION] `child_object_ids` is deprecated in Hydra::PCDM. Please use `object_ids` instead. This has a target date for removal of 10-31-2015'
89
- object_ids
90
- end
91
66
  end
92
67
  end
@@ -1,7 +1,7 @@
1
1
  module Hydra::PCDM
2
2
  class GetMimeTypeForFile
3
3
  def self.call(path)
4
- fail ArgumentError, 'supplied argument should be a path to a file' unless path.is_a?(String)
4
+ raise ArgumentError, 'supplied argument should be a path to a file' unless path.is_a?(String)
5
5
  mime_types = ::MIME::Types.of(::File.basename(path))
6
6
  mime_types.empty? ? 'application/octet-stream' : mime_types.first.content_type
7
7
  end
@@ -12,7 +12,7 @@ module Hydra::PCDM::Validators
12
12
 
13
13
  def validate!
14
14
  return unless owner.ancestor?(record)
15
- fail ArgumentError, "#{record.class} with ID: #{record.id} failed to pass AncestorChecker validation"
15
+ raise ArgumentError, "#{record.class} with ID: #{record.id} failed to pass AncestorChecker validation"
16
16
  end
17
17
  end
18
18
  end
@@ -2,7 +2,7 @@ module Hydra::PCDM::Validators
2
2
  class PCDMObjectValidator
3
3
  def self.validate!(_association, record)
4
4
  unless record.try(:pcdm_object?)
5
- fail ActiveFedora::AssociationTypeMismatch, "#{record} is not a PCDM object."
5
+ raise ActiveFedora::AssociationTypeMismatch, "#{record} is not a PCDM object."
6
6
  end
7
7
  end
8
8
  end
@@ -2,7 +2,7 @@ module Hydra::PCDM::Validators
2
2
  class PCDMValidator
3
3
  def self.validate!(_reflection, record)
4
4
  if !record.try(:pcdm_object?) && !record.try(:pcdm_collection?)
5
- fail ActiveFedora::AssociationTypeMismatch, "#{record} is not a PCDM object or collection."
5
+ raise ActiveFedora::AssociationTypeMismatch, "#{record} is not a PCDM object or collection."
6
6
  end
7
7
  end
8
8
  end
@@ -1,5 +1,5 @@
1
1
  module Hydra
2
2
  module PCDM
3
- VERSION = '0.3.2'.freeze
3
+ VERSION = '0.4.0'.freeze
4
4
  end
5
5
  end
@@ -609,23 +609,4 @@ describe Hydra::PCDM::Collection do
609
609
  it { is_expected.to eq IndexingStuff::AltIndexer }
610
610
  end
611
611
  end
612
-
613
- describe 'make sure deprecated methods still work' do
614
- it 'deprecated methods should pass' do
615
- collection1.ordered_members = [collection2]
616
- expect(collection1.ordered_members << collection3).to eq [collection2, collection3]
617
- expect(collection1.ordered_members += [collection4]).to eq [collection2, collection3, collection4]
618
- expect(collection1.ordered_members << object1).to eq [collection2, collection3, collection4, object1]
619
- expect(collection1.ordered_members << object2).to eq [collection2, collection3, collection4, object1, object2]
620
- expect(collection1.ordered_members += [object3]).to eq [collection2, collection3, collection4, object1, object2, object3]
621
- collection1.save # required until issue AF-Agg-75 is fixed
622
- expect(collection2.parent_collections).to eq [collection1]
623
- expect(collection2.parents).to eq [collection1]
624
- expect(collection2.parent_collection_ids).to eq [collection1.id]
625
- expect(collection1.child_objects).to eq [object1, object2, object3]
626
- expect(collection1.child_object_ids).to eq [object1.id, object2.id, object3.id]
627
- expect(collection1.child_collections).to eq [collection2, collection3, collection4]
628
- expect(collection1.child_collection_ids).to eq [collection2.id, collection3.id, collection4.id]
629
- end
630
- end
631
612
  end
@@ -151,37 +151,67 @@ describe Hydra::PCDM::Object do
151
151
  subject { object.in_objects }
152
152
  let(:collection) { Hydra::PCDM::Collection.new }
153
153
  let(:parent_object) { described_class.new }
154
- before do
155
- collection.ordered_members = [object]
156
- parent_object.ordered_members = [object]
157
- parent_object.save
158
- collection.save
154
+ context 'using ordered_members' do
155
+ before do
156
+ collection.ordered_members = [object]
157
+ parent_object.ordered_members = [object]
158
+ parent_object.save
159
+ collection.save
160
+ end
161
+
162
+ it 'finds objects that aggregate the object' do
163
+ expect(subject).to eq [parent_object]
164
+ end
159
165
  end
166
+ context 'using members' do
167
+ before do
168
+ collection.members = [object]
169
+ parent_object.members = [object]
170
+ parent_object.save
171
+ collection.save
172
+ end
160
173
 
161
- it 'finds objects that aggregate the object' do
162
- expect(subject).to eq [parent_object]
174
+ it 'finds objects that aggregate the object' do
175
+ expect(subject).to eq [parent_object]
176
+ end
163
177
  end
164
178
  end
165
179
 
166
180
  describe 'in_collections' do
167
- let(:object) { described_class.create }
168
181
  subject { object.in_collections }
169
182
  let(:object) { described_class.create }
170
183
  let(:collection1) { Hydra::PCDM::Collection.new }
171
184
  let(:collection2) { Hydra::PCDM::Collection.new }
172
185
  let(:parent_object) { described_class.new }
173
- before do
174
- collection1.ordered_members = [object]
175
- collection2.ordered_members = [object]
176
- parent_object.ordered_members = [object]
177
- parent_object.save
178
- collection1.save
179
- collection2.save
186
+ context 'using ordered_members' do
187
+ before do
188
+ collection1.ordered_members = [object]
189
+ collection2.ordered_members = [object]
190
+ parent_object.ordered_members = [object]
191
+ parent_object.save
192
+ collection1.save
193
+ collection2.save
194
+ end
195
+
196
+ it 'finds collections that aggregate the object' do
197
+ expect(subject).to match_array [collection1, collection2]
198
+ expect(subject.count).to eq 2
199
+ end
180
200
  end
201
+ context 'using members' do
202
+ before do
203
+ collection1.members = [object]
204
+ collection2.members = [object]
205
+ parent_object.members = [object]
206
+ parent_object.save
207
+ collection1.save
208
+ collection2.save
209
+ end
181
210
 
182
- it 'finds collections that aggregate the object' do
183
- expect(subject).to match_array [collection1, collection2]
184
- expect(subject.count).to eq 2
211
+ it 'finds collections that aggregate the object' do
212
+ expect(subject).to match_array [collection1, collection2]
213
+ expect(subject.count).to eq 2
214
+ end
185
215
  end
186
216
  end
187
217
 
@@ -486,20 +516,4 @@ describe Hydra::PCDM::Object do
486
516
  it { is_expected.to eq IndexingStuff::AltIndexer }
487
517
  end
488
518
  end
489
-
490
- describe 'make sure deprecated methods still work' do
491
- let(:object1) { described_class.new }
492
- let(:object2) { described_class.new }
493
- let(:object3) { described_class.new }
494
- let(:object4) { described_class.new }
495
-
496
- it 'deprecated methods should pass' do
497
- object1.ordered_members = [object2]
498
- expect(object1.ordered_members << object3).to eq [object2, object3]
499
- expect(object1.ordered_members += [object4]).to eq [object2, object3, object4]
500
- object1.save # required until issue AF-Agg-75 is fixed
501
- expect(object2.parent_objects).to eq [object1]
502
- expect(object2.parents).to eq [object1]
503
- end
504
- end
505
519
  end
@@ -2,10 +2,9 @@ ENV['environment'] ||= 'test'
2
2
  require 'simplecov'
3
3
  require 'coveralls'
4
4
 
5
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6
- SimpleCov::Formatter::HTMLFormatter,
7
- Coveralls::SimpleCov::Formatter
8
- ]
5
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
6
+ [SimpleCov::Formatter::HTMLFormatter,
7
+ Coveralls::SimpleCov::Formatter])
9
8
  SimpleCov.start 'rails'
10
9
 
11
10
  require 'bundler/setup'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-pcdm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - E. Lynette Rayle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-21 00:00:00.000000000 Z
11
+ date: 2016-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active-fedora
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  version: '0'
192
192
  requirements: []
193
193
  rubyforge_project:
194
- rubygems_version: 2.4.5.1
194
+ rubygems_version: 2.4.8
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: Portland Common Data Model (PCDM)
@@ -206,4 +206,3 @@ test_files:
206
206
  - spec/hydra/pcdm/services/file/get_mime_type_spec.rb
207
207
  - spec/hydra/pcdm_spec.rb
208
208
  - spec/spec_helper.rb
209
- has_rdoc: