hydra-works 0.16.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +59 -0
  3. data/.gitignore +3 -1
  4. data/.rubocop.yml +2 -6
  5. data/.rubocop_todo.yml +5 -0
  6. data/.solr_wrapper +1 -0
  7. data/CHANGELOG.md +621 -0
  8. data/CODE_OF_CONDUCT.md +36 -0
  9. data/CONTRIBUTING.md +23 -21
  10. data/Gemfile +11 -3
  11. data/LICENSE +14 -16
  12. data/README.md +54 -12
  13. data/SUPPORT.md +5 -0
  14. data/hydra-works.gemspec +15 -13
  15. data/lib/hydra/works/characterization.rb +5 -4
  16. data/lib/hydra/works/characterization/fits_document.rb +348 -144
  17. data/lib/hydra/works/characterization/schema/audio_schema.rb +2 -0
  18. data/lib/hydra/works/characterization/schema/video_schema.rb +2 -0
  19. data/lib/hydra/works/models/concerns/collection_behavior.rb +44 -0
  20. data/lib/hydra/works/models/concerns/file_set_behavior.rb +20 -0
  21. data/lib/hydra/works/models/concerns/work_behavior.rb +54 -0
  22. data/lib/hydra/works/services/add_external_file_to_file_set.rb +1 -1
  23. data/lib/hydra/works/services/add_file_to_file_set.rb +1 -1
  24. data/lib/hydra/works/services/characterization_service.rb +5 -0
  25. data/lib/hydra/works/services/determine_original_name.rb +1 -1
  26. data/lib/hydra/works/version.rb +1 -1
  27. data/lib/hydra/works/virus_scanner.rb +18 -2
  28. data/spec/fixtures/fits_0.8.5_tiff.xml +78 -0
  29. data/spec/fixtures/fits_1.2.0_avi.xml +83 -0
  30. data/spec/fixtures/fits_1.2.0_jpg.xml +76 -0
  31. data/spec/fixtures/fits_1.2.0_mp3.xml +51 -0
  32. data/spec/fixtures/fits_1.2.0_mp4.xml +88 -0
  33. data/spec/fixtures/fits_netcdf_two_mimetypes.xml +35 -0
  34. data/spec/hydra/works/characterization_spec.rb +12 -5
  35. data/spec/hydra/works/models/collection_spec.rb +162 -0
  36. data/spec/hydra/works/models/concerns/file_set/contained_files_spec.rb +3 -16
  37. data/spec/hydra/works/models/file_set_spec.rb +47 -0
  38. data/spec/hydra/works/models/work_spec.rb +213 -7
  39. data/spec/hydra/works/services/characterization_service_spec.rb +90 -27
  40. data/spec/hydra/works/services/persist_derivatives_spec.rb +6 -6
  41. data/spec/hydra/works/virus_scanner_spec.rb +31 -0
  42. data/use-cases/princeton_book_use_case.md +1 -1
  43. metadata +77 -67
  44. data/.travis.yml +0 -15
  45. data/lib/hydra/works/characterization/fits_mapper.rb +0 -0
  46. data/solr/config/_rest_managed.json +0 -3
  47. data/solr/config/admin-extra.html +0 -31
  48. data/solr/config/elevate.xml +0 -36
  49. data/solr/config/mapping-ISOLatin1Accent.txt +0 -246
  50. data/solr/config/protwords.txt +0 -21
  51. data/solr/config/schema.xml +0 -372
  52. data/solr/config/scripts.conf +0 -24
  53. data/solr/config/solrconfig.xml +0 -419
  54. data/solr/config/spellings.txt +0 -2
  55. data/solr/config/stopwords.txt +0 -58
  56. data/solr/config/stopwords_en.txt +0 -58
  57. data/solr/config/synonyms.txt +0 -31
  58. data/solr/config/xslt/example.xsl +0 -132
  59. data/solr/config/xslt/example_atom.xsl +0 -67
  60. data/solr/config/xslt/example_rss.xsl +0 -66
  61. data/solr/config/xslt/luke.xsl +0 -337
  62. data/spec/fixtures/eicar.txt +0 -1
@@ -39,7 +39,7 @@ describe Hydra::Works::PersistDerivative do
39
39
  context 'with a video (.avi) file' do
40
40
  let(:mime_type) { 'video/x-msvideo' }
