hydra-file_characterization 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +105 -34
  3. data/.github_changelog_generator +1 -1
  4. data/.gitignore +1 -0
  5. data/.rubocop.yml +10 -0
  6. data/.rubocop_todo.yml +92 -0
  7. data/CHANGELOG.md +11 -2
  8. data/CONTRIBUTING.md +43 -12
  9. data/Gemfile +1 -0
  10. data/Guardfile +1 -0
  11. data/README.md +41 -7
  12. data/Rakefile +1 -0
  13. data/hydra-file_characterization.gemspec +8 -5
  14. data/lib/hydra/file_characterization/characterizer.rb +35 -36
  15. data/lib/hydra/file_characterization/characterizers/ffprobe.rb +2 -2
  16. data/lib/hydra/file_characterization/characterizers/fits.rb +13 -13
  17. data/lib/hydra/file_characterization/characterizers/fits_servlet.rb +4 -14
  18. data/lib/hydra/file_characterization/characterizers.rb +4 -3
  19. data/lib/hydra/file_characterization/exceptions.rb +1 -2
  20. data/lib/hydra/file_characterization/to_temp_file.rb +3 -3
  21. data/lib/hydra/file_characterization/version.rb +2 -1
  22. data/lib/hydra/file_characterization.rb +32 -36
  23. data/lib/hydra-file_characterization.rb +1 -0
  24. data/spec/lib/hydra/file_characterization/characterizer_spec.rb +9 -8
  25. data/spec/lib/hydra/file_characterization/characterizers/ffprobe_spec.rb +4 -7
  26. data/spec/lib/hydra/file_characterization/characterizers/fit_servlet_spec.rb +6 -3
  27. data/spec/lib/hydra/file_characterization/characterizers/fits_spec.rb +7 -4
  28. data/spec/lib/hydra/file_characterization/characterizers_spec.rb +10 -10
  29. data/spec/lib/hydra/file_characterization/to_temp_file_spec.rb +2 -4
  30. data/spec/spec_helper.rb +2 -1
  31. metadata +24 -8
  32. data/.travis.yml +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45f7b237836fc29047cfa5977c7a2644f5789059c846da12316f3ddd7aaa881c
4
- data.tar.gz: 2c3e32837e473c11ef863993aa87c7874e07cf41504690bda7adc94e5c443341
3
+ metadata.gz: 56c9450e6385d299449923153c0a07fd7ff7b40fc4f79c39c825ac0be4b7a1db
4
+ data.tar.gz: d6ba20b50f5e4709ecb41efce1765eed9a6fb8f1fd9e327db59c5852be8ebd53
5
5
  SHA512:
6
- metadata.gz: 3fcd0bee8d7b702a15a207a0ca07f65d7dc05e00ad1d13c537c1072fa12ded45236e2f301d89dd6eea74ec0b9260bc075e5bf340cce81e1f3eb886978ee5cb78
7
- data.tar.gz: 8edf19cab005e79a44b18edc1e4a6b086c30ac20d4fa251fdf036b95660d13d055cf17f2fa37cac7040314c7790f277bb37e45af2463bcd91d7dc2c6857c1bad
6
+ metadata.gz: 4c7a22258f318ab543e96844675e8cd92cce87e451b5c03e1979e73c95d71ef397d9494981b90d5db7d38f1aa4ff1c01ca315ad774b5d5813cc300496cb1a44e
7
+ data.tar.gz: bf1472f33609315976ec758316b73cd6d37e78cdf0c822d20c23bae45709eeacf4440ba359a83a9ae35bd0ec6fffff088b9f4593d09817ac86e9cb63a4ecaf67
data/.circleci/config.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  version: 2.1
3
3
  orbs:
4
- samvera: samvera/circleci-orb@0
4
+ samvera: samvera/circleci-orb@1
5
5
  jobs:
6
6
  test:
7
7
  parameters:
@@ -9,7 +9,7 @@ jobs:
9
9
  type: string
10
10
  bundler_version:
11
11
  type: string
12
- default: 1.17.3
12
+ default: 2.3.11
13
13
  rails_version:
14
14
  type: string
15
15
  executor:
@@ -38,6 +38,7 @@ jobs:
38
38
  command: |
39
39
  echo "export PATH=$HOME/fits:$PATH" >> $BASH_ENV
40
40
  source $BASH_ENV
41
+ - samvera/rubocop
41
42
  - samvera/parallel_rspec
42
43
 
43
44
  workflows:
@@ -45,46 +46,116 @@ workflows:
45
46
  ci:
46
47
  jobs:
47
48
  - test:
48
- name: ruby2-7_rails6-0
49
- ruby_version: 2.7.0
50
- rails_version: 6.0.2
49
+ name: ruby3-2_rails7
50
+ ruby_version: 3.2.0
51
+ rails_version: 7.0.4.1
52
+ - test:
53
+ name: ruby3-1_rails7
54
+ ruby_version: 3.1.3
55
+ rails_version: 7.0.4.1
56
+ - test:
57
+ name: ruby3-0_rails7
58
+ ruby_version: 3.0.5
59
+ rails_version: 7.0.4.1
60
+ - test:
61
+ name: ruby3-2_rails6-1
62
+ ruby_version: 3.2.0
63
+ rails_version: 6.1.7.1
64
+ - test:
65
+ name: ruby3-1_rails6-1
66
+ ruby_version: 3.1.3
67
+ rails_version: 6.1.7.1
68
+ - test:
69
+ name: ruby3-0_rails6-1
70
+ ruby_version: 3.0.5
71
+ rails_version: 6.1.7.1
51
72
  - test:
52
- name: ruby2-6_rails6-0
53
- ruby_version: 2.6.5
54
- rails_version: 6.0.2
73
+ name: ruby3-2_rails6-0
74
+ ruby_version: 3.2.0
75
+ rails_version: 6.0.6.1
55
76
  - test:
56
- name: ruby2-5_rails6-0
57
- ruby_version: 2.5.7
58
- rails_version: 6.0.2
77
+ name: ruby3-1_rails6-0
78
+ ruby_version: 3.1.3
79
+ rails_version: 6.0.6.1
80
+ - test:
81
+ name: ruby3-0_rails6-0
82
+ ruby_version: 3.0.5
83
+ rails_version: 6.0.6.1
84
+ - test:
85
+ name: ruby2-7_rails7-0
86
+ ruby_version: 2.7.7
87
+ rails_version: 7.0.4.1
88
+ - test:
89
+ name: ruby2-7_rails6-1
90
+ ruby_version: 2.7.7
91
+ rails_version: 6.1.7.1
92
+ - test:
93
+ name: ruby2-7_rails6-0
94
+ ruby_version: 2.7.7
95
+ rails_version: 6.0.6.1
59
96
  - test:
