hydra-works 1.2.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +59 -0
- data/.solr_wrapper +1 -0
- data/Gemfile +11 -3
- data/README.md +18 -4
- data/hydra-works.gemspec +5 -4
- data/lib/hydra/works/version.rb +1 -1
- data/lib/hydra/works/virus_scanner.rb +17 -1
- data/spec/hydra/works/services/characterization_service_spec.rb +1 -1
- data/spec/hydra/works/virus_scanner_spec.rb +31 -0
- metadata +33 -19
- data/.travis.yml +0 -15
- data/lib/hydra/works/characterization/fits_mapper.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e59b8a3c691e329daaa38e524c2042a10135c137165c89cbcffc27ac82f955a
|
4
|
+
data.tar.gz: 73b6203943cdd78963127d7c998645f4e8763eaa3f85e8a2d57fddce0e3aa043
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 730f2f0abdc3e7451924e4d95b03be499c7de24eeefcc4f282b9bde0cc0167a1a70d52ed39534c5de5d7d76c013aa41f1e8b6dfbd61000201b658f2b039463e7
|
7
|
+
data.tar.gz: 3720b79fe1ef451ef274638c2373b8c48b425c6010b57638dc396e28a21920252c7c895f44e4a114b100936cb3192754cbf5642a617250c62070692ac9927b6a
|
@@ -0,0 +1,59 @@
|
|
1
|
+
---
|
2
|
+
version: 2.1
|
3
|
+
orbs:
|
4
|
+
samvera: samvera/circleci-orb@0
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
parameters:
|
8
|
+
ruby_version:
|
9
|
+
type: string
|
10
|
+
bundler_version:
|
11
|
+
type: string
|
12
|
+
default: 1.17.3
|
13
|
+
rails_version:
|
14
|
+
type: string
|
15
|
+
environment:
|
16
|
+
RAILS_VERSION: << parameters.rails_version >>
|
17
|
+
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
|
18
|
+
executor:
|
19
|
+
name: 'samvera/ruby_fcrepo_solr'
|
20
|
+
ruby_version: << parameters.ruby_version >>
|
21
|
+
steps:
|
22
|
+
- run: 'sudo apt-get update && sudo apt-get install clamav'
|
23
|
+
- run: 'sudo freshclam'
|
24
|
+
- samvera/cached_checkout
|
25
|
+
- samvera/bundle_for_gem:
|
26
|
+
ruby_version: << parameters.ruby_version >>
|
27
|
+
bundler_version: << parameters.bundler_version >>
|
28
|
+
project: hydra-works
|
29
|
+
- samvera/install_solr_active_fedora_core
|
30
|
+
- samvera/parallel_rspec
|
31
|
+
|
32
|
+
workflows:
|
33
|
+
version: 2
|
34
|
+
ci:
|
35
|
+
jobs:
|
36
|
+
- test:
|
37
|
+
name: ruby2-7_rails6-0
|
38
|
+
ruby_version: 2.7.1
|
39
|
+
rails_version: 6.0.3.1
|
40
|
+
- test:
|
41
|
+
name: ruby2-6_rails6-0
|
42
|
+
ruby_version: 2.6.6
|
43
|
+
rails_version: 6.0.3.1
|
44
|
+
- test:
|
45
|
+
name: ruby2-5_rails6-0
|
46
|
+
ruby_version: 2.5.8
|
47
|
+
rails_version: 6.0.3.1
|
48
|
+
- test:
|
49
|
+
name: ruby2-7_rails5-2
|
50
|
+
ruby_version: 2.7.1
|
51
|
+
rails_version: 5.2.4.3
|
52
|
+
- test:
|
53
|
+
name: ruby2-6_rails5-2
|
54
|
+
ruby_version: 2.6.6
|
55
|
+
rails_version: 5.2.4.3
|
56
|
+
- test:
|
57
|
+
name: ruby2-5_rails5-2
|
58
|
+
ruby_version: 2.5.8
|
59
|
+
rails_version: 5.2.4.3
|
data/.solr_wrapper
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
version: 7.7.2
|
data/Gemfile
CHANGED
@@ -6,8 +6,16 @@ gemspec
|
|
6
6
|
gem 'slop', '~> 3.6' # For byebug
|
7
7
|
|
8
8
|
group :development, :test do
|
9
|
-
gem '
|
10
|
-
gem 'rubocop-rspec', '~> 1.13.0', require: false
|
11
|
-
gem 'pry' unless ENV['CI']
|
9
|
+
gem 'clamby'
|
12
10
|
gem 'pry-byebug' unless ENV['CI']
|
11
|
+
gem 'rubocop', require: false
|
12
|
+
gem 'rubocop-rspec', require: false
|
13
|
+
end
|
14
|
+
|
15
|
+
if ENV['RAILS_VERSION']
|
16
|
+
if ENV['RAILS_VERSION'] == 'edge'
|
17
|
+
gem 'rails', github: 'rails/rails'
|
18
|
+
else
|
19
|
+
gem 'rails', ENV['RAILS_VERSION']
|
20
|
+
end
|
13
21
|
end
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Hydra::Works
|
2
2
|
|
3
3
|
[![Version](https://badge.fury.io/rb/hydra-works.png)](http://badge.fury.io/rb/hydra-works)
|
4
|
-
[![
|
4
|
+
[![CircleCI](https://circleci.com/gh/samvera/hydra-works.svg?style=svg)](https://circleci.com/gh/samvera/hydra-works)
|
5
5
|
[![Coverage Status](https://coveralls.io/repos/samvera/hydra-works/badge.svg?branch=master)](https://coveralls.io/r/samvera/hydra-works?branch=master)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/samvera/hydra-works/badges/gpa.svg)](https://codeclimate.com/github/samvera/hydra-works)
|
7
7
|
[![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
|
@@ -43,7 +43,19 @@ Behaviors included in the model include:
|
|
43
43
|
* Virus checking of original files
|
44
44
|
* Full-text extraction from original files
|
45
45
|
|
46
|
-
|
46
|
+
## Dependencies
|
47
|
+
|
48
|
+
Check out the [Hydra::Derivatives README](https://github.com/samvera/hydra-derivatives#dependencies) for dependencies.
|
49
|
+
|
50
|
+
## Additional dependencies required for specs
|
51
|
+
|
52
|
+
#### ClamAV
|
53
|
+
* Mac installation
|
54
|
+
```
|
55
|
+
$ brew install clamav
|
56
|
+
$ cp /usr/local/etc/clamav/freshclam.conf.sample /usr/local/etc/clamav/freshclam.conf
|
57
|
+
$ freshclam
|
58
|
+
```
|
47
59
|
|
48
60
|
## Installation
|
49
61
|
|
@@ -93,9 +105,11 @@ page.save
|
|
93
105
|
|
94
106
|
## Virus Detection
|
95
107
|
|
96
|
-
To turn on virus detection, install clamav on your system and add the `
|
108
|
+
To turn on virus detection, install [ClamAV](https://www.clamav.net/documents/installing-clamav) on your system and add the `clamby` gem to your Gemfile
|
97
109
|
|
98
|
-
|
110
|
+
```ruby
|
111
|
+
gem 'clamby'
|
112
|
+
```
|
99
113
|
|
100
114
|
Then include the `VirusCheck` module in your `FileSet` class:
|
101
115
|
|
data/hydra-works.gemspec
CHANGED
@@ -19,17 +19,18 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_dependency 'activesupport', '>=
|
23
|
-
spec.add_dependency 'hydra-derivatives', '~> 3.
|
22
|
+
spec.add_dependency 'activesupport', '>= 5.2', '< 7.0'
|
23
|
+
spec.add_dependency 'hydra-derivatives', '~> 3.6'
|
24
24
|
spec.add_dependency 'hydra-file_characterization', '~> 1.0'
|
25
25
|
spec.add_dependency 'hydra-pcdm', '>= 0.9'
|
26
26
|
|
27
|
-
spec.add_development_dependency 'bundler', '
|
27
|
+
spec.add_development_dependency 'bundler', '>= 1.7'
|
28
28
|
spec.add_development_dependency 'coveralls'
|
29
29
|
spec.add_development_dependency 'fcrepo_wrapper', '~> 0.1'
|
30
30
|
spec.add_development_dependency 'rake', '~> 12.3'
|
31
31
|
spec.add_development_dependency 'rspec'
|
32
|
-
spec.add_development_dependency 'rspec-rails'
|
32
|
+
spec.add_development_dependency 'rspec-rails'
|
33
33
|
spec.add_development_dependency 'solr_wrapper', '~> 2.0'
|
34
34
|
spec.add_development_dependency 'sqlite3'
|
35
|
+
spec.add_development_dependency 'rspec_junit_formatter'
|
35
36
|
end
|
data/lib/hydra/works/version.rb
CHANGED
@@ -30,16 +30,32 @@ module Hydra::Works
|
|
30
30
|
# Override this method to use your own virus checking software
|
31
31
|
# @return [Boolean]
|
32
32
|
def infected?
|
33
|
-
defined?(
|
33
|
+
if defined?(Clamby)
|
34
|
+
clamby_scanner
|
35
|
+
elsif defined?(ClamAV)
|
36
|
+
clam_av_scanner
|
37
|
+
else
|
38
|
+
null_scanner
|
39
|
+
end
|
34
40
|
end
|
35
41
|
|
36
42
|
def clam_av_scanner
|
43
|
+
Deprecation.warn(self, "The ClamAV has been replaced by Clamby " \
|
44
|
+
"as the supported virus scanner for hydra-works. " \
|
45
|
+
"ClamAV support will be removed in hydra-works 2.0 ")
|
37
46
|
scan_result = ClamAV.instance.method(:scanfile).call(file)
|
38
47
|
return false if scan_result == 0
|
39
48
|
warning "A virus was found in #{file}: #{scan_result}"
|
40
49
|
true
|
41
50
|
end
|
42
51
|
|
52
|
+
# @return [Boolean]
|
53
|
+
def clamby_scanner
|
54
|
+
scan_result = Clamby.virus?(file)
|
55
|
+
warning("A virus was found in #{file}") if scan_result
|
56
|
+
scan_result
|
57
|
+
end
|
58
|
+
|
43
59
|
# Always return zero if there's nothing available to check for viruses. This means that
|
44
60
|
# we assume all files have no viruses because we can't conclusively say if they have or not.
|
45
61
|
def null_scanner
|
@@ -19,7 +19,7 @@ describe Hydra::Works::CharacterizationService do
|
|
19
19
|
# Persist our file with some content and reload
|
20
20
|
file.content = "junk"
|
21
21
|
expect(file.save).to be true
|
22
|
-
expect(file.reload).to
|
22
|
+
expect(file.reload).to be_empty
|
23
23
|
# Re-check property values
|
24
24
|
expect(file.file_size).to eq(["7618"])
|
25
25
|
expect(file.file_title).to eq(["sample-file"])
|
@@ -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
|
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:
|
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:
|
11
|
+
date: 2020-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,34 +16,34 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '5.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '7.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: '5.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '7.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: hydra-derivatives
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '3.
|
39
|
+
version: '3.6'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '3.
|
46
|
+
version: '3.6'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: hydra-file_characterization
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -76,14 +76,14 @@ dependencies:
|
|
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
|
@@ -146,16 +146,16 @@ dependencies:
|
|
146
146
|
name: rspec-rails
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
|
-
- - "
|
149
|
+
- - ">="
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: '
|
151
|
+
version: '0'
|
152
152
|
type: :development
|
153
153
|
prerelease: false
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
|
-
- - "
|
156
|
+
- - ">="
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
158
|
+
version: '0'
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
160
|
name: solr_wrapper
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,6 +184,20 @@ dependencies:
|
|
184
184
|
- - ">="
|
185
185
|
- !ruby/object:Gem::Version
|
186
186
|
version: '0'
|
187
|
+
- !ruby/object:Gem::Dependency
|
188
|
+
name: rspec_junit_formatter
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
187
201
|
description: Using this data model should enable easy collaboration amongst Samvera
|
188
202
|
projects.
|
189
203
|
email:
|
@@ -192,12 +206,13 @@ 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
|
-
- ".
|
215
|
+
- ".solr_wrapper"
|
201
216
|
- CHANGELOG.md
|
202
217
|
- CODE_OF_CONDUCT.md
|
203
218
|
- CONTRIBUTING.md
|
@@ -210,7 +225,6 @@ files:
|
|
210
225
|
- lib/hydra/works.rb
|
211
226
|
- lib/hydra/works/characterization.rb
|
212
227
|
- lib/hydra/works/characterization/fits_document.rb
|
213
|
-
- lib/hydra/works/characterization/fits_mapper.rb
|
214
228
|
- lib/hydra/works/characterization/schema/audio_schema.rb
|
215
229
|
- lib/hydra/works/characterization/schema/base_schema.rb
|
216
230
|
- lib/hydra/works/characterization/schema/document_schema.rb
|
@@ -301,7 +315,7 @@ homepage: https://github.com/samvera/hydra-works
|
|
301
315
|
licenses:
|
302
316
|
- APACHE2
|
303
317
|
metadata: {}
|
304
|
-
post_install_message:
|
318
|
+
post_install_message:
|
305
319
|
rdoc_options: []
|
306
320
|
require_paths:
|
307
321
|
- lib
|
@@ -317,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
317
331
|
version: '0'
|
318
332
|
requirements: []
|
319
333
|
rubygems_version: 3.0.3
|
320
|
-
signing_key:
|
334
|
+
signing_key:
|
321
335
|
specification_version: 4
|
322
336
|
summary: Fundamental repository data model for Samvera applications
|
323
337
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
sudo: false
|
4
|
-
bundler_args: --without debug
|
5
|
-
env:
|
6
|
-
global:
|
7
|
-
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
8
|
-
rvm:
|
9
|
-
- 2.5.1
|
10
|
-
- 2.4.4
|
11
|
-
before_script:
|
12
|
-
- jdk_switcher use oraclejdk8
|
13
|
-
|
14
|
-
before_install:
|
15
|
-
- gem update --system
|
File without changes
|