hydra-works 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +72 -0
  4. data/Gemfile +5 -4
  5. data/README.md +17 -11
  6. data/Rakefile +18 -8
  7. data/config/solrconfig.xml +223 -0
  8. data/hydra-works.gemspec +15 -15
  9. data/lib/hydra/works.rb +28 -17
  10. data/lib/hydra/works/errors/full_text_extraction_error.rb +5 -0
  11. data/lib/hydra/works/models/concerns/block_child_objects.rb +12 -6
  12. data/lib/hydra/works/models/concerns/collection_behavior.rb +44 -6
  13. data/lib/hydra/works/models/concerns/generic_file/contained_files.rb +3 -3
  14. data/lib/hydra/works/models/concerns/generic_file/derivatives.rb +2 -4
  15. data/lib/hydra/works/models/concerns/generic_file/mime_types.rb +1 -3
  16. data/lib/hydra/works/models/concerns/generic_file/versioned_content.rb +4 -6
  17. data/lib/hydra/works/models/concerns/generic_file/virus_check.rb +13 -14
  18. data/lib/hydra/works/models/concerns/generic_file_behavior.rb +13 -3
  19. data/lib/hydra/works/models/concerns/generic_work_behavior.rb +34 -9
  20. data/lib/hydra/works/models/generic_file.rb +0 -3
  21. data/lib/hydra/works/services/generic_file/add_file_to_generic_file.rb +14 -16
  22. data/lib/hydra/works/services/generic_file/full_text_extraction_service.rb +57 -0
  23. data/lib/hydra/works/services/generic_file/generate_thumbnail.rb +13 -0
  24. data/lib/hydra/works/services/generic_file/persist_derivative.rb +3 -5
  25. data/lib/hydra/works/services/generic_file/{upload_file.rb → upload_file_to_generic_file.rb} +1 -3
  26. data/lib/hydra/works/version.rb +1 -1
  27. data/lib/hydra/works/vocab/works_terms.rb +9 -9
  28. data/lib/tasks/hydra-works_tasks.rake +80 -0
  29. data/lib/tasks/jetty.rake +15 -0
  30. data/spec/hydra/works/models/collection_spec.rb +258 -246
  31. data/spec/hydra/works/models/concerns/block_child_objects_spec.rb +6 -8
  32. data/spec/hydra/works/models/concerns/generic_file/contained_files_spec.rb +40 -48
  33. data/spec/hydra/works/models/concerns/generic_file/mime_types_spec.rb +16 -18
  34. data/spec/hydra/works/models/concerns/generic_file/versioned_content_spec.rb +11 -11
  35. data/spec/hydra/works/models/concerns/generic_file/virus_check_spec.rb +11 -8
  36. data/spec/hydra/works/models/concerns/generic_file_behavior_spec.rb +1 -1
  37. data/spec/hydra/works/models/generic_file_spec.rb +87 -85
  38. data/spec/hydra/works/models/generic_work_spec.rb +167 -169
  39. data/spec/hydra/works/services/full_text_extraction_service_spec.rb +89 -0
  40. data/spec/hydra/works/services/generic_file/add_file_to_generic_file_spec.rb +36 -38
  41. data/spec/hydra/works/services/generic_file/generate/thumbnail_spec.rb +10 -12
  42. data/spec/hydra/works/services/generic_file/upload_file_spec.rb +39 -42
  43. data/spec/hydra/works/services/persist_derivatives_spec.rb +2 -3
  44. data/spec/hydra/works_spec.rb +57 -61
  45. data/spec/spec_helper.rb +2 -4
  46. metadata +23 -15
  47. data/lib/hydra/works/services/generic_file/generate/thumbnail.rb +0 -18
data/spec/spec_helper.rb CHANGED
@@ -35,12 +35,10 @@ RSpec.configure do |config|
35
35
  config.formatter = :progress
36
36
 
37
37
  config.before :each do |example|
38
- unless example.metadata[:no_clean]
39
- ActiveFedora::Cleaner.clean!
40
- end
38
+ ActiveFedora::Cleaner.clean! unless example.metadata[:no_clean]
41
39
  end
42
40
  end
43
41
 
44
42
  def fixture_path
45
- File.expand_path("../fixtures", __FILE__)
43
+ File.expand_path('../fixtures', __FILE__)
46
44
  end
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.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-11 00:00:00.000000000 Z
11
+ date: 2015-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hydra-pcdm
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.1'
19
+ version: '0.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.1'
26
+ version: '0.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: hydra-derivatives
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,33 +39,33 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: activefedora-aggregation
42
+ name: active-fedora
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0.4'
47
+ version: 9.4.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0.4'
54
+ version: 9.4.1
55
55
  - !ruby/object:Gem::Dependency