60
97
  name: ruby2-7_rails5-2
61
- ruby_version: 2.7.0
62
- rails_version: 5.2.4
98
+ ruby_version: 2.7.7
99
+ rails_version: 5.2.8.1
100
+
101
+ nightly:
102
+ triggers:
103
+ - schedule:
104
+ cron: "0 0 * * *"
105
+ filters:
106
+ branches:
107
+ only:
108
+ - main
109
+ jobs:
110
+ - test:
111
+ name: ruby3-2_rails7
112
+ ruby_version: 3.2.0
113
+ rails_version: 7.0.4.1
114
+ - test:
115
+ name: ruby3-1_rails7
116
+ ruby_version: 3.1.3
117
+ rails_version: 7.0.4.1
118
+ - test:
119
+ name: ruby3-0_rails7
120
+ ruby_version: 3.0.5
121
+ rails_version: 7.0.4.1
63
122
  - test:
64
- name: ruby2-6_rails5-2
65
- ruby_version: 2.6.5
66
- rails_version: 5.2.4
123
+ name: ruby3-2_rails6-1
124
+ ruby_version: 3.2.0
125
+ rails_version: 6.1.7.1
67
126
  - test:
68
- name: ruby2-5_rails5-2
69
- ruby_version: 2.5.7
70
- rails_version: 5.2.4
127
+ name: ruby3-1_rails6-1
128
+ ruby_version: 3.1.3
129
+ rails_version: 6.1.7.1
71
130
  - test:
72
- name: ruby2-4_rails5-2
73
- ruby_version: 2.4.9
74
- rails_version: 5.2.4
131
+ name: ruby3-0_rails6-1
132
+ ruby_version: 3.0.5
133
+ rails_version: 6.1.7.1
75
134
  - test:
76
- name: ruby2-7_rails5-1
77
- ruby_version: 2.7.0
78
- rails_version: 5.1.7
135
+ name: ruby3-2_rails6-0
136
+ ruby_version: 3.2.0
137
+ rails_version: 6.0.6.1
79
138
  - test:
80
- name: ruby2-6_rails5-1
81
- ruby_version: 2.6.5
82
- rails_version: 5.1.7
139
+ name: ruby3-1_rails6-0
140
+ ruby_version: 3.1.3
141
+ rails_version: 6.0.6.1
83
142
  - test:
84
- name: ruby2-5_rails5-1
85
- ruby_version: 2.5.7
86
- rails_version: 5.1.7
143
+ name: ruby3-0_rails6-0
144
+ ruby_version: 3.0.5
145
+ rails_version: 6.0.6.1
87
146
  - test:
88
- name: ruby2-4_rails5-1
89
- ruby_version: 2.4.9
90
- rails_version: 5.1.7
147
+ name: ruby2-7_rails7-0
148
+ ruby_version: 2.7.7
149
+ rails_version: 7.0.4.1
150
+ - test:
151
+ name: ruby2-7_rails6-1
152
+ ruby_version: 2.7.7
153
+ rails_version: 6.1.7.1
154
+ - test:
155
+ name: ruby2-7_rails6-0
156
+ ruby_version: 2.7.7
157
+ rails_version: 6.0.6.1
158
+ - test:
159
+ name: ruby2-7_rails5-2
160
+ ruby_version: 2.7.7
161
+ rails_version: 5.2.8.1
@@ -1,2 +1,2 @@
1
1
  unreleased=true
2
- future-release=1.1.1
2
+ future-release=1.1.2
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  .idea/
19
+ fits.log
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ inherit_gem:
4
+ bixby: bixby_default.yml
5
+
6
+ AllCops:
7
+ TargetRubyVersion: 2.6
8
+ Exclude:
9
+ - spec/lib/hydra/file_characterization_spec.rb
10
+ - vendor/bundle/**/*
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,92 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-06-10 16:20:03 -0400 using RuboCop version 0.85.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: Include.
11
+ # Include: **/*.gemfile, **/Gemfile, **/gems.rb
12
+ Bundler/DuplicatedGem:
13
+ Exclude:
14
+ - 'Gemfile'
15
+
16
+ # Offense count: 1
17
+ # Cop supports --auto-correct.
18
+ # Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity.
19
+ # SupportedStylesAlignWith: keyword, variable, start_of_line
20
+ Layout/EndAlignment:
21
+ Exclude:
22
+ - 'lib/hydra/file_characterization.rb'
23
+
24
+ # Offense count: 6
25
+ # Cop supports --auto-correct.
26
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
27
+ # URISchemes: http, https
28
+ Layout/LineLength:
29
+ Max: 293
30
+
31
+ # Offense count: 5
32
+ # Configuration parameters: CountComments, ExcludedMethods.
33
+ # ExcludedMethods: refine
34
+ Metrics/BlockLength:
35
+ Max: 50
36
+
37
+ # Offense count: 1
38
+ # Configuration parameters: CountComments, ExcludedMethods.
39
+ Metrics/MethodLength:
40
+ Max: 15
41
+
42
+ # Offense count: 1
43
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, Regex, IgnoreExecutableScripts, AllowedAcronyms.
44
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
45
+ Naming/FileName:
46
+ Exclude:
47
+ - '**/Gemfile'
48
+ - '**/*.rake'
49
+ - 'Capfile'
50
+ - 'config/deploy/*'
51
+ - 'lib/hydra-file_characterization.rb'
52
+
53
+ # Offense count: 2
54
+ # Configuration parameters: Max.
55
+ RSpec/ExampleLength:
56
+ Exclude:
57
+ - 'spec/lib/hydra/file_characterization/to_temp_file_spec.rb'
58
+
59
+ # Offense count: 6
60
+ # Configuration parameters: AssignmentOnly.
61
+ RSpec/InstanceVariable:
62
+ Exclude:
63
+ - 'spec/lib/hydra/file_characterization/to_temp_file_spec.rb'
64
+
65
+ # Offense count: 4
66
+ # Configuration parameters: .
67
+ # SupportedStyles: have_received, receive
68
+ RSpec/MessageSpies:
69
+ EnforcedStyle: receive
70
+
71
+ # Offense count: 9
72
+ # Configuration parameters: IgnoreSharedExamples.
73
+ RSpec/NamedSubject:
74
+ Exclude:
75
+ - 'spec/lib/hydra/file_characterization/characterizer_spec.rb'
76
+ - 'spec/lib/hydra/file_characterization/characterizers/ffprobe_spec.rb'
77
+ - 'spec/lib/hydra/file_characterization/characterizers/fit_servlet_spec.rb'
78
+ - 'spec/lib/hydra/file_characterization/characterizers/fits_spec.rb'
79
+ - 'spec/lib/hydra/file_characterization/characterizers_spec.rb'
80
+ - 'spec/lib/hydra/file_characterization/to_temp_file_spec.rb'
81
+
82
+ # Offense count: 1
83
+ # Configuration parameters: AllowedChars.
84
+ Style/AsciiComments:
85
+ Exclude:
86
+ - 'lib/hydra/file_characterization.rb'
87
+
88
+ # Offense count: 1
89
+ # Configuration parameters: MinBodyLength.
90
+ Style/GuardClause:
91
+ Exclude:
92
+ - 'lib/hydra/file_characterization/characterizers.rb'
data/CHANGELOG.md CHANGED
@@ -1,8 +1,16 @@
1
1
  # Changelog