41
41
  let(:file_name) { 'countdown.avi' }
42
- let(:file_set) { Hydra::Works::FileSet.new(id: '01/00') }
42
+ let(:file_set) { Hydra::Works::FileSet.create(id: '01/00') }
43
43
 
44
44
  it 'lacks a thumbnail' do
45
45
  expect(file_set.thumbnail).to be_nil
@@ -55,7 +55,7 @@ describe Hydra::Works::PersistDerivative do
55
55
  context 'with an image file' do
56
56
  let(:mime_type) { 'image/png' }
57
57
  let(:file_name) { 'world.png' }
58
- let(:file_set) { Hydra::Works::FileSet.new(id: '01/01') }
58
+ let(:file_set) { Hydra::Works::FileSet.create(id: '01/01') }
59
59
 
60
60
  it 'lacks a thumbnail' do
61
61
  expect(file_set.thumbnail).to be_nil
@@ -72,7 +72,7 @@ describe Hydra::Works::PersistDerivative do
72
72
  context 'with an audio (.wav) file' do
73
73
  let(:mime_type) { 'audio/wav' }
74
74
  let(:file_name) { 'piano_note.wav' }
75
- let(:file_set) { Hydra::Works::FileSet.new(id: '01/02') }
75
+ let(:file_set) { Hydra::Works::FileSet.create(id: '01/02') }
76
76
 
77
77
  it 'lacks a thumbnail' do
78
78
  expect(file_set.thumbnail).to be_nil
@@ -87,7 +87,7 @@ describe Hydra::Works::PersistDerivative do
87
87
  context 'with an image (.jp2) file' do
88
88
  let(:mime_type) { 'image/jp2' }
89
89
  let(:file_name) { 'image.jp2' }
90
- let(:file_set) { Hydra::Works::FileSet.new(id: '01/03') }
90
+ let(:file_set) { Hydra::Works::FileSet.create(id: '01/03') }
91
91
 
92
92
  it 'lacks a thumbnail' do
93
93
  expect(file_set.thumbnail).to be_nil
@@ -103,7 +103,7 @@ describe Hydra::Works::PersistDerivative do
103
103
  context 'with an office document (.docx) file' do