56
- name: active-fedora
56
+ name: activefedora-aggregation
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '9.2'
61
+ version: '0.4'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '9.2'
68
+ version: '0.4'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -189,14 +189,17 @@ files:
189
189
  - ".coveralls.yml"
190
190
  - ".gitignore"
191
191
  - ".rspec"
192
+ - ".rubocop.yml"
192
193
  - ".travis.yml"
193
194
  - CONTRIBUTING.md
194
195
  - Gemfile
195
196
  - LICENSE
196
197
  - README.md
197
198
  - Rakefile
199
+ - config/solrconfig.xml
198
200
  - hydra-works.gemspec
199
201
  - lib/hydra/works.rb
202
+ - lib/hydra/works/errors/full_text_extraction_error.rb
200
203
  - lib/hydra/works/models/collection.rb
201
204
  - lib/hydra/works/models/concerns/block_child_objects.rb
202
205
  - lib/hydra/works/models/concerns/collection_behavior.rb
@@ -210,11 +213,14 @@ files:
210
213
  - lib/hydra/works/models/generic_file.rb
211
214
  - lib/hydra/works/models/generic_work.rb
212
215
  - lib/hydra/works/services/generic_file/add_file_to_generic_file.rb
213
- - lib/hydra/works/services/generic_file/generate/thumbnail.rb
216
+ - lib/hydra/works/services/generic_file/full_text_extraction_service.rb
217
+ - lib/hydra/works/services/generic_file/generate_thumbnail.rb
214
218
  - lib/hydra/works/services/generic_file/persist_derivative.rb
215
- - lib/hydra/works/services/generic_file/upload_file.rb
219
+ - lib/hydra/works/services/generic_file/upload_file_to_generic_file.rb
216
220
  - lib/hydra/works/version.rb
217
221
  - lib/hydra/works/vocab/works_terms.rb
222
+ - lib/tasks/hydra-works_tasks.rake
223
+ - lib/tasks/jetty.rake
218
224
  - spec/fixtures/Example.ogg
219
225
  - spec/fixtures/charter.docx
220
226
  - spec/fixtures/countdown.avi
@@ -233,6 +239,7 @@ files:
233
239
  - spec/hydra/works/models/concerns/generic_file_behavior_spec.rb
234
240
  - spec/hydra/works/models/generic_file_spec.rb
235
241
  - spec/hydra/works/models/generic_work_spec.rb
242
+ - spec/hydra/works/services/full_text_extraction_service_spec.rb
236
243
  - spec/hydra/works/services/generic_file/add_file_to_generic_file_spec.rb
237
244
  - spec/hydra/works/services/generic_file/generate/thumbnail_spec.rb
238
245
  - spec/hydra/works/services/generic_file/upload_file_spec.rb
@@ -268,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
275
  version: '0'
269
276
  requirements: []
270
277
  rubyforge_project:
271
- rubygems_version: 2.4.8
278
+ rubygems_version: 2.2.2
272
279
  signing_key:
273
280
  specification_version: 4
274
281
  summary: Fundamental repository data model for hydra
@@ -291,6 +298,7 @@ test_files:
291
298
  - spec/hydra/works/models/concerns/generic_file_behavior_spec.rb
292
299
  - spec/hydra/works/models/generic_file_spec.rb
293
300
  - spec/hydra/works/models/generic_work_spec.rb
301
+ - spec/hydra/works/services/full_text_extraction_service_spec.rb
294
302
  - spec/hydra/works/services/generic_file/add_file_to_generic_file_spec.rb
295
303
  - spec/hydra/works/services/generic_file/generate/thumbnail_spec.rb
296
304
  - spec/hydra/works/services/generic_file/upload_file_spec.rb
@@ -1,18 +0,0 @@
1
- module Hydra::Works
2
- class GenerateThumbnail
3
-
4
- def self.call(object, content: :original_file)
5
- raise ArgumentError, "object has no content at #{content} from which to generate a thumbnail" if object.send(content).nil?
6
- source = object.send(content)
7
-
8
- # Always replace the thumbnail with whatever is from the original file
9
- if object.thumbnail.nil?
10
- object.build_thumbnail
11
- end
12
-
13
- object.create_derivatives
14
- object
15
- end
16
-
17
- end
18
- end