rubydora 2.0.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +231 -0
- data/CODE_OF_CONDUCT.md +40 -0
- data/CONTRIBUTING.md +23 -21
- data/Dockerfile +15 -0
- data/Gemfile +17 -2
- data/README.md +66 -13
- data/Rakefile +34 -17
- data/SUPPORT.md +13 -0
- data/VERSION +1 -1
- data/docker/install.properties +28 -0
- data/lib/rubydora/datastream.rb +1 -1
- data/lib/rubydora/digital_object.rb +2 -2
- data/lib/rubydora/rest_api_client.rb +3 -2
- data/rubydora.gemspec +6 -2
- data/spec/lib/digital_object_spec.rb +12 -12
- data/spec/lib/integration_test_spec.rb +3 -1
- data/spec/lib/rest_api_client_spec.rb +13 -7
- data/spec/spec_helper.rb +12 -2
- metadata +49 -16
- data/.travis.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b80bb2963eff3dc98fa8cbbf40c6fd4d70fe8bce1cca7bdc17be21f099286768
|
4
|
+
data.tar.gz: b8e48e3c9e7692d3fbd94cf640158b6e770678d51e62418c3827cd8afe4fa45c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8090773921d92f1d1bb5d93629578d9d14d2f4936d082c8e8d0c7822d8208b3f66039a98c617253896117024fbf2733374fa3d00aad366882fd95be080d793b
|
7
|
+
data.tar.gz: 02ccf7487e82397f931fa4ecf1bd4a0039b805561bd1678ba05674271a605f84baf1e6f913092f32422ef48d2baf2f1879167844a4a7ff7e2454f4b15e51043c
|
@@ -0,0 +1,231 @@
|
|
1
|
+
---
|
2
|
+
version: 2.1
|
3
|
+
orbs:
|
4
|
+
samvera: samvera/circleci-orb@1.0
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
parameters:
|
8
|
+
ruby_type:
|
9
|
+
type: string
|
10
|
+
default: ruby
|
11
|
+
ruby_version:
|
12
|
+
type: string
|
13
|
+
bundler_version:
|
14
|
+
type: string
|
15
|
+
default: 2.3.10
|
16
|
+
rails_version:
|
17
|
+
type: string
|
18
|
+
docker:
|
19
|
+
- image: cimg/<< parameters.ruby_type >>:<< parameters.ruby_version >>-browsers
|
20
|
+
- image: samveralabs/fcrepo3:latest
|
21
|
+
environment:
|
22
|
+
BUNDLE_PATH: vendor/bundle
|
23
|
+
BUNDLE_JOBS: 4
|
24
|
+
BUNDLE_RETRY: 3
|
25
|
+
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
|
26
|
+
RACK_ENV: test
|
27
|
+
RAILS_ENV: test
|
28
|
+
RAILS_VERSION: << parameters.rails_version >>
|
29
|
+
SPEC_OPTS: --profile 10 --format RspecJunitFormatter --out /tmp/test-results/rspec.xml --format progress
|
30
|
+
RUBY_TYPE: << parameters.ruby_type >>
|
31
|
+
steps:
|
32
|
+
- attach_workspace:
|
33
|
+
at: ~/
|
34
|
+
- samvera/cached_checkout
|
35
|
+
- samvera/bundle_for_gem:
|
36
|
+
ruby_version: << parameters.ruby_version >>
|
37
|
+
bundler_version: << parameters.bundler_version >>
|
38
|
+
project: rubydora
|
39
|
+
- run:
|
40
|
+
name: Run RSpec
|
41
|
+
command: |
|
42
|
+
mkdir /tmp/test-results
|
43
|
+
bundle exec rake docker:spec
|
44
|
+
- store_test_results:
|
45
|
+
path: /tmp/test-results
|
46
|
+
- store_artifacts:
|
47
|
+
path: /tmp/test-results
|
48
|
+
destination: test-results
|
49
|
+
- persist_to_workspace:
|
50
|
+
root: ~/
|
51
|
+
paths:
|
52
|
+
- project/*
|
53
|
+
- project/**/*
|
54
|
+
|
55
|
+
workflows:
|
56
|
+
version: 2
|
57
|
+
ci:
|
58
|
+
jobs:
|
59
|
+
# Rails 7.0
|
60
|
+
- test:
|
61
|
+
name: "ruby3-2_rails7-0"
|
62
|
+
ruby_version: 3.2.0
|
63
|
+
rails_version: 7.0.4.1
|
64
|
+
- test:
|
65
|
+
name: "ruby3-1_rails7-0"
|
66
|
+
ruby_version: 3.1.3
|
67
|
+
rails_version: 7.0.4.1
|
68
|
+
- test:
|
69
|
+
name: "ruby3-0_rails7-0"
|
70
|
+
ruby_version: 3.0.5
|
71
|
+
rails_version: 7.0.4.1
|
72
|
+
# Rails 6.1
|
73
|
+
- test:
|
74
|
+
name: "ruby3-2_rails6-1"
|
75
|
+
ruby_version: 3.2.0
|
76
|
+
rails_version: 6.1.7.1
|
77
|
+
- test:
|
78
|
+
name: "ruby3-1_rails6-1"
|
79
|
+
ruby_version: 3.1.3
|
80
|
+
rails_version: 6.1.7.1
|
81
|
+
- test:
|
82
|
+
name: "ruby3-0_rails6-1"
|
83
|
+
ruby_version: 3.0.5
|
84
|
+
rails_version: 6.1.7.1
|
85
|
+
- test:
|
86
|
+
name: "ruby2-7_rails6-1"
|
87
|
+
ruby_version: 2.7.7
|
88
|
+
rails_version: 6.1.7.1
|
89
|
+
# Rails 6.0
|
90
|
+
- test:
|
91
|
+
name: "ruby3-2_rails6-0"
|
92
|
+
ruby_version: 3.2.0
|
93
|
+
rails_version: 6.0.6.1
|
94
|
+
- test:
|
95
|
+
name: "ruby3-1_rails6-1"
|
96
|
+
ruby_version: 3.1.3
|
97
|
+
rails_version: 6.0.6.1
|
98
|
+
- test:
|
99
|
+
name: "ruby3-0_rails6-1"
|
100
|
+
ruby_version: 3.0.5
|
101
|
+
rails_version: 6.0.6.1
|
102
|
+
- test:
|
103
|
+
name: "ruby2-7_rails6-0"
|
104
|
+
ruby_version: 2.7.7
|
105
|
+
rails_version: 6.0.6.1
|
106
|
+
- test:
|
107
|
+
name: "ruby2-6_rails6-0"
|
108
|
+
ruby_version: 2.6.10
|
109
|
+
rails_version: 6.0.6.1
|
110
|
+
- test:
|
111
|
+
name: "ruby2-5_rails6-0"
|
112
|
+
ruby_version: 2.5.9
|
113
|
+
rails_version: 6.0.6.1
|
114
|
+
# Rails 5.2
|
115
|
+
- test:
|
116
|
+
name: "ruby2-7_rails5-2"
|
117
|
+
ruby_version: 2.7.7
|
118
|
+
rails_version: 5.2.8.1
|
119
|
+
- test:
|
120
|
+
name: "ruby2-6_rails5-2"
|
121
|
+
ruby_version: 2.6.10
|
122
|
+
rails_version: 5.2.8.1
|
123
|
+
- test:
|
124
|
+
name: "ruby2-5_rails5-2"
|
125
|
+
ruby_version: 2.5.9
|
126
|
+
rails_version: 5.2.8.1
|
127
|
+
# Rails 5.1
|
128
|
+
- test:
|
129
|
+
name: "ruby2-7_rails5-1"
|
130
|
+
ruby_version: 2.7.7
|
131
|
+
rails_version: 5.1.7
|
132
|
+
- test:
|
133
|
+
name: "ruby2-6_rails5-1"
|
134
|
+
ruby_version: 2.6.10
|
135
|
+
rails_version: 5.1.7
|
136
|
+
- test:
|
137
|
+
name: "ruby2-5_rails5-1"
|
138
|
+
ruby_version: 2.5.9
|
139
|
+
rails_version: 5.1.7
|
140
|
+
|
141
|
+
nightly:
|
142
|
+
triggers:
|
143
|
+
- schedule:
|
144
|
+
cron: "0 0 * * *"
|
145
|
+
filters:
|
146
|
+
branches:
|
147
|
+
only:
|
148
|
+
- main
|
149
|
+
|
150
|
+
jobs:
|
151
|
+
# Rails 7.0
|
152
|
+
- test:
|
153
|
+
name: "ruby3-2_rails7-0"
|
154
|
+
ruby_version: 3.2.0
|
155
|
+
rails_version: 7.0.4.1
|
156
|
+
- test:
|
157
|
+
name: "ruby3-1_rails7-0"
|
158
|
+
ruby_version: 3.1.3
|
159
|
+
rails_version: 7.0.4.1
|
160
|
+
- test:
|
161
|
+
name: "ruby3-0_rails7-0"
|
162
|
+
ruby_version: 3.0.5
|
163
|
+
rails_version: 7.0.4.1
|
164
|
+
# Rails 6.1
|
165
|
+
- test:
|
166
|
+
name: "ruby3-2_rails6-1"
|
167
|
+
ruby_version: 3.2.0
|
168
|
+
rails_version: 6.1.7.1
|
169
|
+
- test:
|
170
|
+
name: "ruby3-1_rails6-1"
|
171
|
+
ruby_version: 3.1.3
|
172
|
+
rails_version: 6.1.7.1
|
173
|
+
- test:
|
174
|
+
name: "ruby3-0_rails6-1"
|
175
|
+
ruby_version: 3.0.5
|
176
|
+
rails_version: 6.1.7.1
|
177
|
+
- test:
|
178
|
+
name: "ruby2-7_rails6-1"
|
179
|
+
ruby_version: 2.7.7
|
180
|
+
rails_version: 6.1.7.1
|
181
|
+
# Rails 6.0
|
182
|
+
- test:
|
183
|
+
name: "ruby3-2_rails6-0"
|
184
|
+
ruby_version: 3.2.0
|
185
|
+
rails_version: 6.0.6.1
|
186
|
+
- test:
|
187
|
+
name: "ruby3-1_rails6-1"
|
188
|
+
ruby_version: 3.1.3
|
189
|
+
rails_version: 6.0.6.1
|
190
|
+
- test:
|
191
|
+
name: "ruby3-0_rails6-1"
|
192
|
+
ruby_version: 3.0.5
|
193
|
+
rails_version: 6.0.6.1
|
194
|
+
- test:
|
195
|
+
name: "ruby2-7_rails6-0"
|
196
|
+
ruby_version: 2.7.7
|
197
|
+
rails_version: 6.0.6.1
|
198
|
+
- test:
|
199
|
+
name: "ruby2-6_rails6-0"
|
200
|
+
ruby_version: 2.6.10
|
201
|
+
rails_version: 6.0.6.1
|
202
|
+
- test:
|
203
|
+
name: "ruby2-5_rails6-0"
|
204
|
+
ruby_version: 2.5.9
|
205
|
+
rails_version: 6.0.6.1
|
206
|
+
# Rails 5.2
|
207
|
+
- test:
|
208
|
+
name: "ruby2-7_rails5-2"
|
209
|
+
ruby_version: 2.7.7
|
210
|
+
rails_version: 5.2.8.1
|
211
|
+
- test:
|
212
|
+
name: "ruby2-6_rails5-2"
|
213
|
+
ruby_version: 2.6.10
|
214
|
+
rails_version: 5.2.8.1
|
215
|
+
- test:
|
216
|
+
name: "ruby2-5_rails5-2"
|
217
|
+
ruby_version: 2.5.9
|
218
|
+
rails_version: 5.2.8.1
|
219
|
+
# Rails 5.1
|
220
|
+
- test:
|
221
|
+
name: "ruby2-7_rails5-1"
|
222
|
+
ruby_version: 2.7.7
|
223
|
+
rails_version: 5.1.7
|
224
|
+
- test:
|
225
|
+
name: "ruby2-6_rails5-1"
|
226
|
+
ruby_version: 2.6.10
|
227
|
+
rails_version: 5.1.7
|
228
|
+
- test:
|
229
|
+
name: "ruby2-5_rails5-1"
|
230
|
+
ruby_version: 2.5.9
|
231
|
+
rails_version: 5.1.7
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
The Samvera community is dedicated to providing a welcoming and
|
2
|
+
positive experience for all its members, whether they are at a formal
|
3
|
+
gathering, in a social setting, or taking part in activities online.
|
4
|
+
The Samvera community welcomes participation from people all over the
|
5
|
+
world and these members bring with them a wide variety of
|
6
|
+
professional, personal and social backgrounds; whatever these may be,
|
7
|
+
we treat colleagues with dignity and respect.
|
8
|
+
|
9
|
+
Community members communicate primarily in English, though for many of
|
10
|
+
them this is not their native language. We therefore strive to express
|
11
|
+
ourselves simply and clearly remembering that unnecessary use of
|
12
|
+
jargon and slang will be a barrier to understanding for many of our
|
13
|
+
colleagues. We are sensitive to the fact that the international
|
14
|
+
nature of the community means that we span many different social norms
|
15
|
+
around language and behaviour and we strive to conduct ourselves,
|
16
|
+
online and in person, in ways that are unlikely to cause offence.
|
17
|
+
|
18
|
+
Samvera conversations are often information-rich and intended to
|
19
|
+
generate discussion and debate. We discuss ideas from a standpoint of
|
20
|
+
mutual respect and reasoned argument.
|
21
|
+
|
22
|
+
Community members work together to promote a respectful and safe
|
23
|
+
community. In the event that someone’s conduct is causing offence or
|
24
|
+
distress, Samvera has a detailed
|
25
|
+
[Anti-Harassment Policy and
|
26
|
+
Protocol](https://wiki.duraspace.org/display/samvera/Anti-Harassment+Policy)
|
27
|
+
which can be applied to address the problem. The first step in dealing
|
28
|
+
with any serious misconduct is to contact a local meeting organizer,
|
29
|
+
the
|
30
|
+
[Samvera community
|
31
|
+
helpers](https://wiki.duraspace.org/display/samvera/Samvera+Community+Helpers)
|
32
|
+
([email](mailto:helpers@samvera.org)), a community member you
|
33
|
+
trust, or the
|
34
|
+
[Samvera Steering
|
35
|
+
Group](https://wiki.duraspace.org/display/samvera/Samvera+Steering+Group+membership)
|
36
|
+
immediately; at Samvera events, these people can be identified by
|
37
|
+
distinctive name badges. The
|
38
|
+
[Policy and
|
39
|
+
Protocol](https://wiki.duraspace.org/display/samvera/Anti-Harassment+Policy)
|
40
|
+
should be consulted for fuller details.
|
data/CONTRIBUTING.md
CHANGED
@@ -1,21 +1,24 @@
|
|
1
1
|
# How to Contribute
|
2
2
|
|
3
|
-
We want your help to make
|
4
|
-
|
3
|
+
We want your help to make the Samvera community great. There are a few guidelines
|
4
|
+
that we need contributors to follow so that we can have a chance of
|
5
|
+
keeping on top of things.
|
5
6
|
|
6
7
|
## Code of Conduct
|
7
8
|
|
8
|
-
The
|
9
|
-
members, whether they are at a formal gathering, in
|
10
|
-
online.
|
11
|
-
for more information.
|
9
|
+
The Samvera Community is dedicated to providing a welcoming and positive
|
10
|
+
experience for all its members, whether they are at a formal gathering, in
|
11
|
+
a social setting, or taking part in activities online. Please see our
|
12
|
+
[Code of Conduct](CODE_OF_CONDUCT.md) for more information.
|
12
13
|
|
13
|
-
##
|
14
|
+
## Samvera Community Intellectual Property Licensing and Ownership
|
14
15
|
|
15
|
-
All code contributors must have an Individual Contributor License Agreement
|
16
|
-
|
16
|
+
All code contributors must have an Individual Contributor License Agreement
|
17
|
+
(iCLA) on file with the Samvera Steering Group. If the contributor works for
|
18
|
+
an institution, the institution must have a Corporate Contributor License
|
19
|
+
Agreement (cCLA) on file.
|
17
20
|
|
18
|
-
https://wiki.duraspace.org/display/
|
21
|
+
https://wiki.duraspace.org/display/samvera/Samvera+Community+Intellectual+Property+Licensing+and+Ownership
|
19
22
|
|
20
23
|
You should also add yourself to the `CONTRIBUTORS.md` file in the root of the project.
|
21
24
|
|
@@ -31,7 +34,7 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
|
|
31
34
|
### Reporting Issues
|
32
35
|
|
33
36
|
* Make sure you have a [GitHub account](https://github.com/signup/free)
|
34
|
-
* Submit a [Github issue](
|
37
|
+
* Submit a [Github issue](https://github.com/samvera/rubydora/issues/) by:
|
35
38
|
* Clearly describing the issue
|
36
39
|
* Provide a descriptive summary
|
37
40
|
* Explain the expected behavior
|
@@ -48,7 +51,7 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
|
|
48
51
|
* Please avoid working directly on the `master` branch.
|
49
52
|
* You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
|
50
53
|
* Make sure you have added sufficient tests and documentation for your changes.
|
51
|
-
* Test functionality with RSpec;
|
54
|
+
* Test functionality with RSpec; Test features / UI with Capybara.
|
52
55
|
* Run _all_ the tests to assure nothing else was accidentally broken.
|
53
56
|
|
54
57
|
### Documenting Code
|
@@ -60,15 +63,11 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
|
|
60
63
|
* If you don't know exactly what a bit of code does, it is extra likely that it needs to be documented. Take a stab at it and ask for feedback in your pull request. You can use the 'blame' button on GitHub to identify the original developer of the code and @mention them in your comment.
|
61
64
|
* This work greatly increases the usability of the code base and supports the on-ramping of new committers.
|
62
65
|
* We will all be understanding of one another's time constraints in this area.
|
63
|
-
* YARD examples:
|
64
|
-
* [Hydra::Works::RemoveGenericFile](https://github.com/projecthydra-labs/hydra-works/blob/master/lib/hydra/works/services/generic_work/remove_generic_file.rb)
|
65
|
-
* [ActiveTriples::LocalName::Minter](https://github.com/ActiveTriples/active_triples-local_name/blob/master/lib/active_triples/local_name/minter.rb)
|
66
66
|
* [Getting started with YARD](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
|
67
67
|
|
68
68
|
### Committing changes
|
69
69
|
|
70
70
|
* Make commits of logical units.
|
71
|
-
* Your commit should include a high level description of your work in HISTORY.textile
|
72
71
|
* Check for unnecessary whitespace with `git diff --check` before committing.
|
73
72
|
* Make sure your commit messages are [well formed](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
74
73
|
* If you created an issue, you can close it by including "Closes #issue" in your commit message. See [Github's blog post for more details](https://github.com/blog/1386-closing-issues-via-commit-messages)
|
@@ -103,6 +102,10 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
|
|
103
102
|
long to fit in 72 characters
|
104
103
|
```
|
105
104
|
|
105
|
+
* Make sure you have added the necessary tests for your changes.
|
106
|
+
* Run _all_ the tests to assure nothing else was accidentally broken.
|
107
|
+
* When you are ready to submit a pull request
|
108
|
+
|
106
109
|
### Submitting Changes
|
107
110
|
|
108
111
|
* Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
|
@@ -125,9 +128,7 @@ We adopted [Github's Pull Request Review](https://help.github.com/articles/about
|
|
125
128
|
Common checks that may occur in our repositories:
|
126
129
|
|
127
130
|
1. Travis CI - where our automated tests are running
|
128
|
-
2.
|
129
|
-
3. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
|
130
|
-
4. CodeClimate - is our code remaining healthy (at least according to static code analysis)
|
131
|
+
2. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
|
131
132
|
|
132
133
|
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.
|
133
134
|
|
@@ -144,16 +145,17 @@ First, the person contributing the code is putting themselves out there. Be mind
|
|
144
145
|
This is your chance for a mentoring moment of another developer. Take time to give an honest and thorough review of what has changed. Things to consider:
|
145
146
|
|
146
147
|
* Does the commit message explain what is going on?
|
147
|
-
* Does the code changes have tests? _Not all changes need new tests, some changes are
|
148
|
+
* Does the code changes have tests? _Not all changes need new tests, some changes are refactorings_
|
148
149
|
* Do new or changed methods, modules, and classes have documentation?
|
149
150
|
* Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
|
150
151
|
* Does the description of the new/changed specs match your understanding of what the spec is doing?
|
152
|
+
* Did the Travis tests complete successfully?
|
151
153
|
|
152
154
|
If you are uncertain, bring other contributors into the conversation by assigning them as a reviewer.
|
153
155
|
|
154
156
|
# Additional Resources
|
155
157
|
|
156
158
|
* [General GitHub documentation](http://help.github.com/)
|
157
|
-
* [GitHub pull request documentation](
|
159
|
+
* [GitHub pull request documentation](https://help.github.com/articles/about-pull-requests/)
|
158
160
|
* [Pro Git](http://git-scm.com/book) is both a free and excellent book about Git.
|
159
161
|
* [A Git Config for Contributing](http://ndlib.github.io/practices/my-typical-per-project-git-config/)
|
data/Dockerfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
FROM amazoncorretto:8
|
2
|
+
|
3
|
+
ENV FEDORA_HOME /opt/fedora
|
4
|
+
ENV CATALINA_HOME /opt/fedora/tomcat
|
5
|
+
ENV PATH $CATALINA_HOME/bin:$PATH
|
6
|
+
|
7
|
+
RUN curl -L http://sourceforge.net/projects/fedora-commons/files/fedora/3.8.1/fcrepo-installer-3.8.1.jar/download -o /opt/fcrepo-installer.jar
|
8
|
+
|
9
|
+
COPY docker/install.properties /opt/install.properties
|
10
|
+
RUN java -jar /opt/fcrepo-installer.jar /opt/install.properties
|
11
|
+
|
12
|
+
EXPOSE 8983
|
13
|
+
WORKDIR $FEDORA_HOME
|
14
|
+
|
15
|
+
CMD ["catalina.sh", "run"]
|
data/Gemfile
CHANGED
@@ -1,7 +1,22 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
+
if ENV['ACTIVEMODEL_VERSION']
|
4
|
+
gem 'activemodel', ENV['ACTIVEMODEL_VERSION']
|
5
|
+
end
|
3
6
|
gemspec
|
4
7
|
|
5
8
|
gem 'jruby-openssl', :platform => :jruby
|
6
|
-
|
7
|
-
|
9
|
+
|
10
|
+
if ENV['RAILS_VERSION']
|
11
|
+
if ENV['RAILS_VERSION'] == 'edge'
|
12
|
+
gem 'rails', github: 'rails/rails'
|
13
|
+
ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
|
14
|
+
else
|
15
|
+
gem 'rails', ENV['RAILS_VERSION']
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
case ENV['RAILS_VERSION']
|
20
|
+
when /^5.2/
|
21
|
+
gem 'bundler', '~> 2.0'
|
22
|
+
end
|
data/README.md
CHANGED
@@ -1,12 +1,32 @@
|
|
1
1
|
# rubydora
|
2
|
-
[<img src="https://travis-ci.org/projecthydra/rubydora.png?branch=master"
|
3
|
-
alt="Build Status" />](https://travis-ci.org/projecthydra/rubydora) [<img
|
4
|
-
src="https://badge.fury.io/rb/rubydora.png" alt="Gem Version"
|
5
|
-
/>](http://badge.fury.io/rb/rubydora)
|
6
2
|
|
7
3
|
Rubydora is a low-level Fedora Commons REST API consumer, providing direct
|
8
4
|
access to REST API methods, as well as a primitive ruby abstraction.
|
9
5
|
|
6
|
+
Code:
|
7
|
+
[![Gem Version](https://badge.fury.io/rb/rubydora.png)](http://badge.fury.io/rb/rubydora)
|
8
|
+
[![Build Status](https://circleci.com/gh/samvera/rubydora.svg?style=svg)](https://circleci.com/gh/samvera/rubydora)
|
9
|
+
[![Coverage Status](https://coveralls.io/repos/github/samvera/rubydora/badge.svg?branch=main)](https://coveralls.io/github/samvera/rubydora?branch=main)
|
10
|
+
|
11
|
+
Docs:
|
12
|
+
[![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
|
13
|
+
[![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE.txt)
|
14
|
+
|
15
|
+
Community Support: [![Samvera Community Slack](https://img.shields.io/badge/samvera-slack-blueviolet)](http://slack.samvera.org/)
|
16
|
+
|
17
|
+
## Product Owner & Maintenance
|
18
|
+
|
19
|
+
`rubydora` 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).
|
20
|
+
|
21
|
+
### Product Owner
|
22
|
+
**Vacant**
|
23
|
+
|
24
|
+
_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)._
|
25
|
+
|
26
|
+
## Help
|
27
|
+
|
28
|
+
The Samvera community is here to help. Please see our [support guide](./SUPPORT.md).
|
29
|
+
|
10
30
|
## Installation
|
11
31
|
|
12
32
|
```bash
|
@@ -17,22 +37,22 @@ gem install rubydora
|
|
17
37
|
|
18
38
|
```
|
19
39
|
> repo = Rubydora.connect :url => 'http://localhost:8983/fedora', :user => 'fedoraAdmin', :password => 'fedoraAdmin'
|
20
|
-
=> #<Rubydora::Repository:0x101859538 @config={:url=>"http://localhost:8983/fedora", :user=>"fedoraAdmin", :password=>"fedoraAdmin"}>
|
40
|
+
=> #<Rubydora::Repository:0x101859538 @config={:url=>"http://localhost:8983/fedora", :user=>"fedoraAdmin", :password=>"fedoraAdmin"}>
|
21
41
|
|
22
42
|
> obj = repo.find('test:1')
|
23
|
-
=> #<Rubydora::DigitalObject:0x101977230 @pid="test:1", @repository=#<Rubydora::Repository:0x1019beef0 @config={:user=>"fedoraAdmin", :url=>"http://localhost:8983/fedora", :password=>"fedora"}>>
|
43
|
+
=> #<Rubydora::DigitalObject:0x101977230 @pid="test:1", @repository=#<Rubydora::Repository:0x1019beef0 @config={:user=>"fedoraAdmin", :url=>"http://localhost:8983/fedora", :password=>"fedora"}>>
|
24
44
|
|
25
45
|
> obj.new?
|
26
|
-
=> true
|
46
|
+
=> true
|
27
47
|
|
28
48
|
> obj = obj.save
|
29
|
-
=> #<Rubydora::DigitalObject:0x1017601b8 @pid="test:1", @repository=#<Rubydora::Repository:0x1018e3058 @config={:url=>"http://localhost:8983/fedora", :user=>"fedoraAdmin", :password=>"fedoraAdmin"}, @client=#<RestClient::Resource:0x101882910 @options={:user=>"fedoraAdmin", :password=>"fedoraAdmin"}, @block=nil, @url="http://localhost:8983/fedora">>>
|
49
|
+
=> #<Rubydora::DigitalObject:0x1017601b8 @pid="test:1", @repository=#<Rubydora::Repository:0x1018e3058 @config={:url=>"http://localhost:8983/fedora", :user=>"fedoraAdmin", :password=>"fedoraAdmin"}, @client=#<RestClient::Resource:0x101882910 @options={:user=>"fedoraAdmin", :password=>"fedoraAdmin"}, @block=nil, @url="http://localhost:8983/fedora">>>
|
30
50
|
|
31
51
|
> obj.profile
|
32
|
-
=> {"objDissIndexViewURL"=>"http://localhost:8983/fedora/get/test:1/fedora-system:3/viewMethodIndex", "objLabel"=>"", "objModels"=>"info:fedora/fedora-system:FedoraObject-3.0", "objCreateDate"=>"2011-04-18T13:34:11.285Z", "objOwnerId"=>"fedoraAdmin", "objState"=>"A", "objItemIndexViewURL"=>"http://localhost:8983/fedora/get/test:1/fedora-system:3/viewItemIndex", "objLastModDate"=>"2011-04-18T13:47:30.110Z"}
|
52
|
+
=> {"objDissIndexViewURL"=>"http://localhost:8983/fedora/get/test:1/fedora-system:3/viewMethodIndex", "objLabel"=>"", "objModels"=>"info:fedora/fedora-system:FedoraObject-3.0", "objCreateDate"=>"2011-04-18T13:34:11.285Z", "objOwnerId"=>"fedoraAdmin", "objState"=>"A", "objItemIndexViewURL"=>"http://localhost:8983/fedora/get/test:1/fedora-system:3/viewItemIndex", "objLastModDate"=>"2011-04-18T13:47:30.110Z"}
|
33
53
|
|
34
54
|
> obj.models
|
35
|
-
=> ["info:fedora/fedora-system:FedoraObject-3.0"]
|
55
|
+
=> ["info:fedora/fedora-system:FedoraObject-3.0"]
|
36
56
|
|
37
57
|
> obj.models << 'info:fedora/test:cmodel'
|
38
58
|
=> ["info:fedora/fedora-system:FedoraObject-3.0", "info:fedora/test:cmodel"]
|
@@ -56,8 +76,8 @@ gem install rubydora
|
|
56
76
|
=> "Example redirect datastream"
|
57
77
|
> ds.mimeType = 'text/html'
|
58
78
|
=> "text/html"
|
59
|
-
> ds.save
|
60
|
-
=> #<Rubydora::Datastream:0x10177a568 @dsid="File" ...>
|
79
|
+
> ds.save
|
80
|
+
=> #<Rubydora::Datastream:0x10177a568 @dsid="File" ...>
|
61
81
|
|
62
82
|
> obj.datastreams
|
63
83
|
=> {"DC"=>#<Rubydora::Datastream:0x101860180 @dsid="DC" ..., "File"=>#<Rubydora::Datastream:0x10177a568 @dsid="File" ...>}
|
@@ -68,9 +88,33 @@ gem install rubydora
|
|
68
88
|
=> true
|
69
89
|
```
|
70
90
|
|
91
|
+
## Running the Tests
|
92
|
+
|
93
|
+
There is a Dockerfile included here to build a container that runs fcrepo3. It
|
94
|
+
will listen on port 8983, so no additional configuration is required. You can
|
95
|
+
run the continuous integration suite or the specs directly. An example of
|
96
|
+
starting the server and running just the specs is included here:
|
97
|
+
|
98
|
+
```
|
99
|
+
docker build -t samvera/fcrepo3:latest .
|
100
|
+
RUBYDORA_ID=$(docker run -d -p 8983:8983 samvera/fcrepo3:latest)
|
101
|
+
bundle exec rspec && docker kill $RUBYDORA_ID
|
102
|
+
```
|
103
|
+
|
104
|
+
There are also Rake tasks for building the image and running the suite against
|
105
|
+
a container:
|
106
|
+
|
107
|
+
```
|
108
|
+
bundle exec rake docker:build
|
109
|
+
bundle exec rake docker:spec
|
110
|
+
```
|
111
|
+
|
71
112
|
## Contributing to rubydora
|
72
113
|
|
73
|
-
*
|
114
|
+
* If you're working on PR for this project, create a feature branch off of `main`.
|
115
|
+
|
116
|
+
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/main/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.
|
117
|
+
* Check out the latest main branch to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
74
118
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
75
119
|
* Fork the project
|
76
120
|
* Start a feature/bugfix branch
|
@@ -84,3 +128,12 @@ gem install rubydora
|
|
84
128
|
|
85
129
|
Copyright (c) 2011 Chris Beer. See LICENSE.txt for further details.
|
86
130
|
|
131
|
+
## Acknowledgments
|
132
|
+
|
133
|
+
This software has been developed by and is brought to you by the Samvera community. Learn more at the [Samvera website](http://samvera.org/).
|
134
|
+
|
135
|
+
![Samvera Logo](https://wiki.duraspace.org/download/thumbnails/87459292/samvera-fall-font2-200w.png?version=1&modificationDate=1498550535816&api=v2)
|
136
|
+
|
137
|
+
## Contributing
|
138
|
+
|
139
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/samvera/rubydora/.
|
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'jettywrapper'
|
|
4
4
|
require 'yard'
|
5
5
|
require 'bundler/gem_tasks'
|
6
6
|
|
7
|
-
ZIP_URL = 'https://github.com/projecthydra/hydra-jetty/archive/v7.
|
7
|
+
ZIP_URL = 'https://github.com/projecthydra/hydra-jetty/archive/v7.3.0.zip'
|
8
8
|
|
9
9
|
begin
|
10
10
|
Bundler.setup(:default, :development)
|
@@ -17,9 +17,6 @@ end
|
|
17
17
|
# Get your spec rake tasks working in RSpec 2.0
|
18
18
|
require 'rspec/core/rake_task'
|
19
19
|
|
20
|
-
desc 'Default: run ci build.'
|
21
|
-
task :default => :ci
|
22
|
-
|
23
20
|
desc 'Run specs'
|
24
21
|
RSpec::Core::RakeTask.new do |t|
|
25
22
|
if ENV['COVERAGE'] && RUBY_VERSION =~ /^1.8/
|
@@ -38,12 +35,8 @@ task :console do
|
|
38
35
|
sh 'irb -rubygems -I lib -r rubydora.rb'
|
39
36
|
end
|
40
37
|
|
41
|
-
desc 'Execute
|
42
|
-
task :
|
43
|
-
unless ENV['environment'] == 'test'
|
44
|
-
exec('rake ci environment=test')
|
45
|
-
end
|
46
|
-
|
38
|
+
desc 'Execute RSpec test suites with jetty-wrapper'
|
39
|
+
task :rspec => 'jetty:clean' do
|
47
40
|
jetty_params = {
|
48
41
|
:jetty_home => File.expand_path(File.dirname(__FILE__) + '/jetty'),
|
49
42
|
:quiet => true,
|
@@ -53,18 +46,42 @@ task :ci => 'jetty:clean' do
|
|
53
46
|
:startup_wait => 90,
|
54
47
|
:java_opts => ['-Xmx256m', '-XX:MaxPermSize=128m']
|
55
48
|
}
|
49
|
+
end
|
50
|
+
|
51
|
+
desc 'Execute specs against Fedora under Docker'
|
52
|
+
task 'docker:build' do
|
53
|
+
system("docker build -t samveralabs/fcrepo3:latest .")
|
54
|
+
end
|
56
55
|
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
desc 'Execute specs against Fedora under Docker'
|
57
|
+
task 'docker:spec' do
|
58
|
+
container = `docker run -d -p 8983:8983 samveralabs/fcrepo3:latest`.chomp
|
59
|
+
puts "Waiting 10s for Fedora to start..."
|
60
|
+
sleep 10
|
61
|
+
Rake::Task['coverage'].invoke
|
62
|
+
killed = `docker kill #{container}`.chomp
|
63
|
+
unless container == killed
|
64
|
+
puts "Container (#{container}) not cleaned up successfully..."
|
65
|
+
puts "It is likely still running and binding port 8983."
|
60
66
|
end
|
61
|
-
raise "test failures: #{error}" if error
|
62
67
|
end
|
63
68
|
|
64
69
|
desc 'Execute specs with coverage'
|
65
70
|
task :coverage do
|
66
|
-
|
67
|
-
|
68
|
-
ENV['COVERAGE'] = 'true' unless ruby_engine == 'jruby'
|
71
|
+
ruby_engine = ENV['RUBY_TYPE'] || 'ruby'
|
72
|
+
ENV['COVERAGE'] = 'true' unless ruby_engine =~ /jruby/
|
69
73
|
Rake::Task['spec'].invoke
|
70
74
|
end
|
75
|
+
|
76
|
+
desc 'Execute Continuous Integration build'
|
77
|
+
task :ci do
|
78
|
+
unless ENV['environment'] == 'test'
|
79
|
+
exec('rake ci environment=test')
|
80
|
+
end
|
81
|
+
|
82
|
+
Rake::Task['coverage'].invoke
|
83
|
+
Rake::Task['yard'].invoke
|
84
|
+
end
|
85
|
+
|
86
|
+
desc 'Default: run ci build.'
|
87
|
+
task :default => :ci
|
data/SUPPORT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
If you would like to report an issue, first search [the list of
|
2
|
+
issues](https://github.com/samvera/rubydora/issues/) to see if someone else
|
3
|
+
has already reported it, and then feel free to [create a new
|
4
|
+
issue](https://github.com/samvera/rubydora/issues/new).
|
5
|
+
|
6
|
+
If you have questions or need help, please email [the Samvera community tech
|
7
|
+
list](https://groups.google.com/forum/#!forum/samvera-tech) or stop by the #dev
|
8
|
+
channel in [the Samvera community Slack
|
9
|
+
team](https://wiki.duraspace.org/pages/viewpage.action?pageId=87460391#Getintouch!-Slack).
|
10
|
+
|
11
|
+
You can learn more about the various Samvera communication channels on the [Get
|
12
|
+
in touch!](https://wiki.duraspace.org/pages/viewpage.action?pageId=87460391)
|
13
|
+
wiki page.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.2.0
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#Install Options
|
2
|
+
#Wed Jul 31 20:33:30 UTC 2019
|
3
|
+
ri.enabled=false
|
4
|
+
apia.auth.required=false
|
5
|
+
messaging.enabled=false
|
6
|
+
database.jdbcDriverClass=org.apache.derby.jdbc.EmbeddedDriver
|
7
|
+
upstream.auth.enabled=false
|
8
|
+
ssl.available=false
|
9
|
+
database.jdbcURL=jdbc\:derby\:/opt/fedora/derby/fedora3;create\=true
|
10
|
+
database.password=fedoraAdmin
|
11
|
+
database.username=fedoraAdmin
|
12
|
+
fesl.authz.enabled=false
|
13
|
+
tomcat.shutdown.port=8005
|
14
|
+
deploy.local.services=true
|
15
|
+
xacml.enabled=false
|
16
|
+
tomcat.http.port=8983
|
17
|
+
fedora.serverHost=localhost
|
18
|
+
database=included
|
19
|
+
database.driver=included
|
20
|
+
fedora.serverContext=fedora
|
21
|
+
llstore.type=akubra-fs
|
22
|
+
tomcat.home=/opt/fedora/tomcat
|
23
|
+
fesl.authn.enabled=true
|
24
|
+
fedora.home=/opt/fedora
|
25
|
+
install.type=quick
|
26
|
+
servlet.engine=included
|
27
|
+
apim.ssl.required=false
|
28
|
+
fedora.admin.pass=fedoraAdmin
|
data/lib/rubydora/datastream.rb
CHANGED
@@ -198,7 +198,7 @@ module Rubydora
|
|
198
198
|
p = to_api_params
|
199
199
|
unless p.empty?
|
200
200
|
mod_time = repository.modify_object p.merge(:pid => pid)
|
201
|
-
|
201
|
+
clear_changes_information
|
202
202
|
end
|
203
203
|
end
|
204
204
|
end
|
@@ -206,7 +206,7 @@ module Rubydora
|
|
206
206
|
# mod_time will be nil on new objects with no ds changes
|
207
207
|
unless mod_time.nil?
|
208
208
|
self.lastModifiedDate = mod_time
|
209
|
-
|
209
|
+
clear_attribute_changes(['lastModifiedDate'])
|
210
210
|
end
|
211
211
|
self
|
212
212
|
end
|
@@ -160,7 +160,7 @@ module Rubydora
|
|
160
160
|
query_options = options.dup
|
161
161
|
pid = query_options.delete(:pid)
|
162
162
|
run_hook :before_modify_object, :pid => pid, :options => options
|
163
|
-
ProfileParser.canonicalize_date_string(client[object_url(pid, query_options)].put(nil))
|
163
|
+
ProfileParser.canonicalize_date_string(client[object_url(pid, query_options)].put(nil).to_s)
|
164
164
|
rescue Exception => exception
|
165
165
|
rescue_with_handler(exception) || raise
|
166
166
|
end
|
@@ -309,6 +309,7 @@ module Rubydora
|
|
309
309
|
dsid = query_options.delete(:dsid)
|
310
310
|
method = query_options.delete(:method)
|
311
311
|
method ||= :get
|
312
|
+
request_headers = query_options.delete(:headers) || {}
|
312
313
|
raise self.class.name + "#datastream_dissemination requires a DSID" unless dsid
|
313
314
|
if block_given?
|
314
315
|
resource = safe_subresource(datastream_content_url(pid, dsid, query_options), :block_response => block_response)
|
@@ -317,7 +318,7 @@ module Rubydora
|
|
317
318
|
end
|
318
319
|
val = nil
|
319
320
|
benchmark "Loaded datastream content #{pid}/#{dsid}", :level=>:debug do
|
320
|
-
val = resource.send(method)
|
321
|
+
val = resource.send(method, request_headers)
|
321
322
|
end
|
322
323
|
val
|
323
324
|
rescue Exception => exception
|
data/rubydora.gemspec
CHANGED
@@ -10,26 +10,30 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.summary = 'Fedora Commons REST API ruby library'
|
11
11
|
s.description = 'Fedora Commons REST API ruby library'
|
12
12
|
s.homepage = 'http://github.com/projecthydra/rubydora'
|
13
|
+
s.license = 'Apache-2.0'
|
13
14
|
|
14
15
|
s.files = `git ls-files`.split("\n")
|
15
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
18
|
s.require_paths = ['lib']
|
19
|
+
s.metadata = { "rubygems_mfa_required" => "true" }
|
18
20
|
|
19
21
|
s.add_dependency 'rest-client'
|
20
22
|
s.add_dependency 'nokogiri'
|
21
23
|
s.add_dependency 'equivalent-xml'
|
22
24
|
s.add_dependency 'mime-types'
|
23
25
|
s.add_dependency 'activesupport'
|
24
|
-
s.add_dependency 'activemodel'
|
26
|
+
s.add_dependency 'activemodel', '>= 4.2.10'
|
25
27
|
s.add_dependency 'hooks', '~> 0.3'
|
26
28
|
s.add_dependency 'deprecation'
|
27
29
|
|
28
30
|
s.add_development_dependency 'rake'
|
29
31
|
s.add_development_dependency 'yard'
|
30
32
|
s.add_development_dependency 'bundler', '>= 1.0.14'
|
31
|
-
s.add_development_dependency 'rspec'
|
33
|
+
s.add_development_dependency 'rspec'
|
32
34
|
s.add_development_dependency 'jettywrapper', '>= 1.4.0'
|
33
35
|
s.add_development_dependency 'webmock'
|
34
36
|
s.add_development_dependency 'simplecov'
|
37
|
+
s.add_development_dependency 'coveralls'
|
38
|
+
s.add_development_dependency 'rspec_junit_formatter'
|
35
39
|
end
|
@@ -12,7 +12,7 @@ describe Rubydora::DigitalObject do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should convert object profile to a simple hash" do
|
15
|
-
@mock_api.should_receive(:object).with(:
|
15
|
+
@mock_api.should_receive(:object).with({ pid: 'pid' }).and_return("<objectProfile><a>1</a><b>2</b><objModels><model>3</model><model>4</model></objectProfile>")
|
16
16
|
h = @object.profile
|
17
17
|
|
18
18
|
h.should have_key("a")
|
@@ -25,19 +25,19 @@ describe Rubydora::DigitalObject do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should be frozen (to prevent modification)" do
|
28
|
-
@mock_api.should_receive(:object).with(:
|
28
|
+
@mock_api.should_receive(:object).with({ pid: 'pid' }).and_return("<objectProfile><a>1</a><b>2</b><objModels><model>3</model><model>4</model></objectProfile>")
|
29
29
|
h = @object.profile
|
30
30
|
|
31
31
|
expect { h['asdf'] = 'asdf' }.to raise_error
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should return nil for empty profile fields" do
|
35
|
-
@mock_api.should_receive(:object).with(:
|
35
|
+
@mock_api.should_receive(:object).with({ pid: 'pid' }).and_return("<objectProfile><a></a></objectProfile>")
|
36
36
|
@object.profile['a'].should be_nil
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should throw exceptions that arise" do
|
40
|
-
@mock_api.should_receive(:object).with(:
|
40
|
+
@mock_api.should_receive(:object).with({ pid: 'pid' }).and_raise(Net::HTTPBadResponse)
|
41
41
|
expect { @object.profile }.to raise_error(Net::HTTPBadResponse)
|
42
42
|
end
|
43
43
|
end
|
@@ -111,7 +111,7 @@ describe Rubydora::DigitalObject do
|
|
111
111
|
end
|
112
112
|
|
113
113
|
it "should allow other datastreams to be added" do
|
114
|
-
@mock_api.should_receive(:datastream).with(:
|
114
|
+
@mock_api.should_receive(:datastream).with({ pid: 'pid', dsid: 'z' }).and_raise(RestClient::ResourceNotFound)
|
115
115
|
|
116
116
|
@object.datastreams.length.should == 3
|
117
117
|
|
@@ -339,7 +339,7 @@ describe Rubydora::DigitalObject do
|
|
339
339
|
end
|
340
340
|
|
341
341
|
it "should call the Fedora REST API" do
|
342
|
-
@mock_api.should_receive(:purge_object).with({:
|
342
|
+
@mock_api.should_receive(:purge_object).with({ pid: 'pid' })
|
343
343
|
@object.delete
|
344
344
|
end
|
345
345
|
end
|
@@ -481,7 +481,7 @@ describe Rubydora::DigitalObject do
|
|
481
481
|
end
|
482
482
|
|
483
483
|
it "should fall-back to the set of default attributes" do
|
484
|
-
@mock_api.should_receive(:object).with(:
|
484
|
+
@mock_api.should_receive(:object).with({ pid: "pid" }).and_raise(RestClient::ResourceNotFound)
|
485
485
|
Rubydora::DigitalObject::OBJ_DEFAULT_ATTRIBUTES.should_receive(:[]).with(method.to_sym) { 'zxcv'}
|
486
486
|
subject.send(method).should == 'zxcv'
|
487
487
|
end
|
@@ -492,7 +492,7 @@ describe Rubydora::DigitalObject do
|
|
492
492
|
subject.stub(:datastreams => [])
|
493
493
|
end
|
494
494
|
it "should mark the object as changed after setting" do
|
495
|
-
@mock_api.should_receive(:object).with(:
|
495
|
+
@mock_api.should_receive(:object).with({ pid: "pid" }).and_raise(RestClient::ResourceNotFound)
|
496
496
|
subject.send("#{method}=", 'new_value')
|
497
497
|
subject.should be_changed
|
498
498
|
end
|
@@ -504,7 +504,7 @@ describe Rubydora::DigitalObject do
|
|
504
504
|
|
505
505
|
it "should appear in the save request" do
|
506
506
|
@mock_api.should_receive(:ingest).with(hash_including(method.to_sym => 'new_value'))
|
507
|
-
@mock_api.should_receive(:object).with(:
|
507
|
+
@mock_api.should_receive(:object).with({ pid: "pid" }).and_raise(RestClient::ResourceNotFound)
|
508
508
|
subject.send("#{method}=", 'new_value')
|
509
509
|
subject.save
|
510
510
|
end
|
@@ -526,7 +526,7 @@ describe Rubydora::DigitalObject do
|
|
526
526
|
end
|
527
527
|
|
528
528
|
it "should fall-back to the set of default attributes" do
|
529
|
-
@mock_api.should_receive(:object).with(:
|
529
|
+
@mock_api.should_receive(:object).with({ pid: "pid" }).and_raise(RestClient::ResourceNotFound)
|
530
530
|
Rubydora::DigitalObject::OBJ_DEFAULT_ATTRIBUTES.should_receive(:[]).with(:state) { 'zxcv'}
|
531
531
|
subject.state.should == 'zxcv'
|
532
532
|
end
|
@@ -537,7 +537,7 @@ describe Rubydora::DigitalObject do
|
|
537
537
|
subject.stub(:datastreams => [])
|
538
538
|
end
|
539
539
|
it "should mark the object as changed after setting" do
|
540
|
-
@mock_api.should_receive(:object).with(:
|
540
|
+
@mock_api.should_receive(:object).with({ pid: "pid" }).and_raise(RestClient::ResourceNotFound)
|
541
541
|
subject.state= 'D'
|
542
542
|
subject.should be_changed
|
543
543
|
end
|
@@ -554,7 +554,7 @@ describe Rubydora::DigitalObject do
|
|
554
554
|
|
555
555
|
it "should appear in the save request" do
|
556
556
|
@mock_api.should_receive(:ingest).with(hash_including(:state => 'A'))
|
557
|
-
@mock_api.should_receive(:object).with(:
|
557
|
+
@mock_api.should_receive(:object).with({ pid: "pid" }).and_raise(RestClient::ResourceNotFound)
|
558
558
|
subject.state='A'
|
559
559
|
subject.save
|
560
560
|
end
|
@@ -75,7 +75,9 @@ describe "Integration testing against a live Fedora repository", :integration =>
|
|
75
75
|
e_date = obj.lastModifiedDate
|
76
76
|
obj = @repository.find('test:3')
|
77
77
|
obj.label.should == 'qwerty'
|
78
|
-
obj.lastModifiedDate
|
78
|
+
parsed_last_modified = Date.parse(obj.lastModifiedDate)
|
79
|
+
parsed_e_date = Date.parse(e_date)
|
80
|
+
parsed_last_modified.should == parsed_e_date
|
79
81
|
end
|
80
82
|
|
81
83
|
describe "datastream stuff" do
|
@@ -173,7 +173,7 @@ describe Rubydora::RestApiClient do
|
|
173
173
|
|
174
174
|
context "Calling datastreams with a dsid" do
|
175
175
|
it "warns of deprecated behavior" do
|
176
|
-
@mock_repository.should_receive(:datastream).with(:
|
176
|
+
@mock_repository.should_receive(:datastream).with({ pid: 'mypid', dsid: 'asdf' })
|
177
177
|
Deprecation.should_receive(:warn)
|
178
178
|
@mock_repository.datastreams :pid => 'mypid', :dsid => 'asdf'
|
179
179
|
end
|
@@ -181,7 +181,7 @@ describe Rubydora::RestApiClient do
|
|
181
181
|
|
182
182
|
context "Calling datastream without a dsid" do
|
183
183
|
it "warns of deprecated behavior" do
|
184
|
-
@mock_repository.should_receive(:datastreams).with(:
|
184
|
+
@mock_repository.should_receive(:datastreams).with({ pid: 'mypid' })
|
185
185
|
Deprecation.should_receive(:warn)
|
186
186
|
@mock_repository.datastream :pid => 'mypid'
|
187
187
|
end
|
@@ -216,9 +216,15 @@ describe Rubydora::RestApiClient do
|
|
216
216
|
end
|
217
217
|
end
|
218
218
|
|
219
|
-
|
220
|
-
|
221
|
-
|
219
|
+
describe "datastream_dissemination" do
|
220
|
+
it "works without request headers" do
|
221
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + datastream_content_url('mypid', 'aaa')))
|
222
|
+
@mock_repository.datastream_dissemination :pid => 'mypid', :dsid => 'aaa'
|
223
|
+
end
|
224
|
+
it "works with request headers" do
|
225
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + datastream_content_url('mypid', 'aaa'), :headers => {'Bat-Man' => 'Forever'}))
|
226
|
+
@mock_repository.datastream_dissemination :pid => 'mypid', :dsid => 'aaa', :headers => {'Bat-Man' => 'Forever'}
|
227
|
+
end
|
222
228
|
end
|
223
229
|
it "should allow http methods besides GET on datastream_dissemination" do
|
224
230
|
RestClient::Request.should_receive(:execute).with(hash_including(:method => :head))
|
@@ -273,11 +279,11 @@ describe Rubydora::RestApiClient do
|
|
273
279
|
|
274
280
|
describe "modify datastream" do
|
275
281
|
it "should not set mime-type when it's not provided (and a file is not passed)" do
|
276
|
-
RestClient::Request.should_receive(:execute).with(:url => base_url + "/" + datastream_url('mypid', 'aaa')
|
282
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + datastream_url('mypid', 'aaa')))
|
277
283
|
@mock_repository.modify_datastream :pid => 'mypid', :dsid => 'aaa'
|
278
284
|
end
|
279
285
|
it "should pass the provided mimeType header" do
|
280
|
-
RestClient::Request.should_receive(:execute).with(:url => base_url + "/" + datastream_url('mypid', 'aaa', :mimeType => 'application/json')
|
286
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + datastream_url('mypid', 'aaa', :mimeType => 'application/json')))
|
281
287
|
@mock_repository.modify_datastream :pid => 'mypid', :dsid => 'aaa', :mimeType=>'application/json'
|
282
288
|
end
|
283
289
|
describe "when a file is passed" do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,18 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
if ENV['COVERAGE'] == 'true'
|
5
|
+
require 'simplecov'
|
6
|
+
require 'coveralls'
|
7
|
+
|
8
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
9
|
+
[
|
10
|
+
SimpleCov::Formatter::HTMLFormatter,
|
11
|
+
Coveralls::SimpleCov::Formatter
|
12
|
+
]
|
13
|
+
)
|
14
|
+
SimpleCov.start
|
15
|
+
end
|
6
16
|
|
7
17
|
require 'rspec/autorun'
|
8
18
|
require 'rubydora'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubydora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 4.2.10
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 4.2.10
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: hooks
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,16 +168,16 @@ dependencies:
|
|
168
168
|
name: rspec
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- - "
|
171
|
+
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
173
|
+
version: '0'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - "
|
178
|
+
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
180
|
+
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: jettywrapper
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,6 +220,34 @@ dependencies:
|
|
220
220
|
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: coveralls
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0'
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: rspec_junit_formatter
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - ">="
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '0'
|
244
|
+
type: :development
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - ">="
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '0'
|
223
251
|
description: Fedora Commons REST API ruby library
|
224
252
|
email:
|
225
253
|
- chris@cbeer.info
|
@@ -227,20 +255,24 @@ executables: []
|
|
227
255
|
extensions: []
|
228
256
|
extra_rdoc_files: []
|
229
257
|
files:
|
258
|
+
- ".circleci/config.yml"
|
230
259
|
- ".gitignore"
|
231
260
|
- ".mailmap"
|
232
261
|
- ".rspec"
|
233
262
|
- ".rubocop.yml"
|
234
263
|
- ".rubocop_todo.yml"
|
235
|
-
-
|
264
|
+
- CODE_OF_CONDUCT.md
|
236
265
|
- CONTRIBUTING.md
|
266
|
+
- Dockerfile
|
237
267
|
- Gemfile
|
238
268
|
- History.textile
|
239
269
|
- LICENSE.txt
|
240
270
|
- Notices.txt
|
241
271
|
- README.md
|
242
272
|
- Rakefile
|
273
|
+
- SUPPORT.md
|
243
274
|
- VERSION
|
275
|
+
- docker/install.properties
|
244
276
|
- lib/rubydora.rb
|
245
277
|
- lib/rubydora/array_with_callback.rb
|
246
278
|
- lib/rubydora/audit_trail.rb
|
@@ -270,9 +302,11 @@ files:
|
|
270
302
|
- spec/lib/transactions_spec.rb
|
271
303
|
- spec/spec_helper.rb
|
272
304
|
homepage: http://github.com/projecthydra/rubydora
|
273
|
-
licenses:
|
274
|
-
|
275
|
-
|
305
|
+
licenses:
|
306
|
+
- Apache-2.0
|
307
|
+
metadata:
|
308
|
+
rubygems_mfa_required: 'true'
|
309
|
+
post_install_message:
|
276
310
|
rdoc_options: []
|
277
311
|
require_paths:
|
278
312
|
- lib
|
@@ -287,9 +321,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
321
|
- !ruby/object:Gem::Version
|
288
322
|
version: '0'
|
289
323
|
requirements: []
|
290
|
-
|
291
|
-
|
292
|
-
signing_key:
|
324
|
+
rubygems_version: 3.4.1
|
325
|
+
signing_key:
|
293
326
|
specification_version: 4
|
294
327
|
summary: Fedora Commons REST API ruby library
|
295
328
|
test_files:
|