104
104
  let(:mime_type) { 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' }
105
105
  let(:file_name) { 'charter.docx' }
106
- let(:file_set) { Hydra::Works::FileSet.new(id: '01/04') }
106
+ let(:file_set) { Hydra::Works::FileSet.create(id: '01/04') }
107
107
 
108
108
  it 'lacks a thumbnail' do
109
109
  expect(file_set.thumbnail).to be_nil
@@ -120,7 +120,7 @@ describe Hydra::Works::PersistDerivative do
120
120
  context 'with a pdf document (.pdf) file' do
121
121
  let(:mime_type) { 'application/pdf' }
122
122
  let(:file_name) { 'sample-file.pdf' }
123
- let(:file_set) { Hydra::Works::FileSet.new(id: '01/05') }
123
+ let(:file_set) { Hydra::Works::FileSet.create(id: '01/05') }
124
124
 
125
125
  it 'lacks a thumbnail' do
126
126
  expect(file_set.thumbnail).to be_nil
@@ -10,6 +10,8 @@ describe Hydra::Works::VirusScanner do
10
10
 
11
11
  context 'when ClamAV is defined' do
12
12
  before do
13
+ hide_const('Clamby')
14
+
13
15
  class ClamAV
14
16
  def self.instance
15
17
  @instance ||= ClamAV.new
@@ -20,9 +22,11 @@ describe Hydra::Works::VirusScanner do
20
22
  end
21
23
  end
22
24
  end
25
+
23
26
  after do
24
27
  Object.send(:remove_const, :ClamAV)
25
28
  end
29
+
26
30
  context 'with a clean file' do
27
31
  before { allow(ClamAV.instance).to receive(:scanfile).with('/tmp/path').and_return(0) }
28
32
  it 'returns false with no warning' do
@@ -30,6 +34,7 @@ describe Hydra::Works::VirusScanner do
30
34
  is_expected.not_to be_infected
31
35
  end
32
36
  end
37
+
33
38
  context 'with an infected file' do
34
39
  before { allow(ClamAV.instance).to receive(:scanfile).with('/tmp/path').and_return(1) }
35
40
  it 'returns true with a warning' do
@@ -40,9 +45,35 @@ describe Hydra::Works::VirusScanner do
40
45
  end
41
46
 
42
47
  context 'when ClamAV is not defined' do
48
+ before do
49
+ hide_const('Clamby')
50
+ end
51
+
43
52
  it 'returns false with a warning' do
44
53
  expect(ActiveFedora::Base.logger).to receive(:warn).with(kind_of(String))
45
54
  is_expected.not_to be_infected
46
55
  end
47
56
  end
57
+
58
+ context 'Clamby integration tests' do
59
+ before do
60
+ require 'clamby'
61
+ end
62
+
63
+ context "when it's infected" do
64
+ let(:file) { File.join(fixture_path, 'eicar.txt') }
65
+
66
+ it 'finds a virus' do
67
+ is_expected.to be_infected
68
+ end
69
+ end
70
+
71
+ context "when it's clean" do
72
+ let(:file) { File.join(fixture_path, 'piano_note.wav') }
73
+
74
+ it 'finds no virus' do
75
+ is_expected.not_to be_infected
76
+ end
77
+ end
78
+ end
48
79
  end
@@ -114,4 +114,4 @@ Can have one or more physical volumes. Below assumes this is the case.
114
114
 
115
115
  ## Proposal
116
116
 
117
- No doubt there are other ways, but I feel confident that [this approach](https://github.com/projecthydra-labs/hydra-works/issues/9#issuecomment-58511913) would solve all of the above use cases. Validations included in subclasses of Hydra::Work would serve to constrain recursion.
117
+ No doubt there are other ways, but I feel confident that [this approach](https://github.com/samvera/hydra-works/issues/9#issuecomment-58511913) would solve all of the above use cases. Validations included in subclasses of Hydra::Work would serve to constrain recursion.
metadata CHANGED
@@ -1,121 +1,135 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-works
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-02 00:00:00.000000000 Z
11
+ date: 2020-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: hydra-pcdm
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.9'
19
+ version: '5.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '7.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '0.9'
29
+ version: '5.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '7.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: hydra-derivatives
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '3.0'
39
+ version: '3.6'
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
44
  - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: '3.0'
46
+ version: '3.6'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: hydra-file_characterization
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '0.3'
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- version: 0.3.3
53
+ version: '1.0'
51
54
  type: :runtime
52
55
  prerelease: false
53
56
  version_requirements: !ruby/object:Gem::Requirement
54
57
  requirements:
55
58
  - - "~>"
56
59
  - !ruby/object:Gem::Version
57
- version: '0.3'
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: 0.3.3
60
+ version: '1.0'
61
61
  - !ruby/object:Gem::Dependency
62
- name: om
62
+ name: hydra-pcdm
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - "~>"
65
+ - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: '3.1'
67
+ version: '0.9'
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - "~>"
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: '3.1'
74
+ version: '0.9'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: bundler
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - "~>"
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: '1.7'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - "~>"
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '1.7'
89
89
  - !ruby/object:Gem::Dependency
90
- name: rake
90
+ name: coveralls
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: fcrepo_wrapper
91
105
  requirement: !ruby/object:Gem::Requirement
92
106
  requirements:
93
107
  - - "~>"
94
108
  - !ruby/object:Gem::Version
95
- version: '10.0'
109
+ version: '0.1'
96
110
  type: :development
97
111
  prerelease: false
98
112
  version_requirements: !ruby/object:Gem::Requirement
99
113
  requirements:
100
114
  - - "~>"
101
115
  - !ruby/object:Gem::Version
102
- version: '10.0'
116
+ version: '0.1'
103
117
  - !ruby/object:Gem::Dependency
104
- name: rspec-rails
118
+ name: rake
105
119
  requirement: !ruby/object:Gem::Requirement
106
120
  requirements:
107
121
  - - "~>"
108
122
  - !ruby/object:Gem::Version
109
- version: '3.1'
123
+ version: '12.3'
110
124
  type: :development
111
125
  prerelease: false
112
126
  version_requirements: !ruby/object:Gem::Requirement
113
127
  requirements:
114
128
  - - "~>"
115
129
  - !ruby/object:Gem::Version
116
- version: '3.1'
130
+ version: '12.3'
117
131
  - !ruby/object:Gem::Dependency
118
- name: sqlite3
132
+ name: rspec
119
133
  requirement: !ruby/object:Gem::Requirement
120
134
  requirements:
121
135
  - - ">="
@@ -129,35 +143,35 @@ dependencies:
129
143
  - !ruby/object:Gem::Version
130
144
  version: '0'
131
145
  - !ruby/object:Gem::Dependency
132
- name: solr_wrapper
146
+ name: rspec-rails
133
147
  requirement: !ruby/object:Gem::Requirement
134
148
  requirements:
135
- - - "~>"
149
+ - - ">="
136
150
  - !ruby/object:Gem::Version
137
- version: '0.4'
151
+ version: '0'
138
152
  type: :development
139
153
  prerelease: false
140
154
  version_requirements: !ruby/object:Gem::Requirement
141
155
  requirements:
142
- - - "~>"
156
+ - - ">="
143
157
  - !ruby/object:Gem::Version
144
- version: '0.4'
158
+ version: '0'
145
159
  - !ruby/object:Gem::Dependency
146
- name: fcrepo_wrapper
160
+ name: solr_wrapper
147
161
  requirement: !ruby/object:Gem::Requirement
148
162
  requirements:
149
163
  - - "~>"
150
164
  - !ruby/object:Gem::Version
151
- version: '0.1'
165
+ version: '2.0'
152
166
  type: :development
153
167
  prerelease: false
154
168
  version_requirements: !ruby/object:Gem::Requirement
155
169
  requirements:
156
170
  - - "~>"
157
171
  - !ruby/object:Gem::Version
158
- version: '0.1'
172
+ version: '2.0'
159
173
  - !ruby/object:Gem::Dependency
160
- name: coveralls
174
+ name: sqlite3
161
175
  requirement: !ruby/object:Gem::Requirement
162
176
  requirements:
163
177
  - - ">="
@@ -171,7 +185,7 @@ dependencies:
171
185
  - !ruby/object:Gem::Version
172
186
  version: '0'
173
187
  - !ruby/object:Gem::Dependency
174
- name: rspec
188
+ name: rspec_junit_formatter
175
189
  requirement: !ruby/object:Gem::Requirement
176
190
  requirements:
177
191
  - - ">="
@@ -184,7 +198,7 @@ dependencies:
184
198
  - - ">="
185
199
  - !ruby/object:Gem::Version
186
200
  version: '0'
187
- description: Using this data model should enable easy collaboration amongst hydra
201
+ description: Using this data model should enable easy collaboration amongst Samvera
188
202
  projects.
189
203
  email:
190
204
  - justin@curationexperts.com
@@ -192,22 +206,25 @@ executables: []
192
206
  extensions: []
193
207
  extra_rdoc_files: []
194
208
  files:
209
+ - ".circleci/config.yml"
195
210
  - ".coveralls.yml"
196
211
  - ".gitignore"
197
212
  - ".rspec"
198
213
  - ".rubocop.yml"
199
214
  - ".rubocop_todo.yml"
200
- - ".travis.yml"
215
+ - ".solr_wrapper"
216
+ - CHANGELOG.md
217
+ - CODE_OF_CONDUCT.md
201
218
  - CONTRIBUTING.md
202
219
  - Gemfile
203
220
  - LICENSE
204
221
  - README.md
205
222
  - Rakefile
223
+ - SUPPORT.md
206
224
  - hydra-works.gemspec
207
225
  - lib/hydra/works.rb
208
226
  - lib/hydra/works/characterization.rb
209
227
  - lib/hydra/works/characterization/fits_document.rb
210
- - lib/hydra/works/characterization/fits_mapper.rb
211
228
  - lib/hydra/works/characterization/schema/audio_schema.rb
212
229
  - lib/hydra/works/characterization/schema/base_schema.rb
213
230
  - lib/hydra/works/characterization/schema/document_schema.rb
@@ -237,26 +254,9 @@ files:
237
254
  - lib/hydra/works/version.rb
238
255
  - lib/hydra/works/virus_scanner.rb
239
256
  - lib/hydra/works/vocab/works_terms.rb
240
- - solr/config/_rest_managed.json
241
- - solr/config/admin-extra.html
242
- - solr/config/elevate.xml
243
- - solr/config/mapping-ISOLatin1Accent.txt
244
- - solr/config/protwords.txt
245
- - solr/config/schema.xml
246
- - solr/config/scripts.conf
247
- - solr/config/solrconfig.xml
248
- - solr/config/spellings.txt
249
- - solr/config/stopwords.txt
250
- - solr/config/stopwords_en.txt
251
- - solr/config/synonyms.txt
252
- - solr/config/xslt/example.xsl
253
- - solr/config/xslt/example_atom.xsl
254
- - solr/config/xslt/example_rss.xsl
255
- - solr/config/xslt/luke.xsl
256
257
  - spec/fixtures/Example.ogg
257
258
  - spec/fixtures/charter.docx
258
259
  - spec/fixtures/countdown.avi
259
- - spec/fixtures/eicar.txt
260
260
  - spec/fixtures/fits_0.6.2_avi.xml
261
261
  - spec/fixtures/fits_0.6.2_jp2.xml
262
262
  - spec/fixtures/fits_0.6.2_jpg.xml
@@ -267,6 +267,12 @@ files:
267
267
  - spec/fixtures/fits_0.8.5_mp3.xml
268
268
  - spec/fixtures/fits_0.8.5_mp4.xml
269
269
  - spec/fixtures/fits_0.8.5_pdf.xml
270
+ - spec/fixtures/fits_0.8.5_tiff.xml
271
+ - spec/fixtures/fits_1.2.0_avi.xml
272
+ - spec/fixtures/fits_1.2.0_jpg.xml
273
+ - spec/fixtures/fits_1.2.0_mp3.xml
274
+ - spec/fixtures/fits_1.2.0_mp4.xml
275
+ - spec/fixtures/fits_netcdf_two_mimetypes.xml
270
276
  - spec/fixtures/image.jp2
271
277
  - spec/fixtures/pdf_fits.xml
272
278
  - spec/fixtures/piano_note.wav
@@ -305,11 +311,11 @@ files:
305
311
  - use-cases/scholarsphere_use_case.md
306
312
  - use-cases/stanford_data_model_use_case.md
307
313
  - use-cases/ucin_linked_resource_use_case.md
308
- homepage: https://github.com/projecthydra-labs/hydra-works
314
+ homepage: https://github.com/samvera/hydra-works
309
315
  licenses:
310
316
  - APACHE2
311
317
  metadata: {}
312
- post_install_message:
318
+ post_install_message:
313
319
  rdoc_options: []
314
320
  require_paths:
315
321
  - lib
@@ -324,16 +330,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
324
330
  - !ruby/object:Gem::Version
325
331
  version: '0'
326
332
  requirements: []
327
- rubyforge_project:
328
- rubygems_version: 2.6.10
329
- signing_key:
333
+ rubygems_version: 3.0.3
334
+ signing_key:
330
335
  specification_version: 4
331
- summary: Fundamental repository data model for hydra
336
+ summary: Fundamental repository data model for Samvera applications
332
337
  test_files:
333
338
  - spec/fixtures/Example.ogg
334
339
  - spec/fixtures/charter.docx
335
340
  - spec/fixtures/countdown.avi
336
- - spec/fixtures/eicar.txt
337
341
  - spec/fixtures/fits_0.6.2_avi.xml
338
342
  - spec/fixtures/fits_0.6.2_jp2.xml
339
343
  - spec/fixtures/fits_0.6.2_jpg.xml
@@ -344,6 +348,12 @@ test_files:
344
348
  - spec/fixtures/fits_0.8.5_mp3.xml
345
349
  - spec/fixtures/fits_0.8.5_mp4.xml
346
350
  - spec/fixtures/fits_0.8.5_pdf.xml
351
+ - spec/fixtures/fits_0.8.5_tiff.xml
352
+ - spec/fixtures/fits_1.2.0_avi.xml
353
+ - spec/fixtures/fits_1.2.0_jpg.xml
354
+ - spec/fixtures/fits_1.2.0_mp3.xml
355
+ - spec/fixtures/fits_1.2.0_mp4.xml
356
+ - spec/fixtures/fits_netcdf_two_mimetypes.xml
347
357
  - spec/fixtures/image.jp2
348
358
  - spec/fixtures/pdf_fits.xml
349
359
  - spec/fixtures/piano_note.wav