2
2
 
3
- ## [1.1.1](https://github.com/samvera/hydra-file_characterization/tree/1.1.1) (2020-06-10)
3
+ ## [1.1.2](https://github.com/samvera/hydra-file_characterization/tree/1.1.2) (2020-06-10)
4
4
 
5
- [Full Changelog](https://github.com/samvera/hydra-file_characterization/compare/v1.1.0...1.1.1)
5
+ [Full Changelog](https://github.com/samvera/hydra-file_characterization/compare/v1.1.1...1.1.2)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Enforce samvera style rules [\#49](https://github.com/samvera/hydra-file_characterization/pull/49) ([bess](https://github.com/bess))
10
+
11
+ ## [v1.1.1](https://github.com/samvera/hydra-file_characterization/tree/v1.1.1) (2020-06-10)
12
+
13
+ [Full Changelog](https://github.com/samvera/hydra-file_characterization/compare/v1.1.0...v1.1.1)
6
14
 
7
15
  **Closed issues:**
8
16
 
@@ -12,6 +20,7 @@
12
20
 
13
21
  **Merged pull requests:**
14
22
 
23
+ - Prep for 1.1.1 release [\#48](https://github.com/samvera/hydra-file_characterization/pull/48) ([bess](https://github.com/bess))
15
24
  - Adding Ruby 2.7.z and Rails 6.y.z releases to the CircleCI build configuration [\#46](https://github.com/samvera/hydra-file_characterization/pull/46) ([jrgriffiniii](https://github.com/jrgriffiniii))
16
25
  - Update CircleCI Ruby and Rails versions [\#43](https://github.com/samvera/hydra-file_characterization/pull/43) ([botimer](https://github.com/botimer))
17
26
  - Updates the CircleCI configuration to test against Rails release 5.1.7 and Ruby releases 2.6.3, 2.5.5, and 2.4.6 [\#42](https://github.com/samvera/hydra-file_characterization/pull/42) ([jrgriffiniii](https://github.com/jrgriffiniii))
data/CONTRIBUTING.md CHANGED
@@ -22,6 +22,28 @@ https://wiki.duraspace.org/display/samvera/Samvera+Community+Intellectual+Proper
22
22
 
23
23
  You should also add yourself to the `CONTRIBUTORS.md` file in the root of the project.
24
24
 
25
+ ## Language
26
+
27
+ The language we use matters. Today, tomorrow, and for years to come
28
+ people will read the code we write. They will judge us for our
29
+ design, logic, and the words we use to describe the system.
30
+
31
+ Our words should be accessible. Favor descriptive words that give
32
+ meaning while avoiding reinforcing systemic inequities. For example,
33
+ in the Samvera community, we should favor using allowed\_list instead
34
+ of whitelist, denied\_list instead of blacklist, or source/copy
35
+ instead of master/slave.
36
+
37
+ We're going to get it wrong, but this is a call to keep working to
38
+ make it right. View our code and the words we choose as a chance to
39
+ have a conversation. A chance to grow an understanding of the systems
40
+ we develop as well as the systems in which we live.
41
+
42
+ See [“Blacklists” and “whitelists”: a salutary warning concerning the
43
+ prevalence of racist language in discussions of predatory
44
+ publishing](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6148600/) for
45
+ further details.
46
+
25
47
  ## Contribution Tasks
26
48
 
27
49
  * Reporting Issues
@@ -45,15 +67,22 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
45
67
 
46
68
  * Fork the repository on GitHub
47
69
  * Create a topic branch from where you want to base your work.
48
- * This is usually the master branch.
49
- * To quickly create a topic branch based on master; `git branch fix/master/my_contribution master`
50
- * Then checkout the new branch with `git checkout fix/master/my_contribution`.
51
- * Please avoid working directly on the `master` branch.
70
+ * This is usually the `main` branch.
71
+ * To quickly create a topic branch based on `main`; `git branch fix/main/my_contribution main`
72
+ * Then checkout the new branch with `git checkout fix/main/my_contribution`.
73
+ * Please avoid working directly on the `main` branch.
74
+ * Please do not create a branch called `master`. (See note below.)
52
75
  * You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
53
76
  * Make sure you have added sufficient tests and documentation for your changes.
54
77
  * Test functionality with RSpec; Test features / UI with Capybara.
55
78
  * Run _all_ the tests to assure nothing else was accidentally broken.
56
79
 
80
+ NOTE: This repository follows the [Samvera Community Code of Conduct](https://samvera.atlassian.net/wiki/spaces/samvera/pages/405212316/Code+of+Conduct)
81
+ and [language recommendations](#language).
82
+ Please ***do not*** create a branch called `master` for this repository or as part of
83
+ your pull request; the branch will either need to be removed or renamed before it can
84
+ be considered for inclusion in the code base and history of this repository.
85
+
57
86
  ### Documenting Code
58
87
 
59
88
  * All new public methods, modules, and classes should include inline documentation in [YARD](http://yardoc.org/).
@@ -109,15 +138,15 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
109
138
  ### Submitting Changes
110
139
 
111
140
  * Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
112
- * Make sure your branch is up to date with its parent branch (i.e. master)
113
- * `git checkout master`
141
+ * Make sure your branch is up to date with its parent branch (i.e. main)
142
+ * `git checkout main`
114
143
  * `git pull --rebase`
115
144
  * `git checkout <your-branch>`
116
- * `git rebase master`
145
+ * `git rebase main`
117
146
  * It is a good idea to run your tests again.
118
147
  * If you've made more than one commit take a moment to consider whether squashing commits together would help improve their logical grouping.
119
148
  * [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
120
- * `git rebase --interactive master` ([See Github help](https://help.github.com/articles/interactive-rebase))
149
+ * `git rebase --interactive main` ([See Github help](https://help.github.com/articles/interactive-rebase))
121
150
  * Squashing your branch's changes into one commit is "good form" and helps the person merging your request to see everything that is going on.
122
151
  * Push your changes to a topic branch in your fork of the repository.
123
152
  * Submit a pull request from your fork to the project.
@@ -127,12 +156,14 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
127
156
  We adopted [Github's Pull Request Review](https://help.github.com/articles/about-pull-request-reviews/) for our repositories.
128
157
  Common checks that may occur in our repositories:
129
158
 
130
- 1. Travis CI - where our automated tests are running
131
- 2. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
159
+ 1. [CircleCI](https://circleci.com/gh/samvera) - where our automated tests are running
160
+ 2. RuboCop/Bixby - where we check for style violations
161
+ 3. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
162
+ 4. CodeClimate - is our code remaining healthy (at least according to static code analysis)
132
163
 
133
164
  If one or more of the required checks failed (or are incomplete), the code should not be merged (and the UI will not allow it). If all of the checks have passed, then anyone on the project (including the pull request submitter) may merge the code.
134
165
 
135
- *Example: Carolyn submits a pull request, Justin reviews the pull request and approves. However, Justin is still waiting on other checks (Travis CI is usually the culprit), so he does not merge the pull request. Eventually, all of the checks pass. At this point, Carolyn or anyone else may merge the pull request.*
166
+ *Example: Carolyn submits a pull request, Justin reviews the pull request and approves. However, Justin is still waiting on other checks (CI tests are usually the culprit), so he does not merge the pull request. Eventually, all of the checks pass. At this point, Carolyn or anyone else may merge the pull request.*
136
167
 
137
168
  #### Things to Consider When Reviewing
138
169
 
@@ -149,7 +180,7 @@ This is your chance for a mentoring moment of another developer. Take time to gi
149
180
  * Do new or changed methods, modules, and classes have documentation?
150
181
  * Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
151
182
  * Does the description of the new/changed specs match your understanding of what the spec is doing?
152
- * Did the Travis tests complete successfully?
183
+ * Did the Continuous Integration tests complete successfully?
153
184
 
154
185
  If you are uncertain, bring other contributors into the conversation by assigning them as a reviewer.
155
186
 
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  source 'https://rubygems.org'
2
3
 
3
4
  # Specify your gem's dependencies in hydra/file_characterization.gemspec
data/Guardfile CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # A sample Guardfile
2
3
  # More info at https://github.com/guard/guard#readme
3
4
 
data/README.md CHANGED
@@ -1,22 +1,36 @@
1
1
  # hydra-file_characterization
2
2
 
3
- Code: [![Version](https://badge.fury.io/rb/hydra-file_characterization.png)](http://badge.fury.io/rb/hydra-file_characterization) [![CircleCI](https://circleci.com/gh/samvera/hydra-file_characterization.svg?style=svg)](https://circleci.com/gh/samvera/hydra-file_characterization) [![Coverage Status](https://coveralls.io/repos/github/samvera/hydra-file_characterization/badge.svg?branch=master)](https://coveralls.io/github/samvera/hydra-file_characterization?branch=master)
3
+ Code:
4
+ [![Gem Version](https://badge.fury.io/rb/hydra-file_characterization.png)](http://badge.fury.io/rb/hydra-file_characterization)
5
+ [![Build Status](https://circleci.com/gh/samvera/hydra-file_characterization.svg?style=svg)](https://circleci.com/gh/samvera/hydra-file_characterization)
6
+ [![Coverage Status](https://coveralls.io/repos/github/samvera/hydra-file_characterization/badge.svg?branch=main)](https://coveralls.io/github/samvera/hydra-file_characterization?branch=main)
4
7
 
5
- Docs: [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md) [![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
8
+ Docs:
9
+ [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
10
+ [![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
6
11
 
7
- Jump in: [![Slack Status](http://slack.samvera.org/badge.svg)](http://slack.samvera.org/)
12
+ Community Support: [![Samvera Community Slack](https://img.shields.io/badge/samvera-slack-blueviolet)](http://slack.samvera.org/)
8
13
 
9
14
  # What is hydra-file_characterization?
10
15
 
11
16
  Provides a wrapper for file characterization.
12
17
 
18
+ # Supported versions
19
+
20
+ This software is currently tested against:
21
+ * FITS 1.4.1
22
+ * Ruby 2.6, 2.7, and 3.0
23
+ * Rails 6.0, 6.1, and 7.0
24
+
13
25
  ## Product Owner & Maintenance
14
26
 
15
- hydra-file_characterization is a Core Component of the Samvera community. The documentation for what this means can be found [here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
27
+ `hydra-file_characterization` was a Core Component of the Samvera Community. Given a decline in available labor required for maintenance, this project no longer has a dedicated Product Owner. The documentation for what this means can be found [here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
16
28
 
17
29
  ### Product Owner
18
30
 
19
- [little9](https://github.com/little9)
31
+ **Vacant**
32
+
33
+ _Until a Product Owner has been identified, we ask that you please direct all requests for support, bug reports, and general questions to the [`#dev` Channel on the Samvera Slack](https://samvera.slack.com/app_redirect?channel=dev)._
20
34
 
21
35
  # Help
22
36
 
@@ -77,7 +91,27 @@ fits_xml, ffprobe_xml = Hydra::FileCharacterization.characterize(contents_of_a_f
77
91
 
78
92
  ## Registering New Characterizers
79
93
 
80
- This is possible by adding a characterizer to the `Hydra::FileCharacterization::Characterizers`' namespace.
94
+ This is possible by adding a characterizer to the `Hydra::FileCharacterization::Characterizers` namespace.
95
+
96
+ ## Contributing
97
+
98
+ Running the tests:
99
+ * Install FITS v1.4.1, which is the most recent version we've tested against.
100
+ ```
101
+ mkdir ~/fits
102
+ wget "https://github.com/harvard-lts/fits/releases/download/1.4.1/fits-1.4.1.zip"
103
+ unzip -d ~/fits/ "fits-1.4.1.zip"
104
+ chmod a+x ~/fits/fits.sh
105
+ ln -s ~/fits/fits.sh ~/fits/fits
106
+ rm "fits-1.4.1.zip"
107
+ ```
108
+
109
+ * Once FITS is installed, you should be able to run the tests with: `rspec spec`
110
+
111
+
112
+ If you're working on PR for this project, create a feature branch off of `main`.
113
+
114
+ This repository follows the [Samvera Community Code of Conduct](https://samvera.atlassian.net/wiki/spaces/samvera/pages/405212316/Code+of+Conduct) and [language recommendations](https://github.com/samvera/maintenance/blob/master/templates/CONTRIBUTING.md#language). Please ***do not*** create a branch called `master` for this repository or as part of your pull request; the branch will either need to be removed or renamed before it can be considered for inclusion in the code base and history of this repository.
81
115
 
82
116
  ## Releasing
83
117
 
@@ -97,4 +131,4 @@ This is possible by adding a characterizer to the `Hydra::FileCharacterization::
97
131
 
98
132
  This software has been developed by and is brought to you by the Samvera community. Learn more at the [Samvera website](http://samvera.org/).
99
133
 
100
- ![Samvera Logo](https://wiki.duraspace.org/download/thumbnails/87459292/samvera-fall-font2-200w.png?version=1&modificationDate=1498550535816&api=v2)
134
+ ![Samvera Logo](https://samvera.org/wp-content/uploads/2017/06/samvera-logo-tm.svg)
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "bundler/gem_tasks"
2
3
  require 'rspec/core'
3
4
  require 'rspec/core/rake_task'
@@ -1,4 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'hydra/file_characterization/version'
@@ -12,23 +13,25 @@ Gem::Specification.new do |gem|
12
13
  "Sue Richeson",
13
14
  "Rajesh Balekai"
14
15
  ]
15
- gem.email = [
16
+ gem.email = [
16
17
  "jatr@kb.dk",
17
18
  "jeremy.n.friesen@gmail.com",
18
19
  "spr7b@virginia.edu",
19
20
  "rbalekai@gmail.com"
20
21
  ]
21
- gem.description = %q{To provide a wrapper for file characterization}
22
- gem.summary = %q{To provide a wrapper for file characterization}
22
+ gem.description = 'To provide a wrapper for file characterization'
23
+ gem.summary = 'To provide a wrapper for file characterization'
23
24
  gem.homepage = "https://github.com/projecthydra/hydra-file_characterization"
24
25
  gem.license = "APACHE2"
25
26
 
26
- gem.files = `git ls-files`.split($/)
27
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
27
+ gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
28
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
28
29
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
29
30
  gem.require_paths = ["lib"]
31
+ gem.metadata = { "rubygems_mfa_required" => "true" }
30
32
 
31
33
  gem.add_dependency "activesupport", ">= 3.0.0"
34
+ gem.add_development_dependency 'bixby'
32
35
  gem.add_development_dependency 'coveralls'
33
36
  gem.add_development_dependency 'github_changelog_generator'
34
37
  gem.add_development_dependency "guard"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'hydra/file_characterization/exceptions'
2
3
  require 'open3'
3
4
  require 'active_support/core_ext/class/attribute'
@@ -15,9 +16,7 @@ module Hydra::FileCharacterization
15
16
  end
16
17
 
17
18
  def call
18
- unless File.exists?(filename)
19
- raise Hydra::FileCharacterization::FileNotFoundError.new("File: #{filename} does not exist.")
20
- end
19
+ raise Hydra::FileCharacterization::FileNotFoundError, "File: #{filename} does not exist." unless File.exist?(filename)
21
20
 
22
21
  post_process(output)
23
22
  end
@@ -32,47 +31,47 @@ module Hydra::FileCharacterization
32
31
 
33
32
  protected
34
33
 
35
- # Override this method if you want your processor to mutate the
36
- # raw output
37
- def post_process(raw_output)
38
- raw_output
39
- end
34
+ # Override this method if you want your processor to mutate the
35
+ # raw output
36
+ def post_process(raw_output)
37
+ raw_output
38
+ end
40
39
 
41
- def convention_based_tool_name
42
- self.class.name.split("::").last.downcase
43
- end
40
+ def convention_based_tool_name
41
+ self.class.name.split("::").last.downcase
42
+ end
44
43
 
45
- def internal_call
46
- stdin, stdout, stderr, wait_thr = popen3(command)
47
- begin
48
- out = stdout.read
49
- err = stderr.read
50
- exit_status = wait_thr.value
51
- raise "Unable to execute command \"#{command}\"\n#{err}" unless exit_status.success?
52
- out
53
- ensure
54
- stdin.close
55
- stdout.close
56
- stderr.close
57
- end
44
+ def internal_call
45
+ stdin, stdout, stderr, wait_thr = popen3(command)
46
+ begin
47
+ out = stdout.read
48
+ err = stderr.read
49
+ exit_status = wait_thr.value
50
+ raise "Unable to execute command \"#{command}\"\n#{err}" unless exit_status.success?
51
+ out
52
+ ensure
53
+ stdin.close
54
+ stdout.close
55
+ stderr.close
58
56
  end
57
+ end
59
58
 
60
- def command
61
- raise NotImplementedError, "Method #command should be overriden in child classes"
62
- end
59
+ def command
60
+ raise NotImplementedError, "Method #command should be overriden in child classes"
61
+ end
63
62
 
64
63
  private
65
64
 
66
- def output
67
- if tool_path.respond_to?(:call)
68
- tool_path.call(filename)
69
- else
70
- internal_call
71
- end
65
+ def output
66
+ if tool_path.respond_to?(:call)
67
+ tool_path.call(filename)
68
+ else
69
+ internal_call
72
70
  end
71
+ end
73
72
 
74
- def activefedora_logger
75
- ActiveFedora::Base.logger if defined? ActiveFedora
76
- end
73
+ def activefedora_logger
74
+ ActiveFedora::Base.logger if defined? ActiveFedora
75
+ end
77
76
  end
78
77
  end
@@ -1,13 +1,13 @@
1
+ # frozen_string_literal: true
1
2
  require 'hydra/file_characterization/exceptions'
2
3
  require 'hydra/file_characterization/characterizer'
3
4
 
4
5
  module Hydra::FileCharacterization::Characterizers
5
6
  class Ffprobe < Hydra::FileCharacterization::Characterizer
6
-
7
7
  protected
8
+
8
9
  def command
9
10
  "#{tool_path} -i \"#{filename}\" -print_format xml -show_streams -v quiet"
10
11
  end
11
-
12
12
  end
13
13
  end
@@ -1,23 +1,23 @@
1
+ # frozen_string_literal: true
1
2
  require 'hydra/file_characterization/exceptions'
2
3
  require 'hydra/file_characterization/characterizer'
3
4
  require 'logger'
4
5
  module Hydra::FileCharacterization::Characterizers
5
6
  class Fits < Hydra::FileCharacterization::Characterizer
6
-
7
7
  protected
8
8
 
9
- def command
10
- "#{tool_path} -i \"#{filename}\""
11
- end
9
+ def command
10
+ "#{tool_path} -i \"#{filename}\""
11
+ end
12
12
 
13
- # Remove any non-XML output that precedes the <?xml> tag
14
- # See: https://github.com/harvard-lts/fits/issues/20
15
- # https://github.com/harvard-lts/fits/issues/40
16
- # https://github.com/harvard-lts/fits/issues/46
17
- def post_process(raw_output)
18
- md = /\A(.*)(<\?xml.*)\Z/m.match(raw_output)
19
- logger.warn "FITS produced non-xml output: \"#{md[1].chomp}\"" unless md[1].empty?
20
- md[2]
21
- end
13
+ # Remove any non-XML output that precedes the <?xml> tag
14
+ # See: https://github.com/harvard-lts/fits/issues/20
15
+ # https://github.com/harvard-lts/fits/issues/40
16
+ # https://github.com/harvard-lts/fits/issues/46
17
+ def post_process(raw_output)
18
+ md = /\A(.*)(<\?xml.*)\Z/m.match(raw_output)
19
+ logger.warn "FITS produced non-xml output: \"#{md[1].chomp}\"" unless md[1].empty?
20
+ md[2]
21
+ end
22
22
  end
23
23
  end
@@ -1,23 +1,13 @@
1
+ # frozen_string_literal: true
1
2
  require 'hydra/file_characterization/exceptions'
2
3
  require 'hydra/file_characterization/characterizer'
3
4
  require 'logger'
4
5
  module Hydra::FileCharacterization::Characterizers
5
6
  class FitsServlet < Hydra::FileCharacterization::Characterizer
6
-
7
7
  protected
8
8
 
9
- def command
10
- "curl -k -F datafile=@#{filename} #{ENV['FITS_SERVLET_URL']}/examine"
11
- end
12
-
13
- # Remove any non-XML output that precedes the <?xml> tag
14
- # See: https://github.com/harvard-lts/fits/issues/20
15
- # https://github.com/harvard-lts/fits/issues/40
16
- # https://github.com/harvard-lts/fits/issues/46
17
- def post_process(raw_output)
18
- md = /\A(.*)(<\?xml.*)\Z/m.match(raw_output)
19
- logger.warn "FITS produced non-xml output: \"#{md[1].chomp}\"" unless md[1].empty?
20
- md[2]
21
- end
9
+ def command
10
+ "curl -s -k -F datafile=@'#{filename}' #{ENV['FITS_SERVLET_URL']}/examine"
11
+ end
22
12
  end
23
13
  end
@@ -1,19 +1,21 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::FileCharacterization
2
3
  module Characterizers
3
4
  end
4
5
 
5
6
  module_function
7
+
6
8
  def characterizer(tool_name)
7
9
  characterizer_name = characterizer_name_from(tool_name)
8
10
  if Characterizers.const_defined?(characterizer_name)
9
11
  Characterizers.const_get(characterizer_name)
10
12
  else
11
- raise ToolNotFoundError.new(tool_name)
13
+ raise ToolNotFoundError, tool_name
12
14
  end
13
15
  end
14
16
 
15
17
  def characterizer_name_from(tool_name)
16
- tool_name.to_s.gsub(/(?:^|_)([a-z])/) { $1.upcase }
18
+ tool_name.to_s.gsub(/(?:^|_)([a-z])/) { Regexp.last_match(1).upcase }
17
19
  end
18
20
 
19
21
  def characterize_with(tool_name, path_to_file, path_to_tool)
@@ -24,7 +26,6 @@ module Hydra::FileCharacterization
24
26
  tool_obj.call
25
27
  end
26
28
  end
27
-
28
29
  end
29
30
 
30
31
  require 'hydra/file_characterization/characterizers/fits'
@@ -1,5 +1,5 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra::FileCharacterization
2
-
3
3
  class FileNotFoundError < RuntimeError
4
4
  end
5
5
 
@@ -8,5 +8,4 @@ module Hydra::FileCharacterization
8
8
  super("Unable to find Hydra::FileCharacterization tool with name :#{tool_name}")
9
9
  end
10
10
  end
11
-
12
11
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'open3'
2
3
  require 'tempfile'
3
4
 
@@ -16,7 +17,7 @@ module Hydra::FileCharacterization
16
17
  end
17
18
 
18
19
  def call(data)
19
- f = Tempfile.new([File.basename(filename),File.extname(filename)])
20
+ f = Tempfile.new([File.basename(filename), File.extname(filename)])
20
21
  begin
21
22
  f.binmode
22
23
  if data.respond_to? :read
@@ -32,6 +33,5 @@ module Hydra::FileCharacterization
32
33
  f.unlink
33
34
  end
34
35
  end
35
-
36
36
  end
37
- end
37
+ end
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
1
2
  module Hydra
2
3
  module FileCharacterization
3
- VERSION = "1.1.1"
4
+ VERSION = "1.2.0"
4
5
  end
5
6
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "hydra/file_characterization/version"
2
3
  require "hydra/file_characterization/exceptions"
3
4
  require "hydra/file_characterization/to_temp_file"
@@ -6,7 +7,6 @@ require "hydra/file_characterization/characterizers"
6
7
  require "active_support/configurable"
7
8
 
8
9
  module Hydra
9
-
10
10
  module_function
11
11
 
12
12
  # A convenience method
@@ -15,7 +15,6 @@ module Hydra
15
15
  end
16
16
 
17
17
  module FileCharacterization
18
-
19
18
  class << self
20
19
  attr_accessor :configuration
21
20
  end
@@ -66,7 +65,7 @@ module Hydra
66
65
  tool_names = Array(tool_names).flatten.compact
67
66
  custom_paths = {}
68
67
  yield(custom_paths) if block_given?
69
-
68
+
70
69
  tool_outputs = run_characterizers(content, filename, tool_names, custom_paths)
71
70
  tool_names.size == 1 ? tool_outputs.first : tool_outputs
72
71
  end
@@ -76,50 +75,47 @@ module Hydra
76
75
  yield(configuration)
77
76
  end
78
77
 
79
- private
80
-
81
- # Break up a list of arguments into two possible lists:
82
- # option1: [String] content, [String] filename, [Array] tool_names
83
- # option2: [File] content, [Array] tool_names
84
- # In the case of option2, derive the filename from the file's path
85
- # @return [String, File], [String], [Array]
86
- def self.extract_arguments(args)
87
- content = args.shift
88
- filename = if content.is_a?(File) && !args[0].is_a?(String)
89
- File.basename(content.path)
90
- else
91
- args.shift
92
- end
93
- tool_names = args
94
- return content, filename, tool_names
78
+ # Break up a list of arguments into two possible lists:
79
+ # option1: [String] content, [String] filename, [Array] tool_names
80
+ # option2: [File] content, [Array] tool_names
81
+ # In the case of option2, derive the filename from the file's path
82
+ # @return [String, File], [String], [Array]
83
+ def self.extract_arguments(args)
84
+ content = args.shift
85
+ filename = if content.is_a?(File) && !args[0].is_a?(String)
86
+ File.basename(content.path)
87
+ else
88
+ args.shift
95
89
  end
90
+ tool_names = args
91
+ [content, filename, tool_names]
92
+ end
96
93
 
97
- # @param [File, String] content Either an open file or a string. If a string is passed
98
- # a temp file will be created
99
- # @param [String] filename Used in creating a temp file name
100
- # @param [Array<Symbol>] tool_names A list of symbols referencing the characerization tools to run
101
- # @param [Hash] custom_paths The paths to the executables of the tool.
102
- def self.run_characterizers(content, filename, tool_names, custom_paths)
103
- if content.is_a? File
104
- run_characterizers_on_file(content, tool_names, custom_paths)
105
- else
106
- FileCharacterization::ToTempFile.open(filename, content) do |f|
107
- run_characterizers_on_file(f, tool_names, custom_paths)
108
- end
94
+ # @param [File, String] content Either an open file or a string. If a string is passed
95
+ # a temp file will be created
96
+ # @param [String] filename Used in creating a temp file name
97
+ # @param [Array<Symbol>] tool_names A list of symbols referencing the characerization tools to run
98
+ # @param [Hash] custom_paths The paths to the executables of the tool.
99
+ def self.run_characterizers(content, filename, tool_names, custom_paths)
100
+ if content.is_a? File
101
+ run_characterizers_on_file(content, tool_names, custom_paths)
102
+ else
103
+ FileCharacterization::ToTempFile.open(filename, content) do |f|
104
+ run_characterizers_on_file(f, tool_names, custom_paths)
109
105
  end
110
106
  end
107
+ end
111
108
 
112
- def self.run_characterizers_on_file(f, tool_names, custom_paths)
113
- tool_names.map do |tool_name|
114
- FileCharacterization.characterize_with(tool_name, f.path, custom_paths[tool_name])
115
- end
109
+ def self.run_characterizers_on_file(f, tool_names, custom_paths)
110
+ tool_names.map do |tool_name|
111
+ FileCharacterization.characterize_with(tool_name, f.path, custom_paths[tool_name])
116
112
  end
113
+ end
117
114
 
118
115
  class Configuration
119
116
  def tool_path(tool_name, tool_path)
120
117
  Hydra::FileCharacterization.characterizer(tool_name).tool_path = tool_path
121
118
  end
122
119
  end
123
-
124
120
  end
125
121
  end
@@ -1 +1,2 @@
1
+ # frozen_string_literal: true
1
2
  require "hydra/file_characterization"
@@ -1,30 +1,31 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  module Hydra::FileCharacterization
4
5
  describe Characterizer do
6
+ subject { characterizer }
5
7
  let(:filename) { __FILE__ }
6
8
  let(:instance_tool_path) { nil }
7
9
  let(:class_tool_path) { nil }
8
10
 
9
- let(:characterizer) { Hydra::FileCharacterization::Characterizer.new(filename, instance_tool_path) }
10
- subject { characterizer }
11
- around(:each) do |example|
12
- Hydra::FileCharacterization::Characterizer.tool_path = class_tool_path
11
+ let(:characterizer) { described_class.new(filename, instance_tool_path) }
12
+ around do |example|
13
+ described_class.tool_path = class_tool_path
13
14
  example.run
14
- Hydra::FileCharacterization::Characterizer.tool_path = nil
15
+ described_class.tool_path = nil
15
16
  end
16
17
 
17
18
  context 'call' do
18
19
  context 'with missing file' do
19
20
  let(:filename) { '/dev/path/to/bogus/file' }
20
- it 'should raise FileNotFoundError' do
21
+ it 'raises FileNotFoundError' do
21
22
  expect { subject.call }.to raise_error(FileNotFoundError)
22
23
  end
23
24
  end
24
25
 
25
26
  context 'with a callable tool path' do
26
- let(:class_tool_path) { lambda { |filename| [filename, :output] }}
27
- it 'should raise FileNotFoundError' do
27
+ let(:class_tool_path) { ->(filename) { [filename, :output] } }
28
+ it 'raises FileNotFoundError' do
28
29
  expect(subject.call).to eq [filename, :output]
29
30
  end
30
31
  end
@@ -1,19 +1,16 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'hydra/file_characterization/characterizers/ffprobe'
3
4
 
4
5
  module Hydra::FileCharacterization::Characterizers
5
-
6
6
  describe Ffprobe do
7
-
8
- subject { Ffprobe.new(filename) }
7
+ subject { described_class.new(filename) }
9
8
 
10
9
  describe 'invalidFile' do
11
10
  let(:filename) { fixture_file('nofile.pdf') }
12
- it "should raise an error if the path does not contain the file" do
13
- expect {subject.call}.to raise_error(Hydra::FileCharacterization::FileNotFoundError)
11
+ it "raises an error if the path does not contain the file" do
12
+ expect { subject.call }.to raise_error(Hydra::FileCharacterization::FileNotFoundError)
14
13
  end
15
14
  end
16
-
17
15
  end
18
-
19
16
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'hydra/file_characterization/characterizers/fits_servlet'
3
4
 
@@ -27,7 +28,7 @@ module Hydra::FileCharacterization::Characterizers
27
28
 
28
29
  context 'zip file should be characterized not its contents' do
29
30
  let(:filename) { fixture_file('archive.zip') }
30
- it { is_expected.to include(%(<identity format="ZIP Format" mimetype="application/zip"))}
31
+ it { is_expected.to include(%(<identity format="ZIP Format" mimetype="application/zip")) }
31
32
  end
32
33
  end
33
34
 
@@ -41,7 +42,8 @@ module Hydra::FileCharacterization::Characterizers
41
42
  'READBOX seen=true
42
43
  <?xml version="1.0" encoding="UTF-8"?>
43
44
  <fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/fits/fits_output http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd" version="0.8.2" timestamp="15/09/14 10:00 AM">
44
- <identification/></fits>')
45
+ <identification/></fits>'
46
+ )
45
47
  end
46
48
 
47
49
  let(:filename) { fixture_file('brendan_behan.jpeg') }
@@ -58,7 +60,8 @@ module Hydra::FileCharacterization::Characterizers
58
60
  '2015-10-15 17:14:25,761 ERROR [main] ToolBelt:79 - Thread 1 error initializing edu.harvard.hul.ois.fits.tools.droid.Droid: edu.harvard.hul.ois.fits.exceptions.FitsToolException Message: DROID cannot run under Java 8
59
61
  <?xml version="1.0" encoding="UTF-8"?>
60
62
  <fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/fits/fits_output http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd" version="0.8.2" timestamp="15/09/14 10:00 AM">
61
- <identification/></fits>')
63
+ <identification/></fits>'
64
+ )
62
65
  end
63
66
 
64
67
  let(:filename) { fixture_file('brendan_behan.jpeg') }
@@ -1,9 +1,10 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'hydra/file_characterization/characterizers/fits'
3
4
 
4
5
  module Hydra::FileCharacterization::Characterizers
5
6
  describe Fits do
6
- let(:fits) { Fits.new(filename) }
7
+ let(:fits) { described_class.new(filename) }
7
8
 
8
9
  describe "#call", unless: ENV['TRAVIS'] do
9
10
  subject { fits.call }
@@ -27,7 +28,7 @@ module Hydra::FileCharacterization::Characterizers
27
28
 
28
29
  context 'zip file should be characterized not its contents' do
29
30
  let(:filename) { fixture_file('archive.zip') }
30
- it { is_expected.to include(%(<identity format="ZIP Format" mimetype="application/zip"))}
31
+ it { is_expected.to include(%(<identity format="ZIP Format" mimetype="application/zip")) }
31
32
  end
32
33
  end
33
34
 
@@ -41,7 +42,8 @@ module Hydra::FileCharacterization::Characterizers
41
42
  'READBOX seen=true
42
43
  <?xml version="1.0" encoding="UTF-8"?>
43
44
  <fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/fits/fits_output http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd" version="0.8.2" timestamp="15/09/14 10:00 AM">
44
- <identification/></fits>')
45
+ <identification/></fits>'
46
+ )
45
47
  end
46
48
 
47
49
  let(:filename) { fixture_file('brendan_behan.jpeg') }
@@ -58,7 +60,8 @@ module Hydra::FileCharacterization::Characterizers
58
60
  '2015-10-15 17:14:25,761 ERROR [main] ToolBelt:79 - Thread 1 error initializing edu.harvard.hul.ois.fits.tools.droid.Droid: edu.harvard.hul.ois.fits.exceptions.FitsToolException Message: DROID cannot run under Java 8
59
61
  <?xml version="1.0" encoding="UTF-8"?>
60
62
  <fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/fits/fits_output http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd" version="0.8.2" timestamp="15/09/14 10:00 AM">
61
- <identification/></fits>')
63
+ <identification/></fits>'
64
+ )
62
65
  end
63
66
 
64
67
  let(:filename) { fixture_file('brendan_behan.jpeg') }
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'hydra/file_characterization/characterizers'
3
4
 
@@ -7,36 +8,35 @@ module Hydra::FileCharacterization
7
8
 
8
9
  describe 'with :fits tool_name' do
9
10
  let(:tool_name) { :fits }
10
- it { should eq(Characterizers::Fits) }
11
+ it { is_expected.to eq(Characterizers::Fits) }
11
12
  end
12
13
 
13
14
  describe 'with :ffprobe tool_name' do
14
15
  let(:tool_name) { :ffprobe }
15
- it { should eq(Characterizers::Ffprobe) }
16
+ it { is_expected.to eq(Characterizers::Ffprobe) }
16
17
  end
17
18
 
18
19
  context '.characterize_with' do
20
+ subject { Hydra::FileCharacterization.characterize_with(tool_name, filename, tool_path) }
19
21
  let(:tool_name) { :fits }
20
22
  let(:filename) { __FILE__ }
21
23
  let(:tool_path) { nil }
22
- subject { Hydra::FileCharacterization.characterize_with(tool_name, filename, tool_path) }
23
24
 
24
25
  context 'with callable tool_path and missing tool name' do
25
- let(:tool_path) { lambda {|filename| [filename, :tool_path]} }
26
+ let(:tool_path) { ->(filename) { [filename, :tool_path] } }
26
27
  let(:tool_name) { :chunky_salsa }
27
- it { should eq [filename, :tool_path] }
28
+ it { is_expected.to eq [filename, :tool_path] }
28
29
  end
29
30
 
30
31
  context 'with missing tool name and non-callable tool_path' do
31
32
  let(:tool_name) { :chunky_salsa }
32
33
  let(:tool_path) { '/path' }
33
- it 'should raise exception' do
34
- expect {
34
+ it 'raises exception' do
35
+ expect do
35
36
  subject
36
- }.to raise_error(ToolNotFoundError)
37
+ end.to raise_error(ToolNotFoundError)
37
38
  end
38
39
  end
39
40
  end
40
-
41
41
  end
42
- end
42
+ end
@@ -1,10 +1,9 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'hydra/file_characterization/to_temp_file'
3
4
 
4
5
  module Hydra::FileCharacterization
5
-
6
6
  describe 'ToTempFile' do
7
-
8
7
  let(:content) { "This is the content of the file." }
9
8
  let(:filename) { "hello.rb" }
10
9
 
@@ -44,6 +43,5 @@ module Hydra::FileCharacterization
44
43
  end
45
44
  end
46
45
  end
47
-
48
46
  end
49
- end
47
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # This file was generated by the `rspec --init` command. Conventionally, all
2
3
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
4
  # Require this file using `require "spec_helper"` to ensure that it is only
@@ -6,7 +7,7 @@
6
7
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
8
 
8
9
  GEM_ROOT = File.expand_path("../../", __FILE__)
9
- $:.unshift File.join(GEM_ROOT, "lib")
10
+ $LOAD_PATH.unshift File.join(GEM_ROOT, "lib")
10
11
 
11
12
  require 'coveralls'
12
13
  Coveralls.wear!
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-file_characterization
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Treacy
8
8
  - Jeremy Friesen
9
9
  - Sue Richeson
10
10
  - Rajesh Balekai
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-06-10 00:00:00.000000000 Z
14
+ date: 2023-02-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -27,6 +27,20 @@ dependencies:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: 3.0.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: bixby
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
30
44
  - !ruby/object:Gem::Dependency
31
45
  name: coveralls
32
46
  requirement: !ruby/object:Gem::Requirement
@@ -139,7 +153,8 @@ files:
139
153
  - ".github_changelog_generator"
140
154
  - ".gitignore"
141
155
  - ".rspec"
142
- - ".travis.yml"
156
+ - ".rubocop.yml"
157
+ - ".rubocop_todo.yml"
143
158
  - CHANGELOG.md
144
159
  - CODE_OF_CONDUCT.md
145
160
  - CONTRIBUTING.md
@@ -177,8 +192,9 @@ files:
177
192
  homepage: https://github.com/projecthydra/hydra-file_characterization
178
193
  licenses:
179
194
  - APACHE2
180
- metadata: {}
181
- post_install_message:
195
+ metadata:
196
+ rubygems_mfa_required: 'true'
197
+ post_install_message:
182
198
  rdoc_options: []
183
199
  require_paths:
184
200
  - lib
@@ -193,8 +209,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
209
  - !ruby/object:Gem::Version
194
210
  version: '0'
195
211
  requirements: []
196
- rubygems_version: 3.1.0.pre1
197
- signing_key:
212
+ rubygems_version: 3.1.6
213
+ signing_key:
198
214
  specification_version: 4
199
215
  summary: To provide a wrapper for file characterization
200
216
  test_files:
data/.travis.yml DELETED
@@ -1,9 +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.4.1