active-fedora 13.2.7 → 14.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +132 -20
- data/.rubocop.yml +26 -12
- data/.rubocop_todo.yml +1 -1
- data/CONTRIBUTING.md +12 -8
- data/Gemfile +8 -2
- data/README.md +10 -3
- data/active-fedora.gemspec +11 -11
- data/lib/active_fedora/association_hash.rb +5 -2
- data/lib/active_fedora/associations/association.rb +2 -4
- data/lib/active_fedora/associations/association_scope.rb +1 -1
- data/lib/active_fedora/associations/basic_contains_association.rb +2 -2
- data/lib/active_fedora/associations/belongs_to_association.rb +1 -1
- data/lib/active_fedora/associations/builder/association.rb +3 -5
- data/lib/active_fedora/associations/builder/basic_contains.rb +1 -1
- data/lib/active_fedora/associations/builder/belongs_to.rb +3 -7
- data/lib/active_fedora/associations/builder/collection_association.rb +7 -7
- data/lib/active_fedora/associations/builder/directly_contains.rb +4 -6
- data/lib/active_fedora/associations/builder/directly_contains_one.rb +5 -6
- data/lib/active_fedora/associations/builder/has_and_belongs_to_many.rb +1 -1
- data/lib/active_fedora/associations/builder/has_many.rb +1 -1
- data/lib/active_fedora/associations/builder/has_subresource.rb +1 -1
- data/lib/active_fedora/associations/builder/indirectly_contains.rb +3 -6
- data/lib/active_fedora/associations/builder/singular_association.rb +1 -1
- data/lib/active_fedora/associations/collection_association.rb +3 -6
- data/lib/active_fedora/associations/container_proxy.rb +2 -0
- data/lib/active_fedora/associations/contains_association.rb +2 -2
- data/lib/active_fedora/associations/directly_contains_association.rb +7 -9
- data/lib/active_fedora/associations/directly_contains_one_association.rb +2 -2
- data/lib/active_fedora/associations/has_and_belongs_to_many_association.rb +1 -1
- data/lib/active_fedora/associations/has_many_association.rb +4 -2
- data/lib/active_fedora/associations/has_subresource_association.rb +2 -4
- data/lib/active_fedora/associations/indirectly_contains_association.rb +10 -12
- data/lib/active_fedora/associations/orders_association.rb +7 -14
- data/lib/active_fedora/associations/rdf.rb +2 -2
- data/lib/active_fedora/associations/record_composite.rb +1 -0
- data/lib/active_fedora/associations/singular_association.rb +3 -1
- data/lib/active_fedora/associations/singular_rdf.rb +1 -1
- data/lib/active_fedora/associations.rb +3 -3
- data/lib/active_fedora/attached_files.rb +5 -3
- data/lib/active_fedora/attribute_assignment.rb +2 -4
- data/lib/active_fedora/attribute_methods/read.rb +1 -1
- data/lib/active_fedora/attribute_methods/write.rb +4 -6
- data/lib/active_fedora/attribute_methods.rb +7 -7
- data/lib/active_fedora/attributes/property_builder.rb +1 -1
- data/lib/active_fedora/attributes.rb +1 -1
- data/lib/active_fedora/autosave_association.rb +4 -4
- data/lib/active_fedora/callbacks.rb +3 -3
- data/lib/active_fedora/change_set.rb +5 -7
- data/lib/active_fedora/cleaner.rb +1 -1
- data/lib/active_fedora/core/fedora_id_translator.rb +1 -3
- data/lib/active_fedora/core.rb +6 -13
- data/lib/active_fedora/errors.rb +3 -3
- data/lib/active_fedora/fedora.rb +3 -7
- data/lib/active_fedora/file/attributes.rb +5 -5
- data/lib/active_fedora/file.rb +1 -1
- data/lib/active_fedora/file_configurator.rb +16 -14
- data/lib/active_fedora/file_io.rb +2 -4
- data/lib/active_fedora/files_hash.rb +2 -2
- data/lib/active_fedora/fixity_service.rb +5 -5
- data/lib/active_fedora/identifiable.rb +2 -18
- data/lib/active_fedora/indexing/default_descriptors.rb +3 -5
- data/lib/active_fedora/indexing/descendant_fetcher.rb +3 -3
- data/lib/active_fedora/indexing/descriptor.rb +1 -1
- data/lib/active_fedora/indexing/field_mapper.rb +3 -5
- data/lib/active_fedora/indexing.rb +9 -5
- data/lib/active_fedora/indexing_service.rb +2 -2
- data/lib/active_fedora/inheritance.rb +1 -3
- data/lib/active_fedora/ldp_resource.rb +3 -3
- data/lib/active_fedora/loadable_from_json.rb +5 -3
- data/lib/active_fedora/model_classifier.rb +2 -2
- data/lib/active_fedora/nested_attributes.rb +11 -21
- data/lib/active_fedora/null_logger.rb +2 -0
- data/lib/active_fedora/orders/list_node.rb +2 -3
- data/lib/active_fedora/orders/ordered_list.rb +16 -22
- data/lib/active_fedora/orders/target_proxy.rb +1 -1
- data/lib/active_fedora/querying.rb +2 -1
- data/lib/active_fedora/rdf/fcrepo.rb +3 -0
- data/lib/active_fedora/rdf/field_map.rb +0 -1
- data/lib/active_fedora/rdf/persistence.rb +1 -1
- data/lib/active_fedora/reflection.rb +8 -11
- data/lib/active_fedora/relation/finder_methods.rb +6 -12
- data/lib/active_fedora/relation/spawn_methods.rb +1 -1
- data/lib/active_fedora/runtime_registry.rb +2 -4
- data/lib/active_fedora/scoping/default.rb +2 -4
- data/lib/active_fedora/scoping/named.rb +1 -3
- data/lib/active_fedora/scoping.rb +2 -2
- data/lib/active_fedora/serialization.rb +1 -1
- data/lib/active_fedora/solr_service.rb +2 -4
- data/lib/active_fedora/version.rb +1 -1
- data/lib/active_fedora/versionable.rb +2 -2
- data/lib/active_fedora/versions_graph.rb +4 -6
- data/lib/active_fedora/with_metadata/metadata_node.rb +1 -1
- data/lib/active_fedora/with_metadata.rb +1 -1
- data/lib/active_fedora.rb +5 -7
- data/lib/generators/active_fedora/config/solr/templates/solr/conf/solrconfig.xml +3 -1
- data/lib/tasks/active_fedora_dev.rake +5 -5
- metadata +28 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5ea2bfd359fe8ac2103cc2f22d4bfacb564a5a6fe0964d6586120dbba785035
|
4
|
+
data.tar.gz: 64b28f342a53d4b2176ae4fbcdf502a7acd6e2f533bb68b71d2664e8fd95cf35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dd1090c7c74aa2926172c858c32bc223120ffb29b75fa1b099f8a2f881e3cf4ca772c520b54241b6f72f5997aecb5149ce4a218339e8ce0d00ad4f3c42beec9
|
7
|
+
data.tar.gz: bb97c2be3c9b48fc185a1ce528234e1b7d96a497fa957810fd7c4546f087d4b6a4df7c6626e1340f74d2e5bd856a777d759ce98ddbb2a6c59e666c2bb31d398e
|
data/.circleci/config.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
version: 2.1
|
2
2
|
orbs:
|
3
|
-
samvera: samvera/circleci-orb@0
|
3
|
+
samvera: samvera/circleci-orb@1.0
|
4
4
|
jobs:
|
5
5
|
bundle_lint_test:
|
6
6
|
parameters:
|
@@ -8,7 +8,7 @@ jobs:
|
|
8
8
|
type: string
|
9
9
|
bundler_version:
|
10
10
|
type: string
|
11
|
-
default: 2.
|
11
|
+
default: 2.3.11
|
12
12
|
rails_version:
|
13
13
|
type: string
|
14
14
|
solr_config_path:
|
@@ -31,7 +31,7 @@ jobs:
|
|
31
31
|
echo "$(git branch --all --list master */master)"
|
32
32
|
fi
|
33
33
|
[[ -z "$(git branch --all --list master */master)" ]]
|
34
|
-
|
34
|
+
|
35
35
|
- samvera/bundle_for_gem:
|
36
36
|
ruby_version: << parameters.ruby_version >>
|
37
37
|
bundler_version: << parameters.bundler_version >>
|
@@ -47,31 +47,143 @@ jobs:
|
|
47
47
|
workflows:
|
48
48
|
ci:
|
49
49
|
jobs:
|
50
|
+
# Ruby 3.2 releases
|
51
|
+
- bundle_lint_test:
|
52
|
+
name: ruby3-2_rails7-0
|
53
|
+
ruby_version: 3.2.0
|
54
|
+
rails_version: 7.0.4.1
|
55
|
+
- bundle_lint_test:
|
56
|
+
name: ruby3-2_rails6-1
|
57
|
+
ruby_version: 3.2.0
|
58
|
+
rails_version: 6.1.7.1
|
59
|
+
- bundle_lint_test:
|
60
|
+
name: ruby3-2_rails6-0
|
61
|
+
ruby_version: 3.2.0
|
62
|
+
rails_version: 6.0.6.1
|
63
|
+
# Ruby 3.1 releases
|
64
|
+
- bundle_lint_test:
|
65
|
+
name: ruby3-1_rails7-0
|
66
|
+
ruby_version: 3.1.3
|
67
|
+
rails_version: 7.0.4.1
|
68
|
+
- bundle_lint_test:
|
69
|
+
name: ruby3-1_rails6-1
|
70
|
+
ruby_version: 3.1.3
|
71
|
+
rails_version: 6.1.7.1
|
72
|
+
- bundle_lint_test:
|
73
|
+
name: ruby3-1_rails6-0
|
74
|
+
ruby_version: 3.1.3
|
75
|
+
rails_version: 6.0.6.1
|
76
|
+
# Ruby 3.0 releases
|
77
|
+
- bundle_lint_test:
|
78
|
+
name: ruby3-0_rails7-0
|
79
|
+
ruby_version: 3.0.5
|
80
|
+
rails_version: 7.0.4.1
|
81
|
+
- bundle_lint_test:
|
82
|
+
name: ruby3-0_rails6-1
|
83
|
+
ruby_version: 3.0.5
|
84
|
+
rails_version: 6.1.7.1
|
85
|
+
- bundle_lint_test:
|
86
|
+
name: ruby3-0_rails6-0
|
87
|
+
ruby_version: 3.0.5
|
88
|
+
rails_version: 6.0.6.1
|
89
|
+
# Ruby 2.7 releases
|
90
|
+
- bundle_lint_test:
|
91
|
+
name: ruby2-7_rails7-0
|
92
|
+
ruby_version: 2.7.7
|
93
|
+
rails_version: 7.0.4.1
|
94
|
+
- bundle_lint_test:
|
95
|
+
name: ruby2-7_rails6-1
|
96
|
+
ruby_version: 2.7.7
|
97
|
+
rails_version: 6.1.7.1
|
98
|
+
- bundle_lint_test:
|
99
|
+
name: ruby2-7_rails6-0
|
100
|
+
ruby_version: 2.7.7
|
101
|
+
rails_version: 6.0.6.1
|
50
102
|
- bundle_lint_test:
|
51
103
|
name: ruby2-7_rails5-2
|
52
|
-
ruby_version: 2.7.
|
53
|
-
rails_version: 5.2.
|
104
|
+
ruby_version: 2.7.7
|
105
|
+
rails_version: 5.2.8.1
|
106
|
+
# Ruby 2.6 releases
|
107
|
+
- bundle_lint_test:
|
108
|
+
name: ruby2-6_rails6-0
|
109
|
+
ruby_version: 2.6.10
|
110
|
+
rails_version: 6.0.6.1
|
54
111
|
- bundle_lint_test:
|
55
112
|
name: ruby2-6_rails5-2
|
56
|
-
ruby_version: 2.6.
|
57
|
-
rails_version: 5.2.
|
113
|
+
ruby_version: 2.6.10
|
114
|
+
rails_version: 5.2.8.1
|
115
|
+
|
116
|
+
nightly:
|
117
|
+
triggers:
|
118
|
+
- schedule:
|
119
|
+
cron: "0 0 * * *"
|
120
|
+
filters:
|
121
|
+
branches:
|
122
|
+
only:
|
123
|
+
- main
|
124
|
+
jobs:
|
125
|
+
# Ruby 3.2 releases
|
126
|
+
- bundle_lint_test:
|
127
|
+
name: ruby3-2_rails7-0
|
128
|
+
ruby_version: 3.2.0
|
129
|
+
rails_version: 7.0.4.1
|
130
|
+
- bundle_lint_test:
|
131
|
+
name: ruby3-2_rails6-1
|
132
|
+
ruby_version: 3.2.0
|
133
|
+
rails_version: 6.1.7.1
|
134
|
+
- bundle_lint_test:
|
135
|
+
name: ruby3-2_rails6-0
|
136
|
+
ruby_version: 3.2.0
|
137
|
+
rails_version: 6.0.6.1
|
138
|
+
# Ruby 3.1 releases
|
139
|
+
- bundle_lint_test:
|
140
|
+
name: ruby3-1_rails7-0
|
141
|
+
ruby_version: 3.1.3
|
142
|
+
rails_version: 7.0.4.1
|
143
|
+
- bundle_lint_test:
|
144
|
+
name: ruby3-1_rails6-1
|
145
|
+
ruby_version: 3.1.3
|
146
|
+
rails_version: 6.1.7.1
|
58
147
|
- bundle_lint_test:
|
59
|
-
name:
|
60
|
-
ruby_version:
|
61
|
-
rails_version:
|
148
|
+
name: ruby3-1_rails6-0
|
149
|
+
ruby_version: 3.1.3
|
150
|
+
rails_version: 6.0.6.1
|
151
|
+
# Ruby 3.0 releases
|
62
152
|
- bundle_lint_test:
|
63
|
-
name:
|
64
|
-
ruby_version:
|
65
|
-
rails_version:
|
153
|
+
name: ruby3-0_rails7-0
|
154
|
+
ruby_version: 3.0.5
|
155
|
+
rails_version: 7.0.4.1
|
156
|
+
- bundle_lint_test:
|
157
|
+
name: ruby3-0_rails6-1
|
158
|
+
ruby_version: 3.0.5
|
159
|
+
rails_version: 6.1.7.1
|
160
|
+
- bundle_lint_test:
|
161
|
+
name: ruby3-0_rails6-0
|
162
|
+
ruby_version: 3.0.5
|
163
|
+
rails_version: 6.0.6.1
|
164
|
+
# Ruby 2.7 releases
|
165
|
+
- bundle_lint_test:
|
166
|
+
name: ruby2-7_rails7-0
|
167
|
+
ruby_version: 2.7.7
|
168
|
+
rails_version: 7.0.4.1
|
169
|
+
- bundle_lint_test:
|
170
|
+
name: ruby2-7_rails6-1
|
171
|
+
ruby_version: 2.7.7
|
172
|
+
rails_version: 6.1.7.1
|
66
173
|
- bundle_lint_test:
|
67
174
|
name: ruby2-7_rails6-0
|
68
|
-
ruby_version: 2.7.
|
69
|
-
rails_version: 6.0.
|
175
|
+
ruby_version: 2.7.7
|
176
|
+
rails_version: 6.0.6.1
|
177
|
+
- bundle_lint_test:
|
178
|
+
name: ruby2-7_rails5-2
|
179
|
+
ruby_version: 2.7.7
|
180
|
+
rails_version: 5.2.8.1
|
181
|
+
# Ruby 2.6 releases
|
70
182
|
- bundle_lint_test:
|
71
183
|
name: ruby2-6_rails6-0
|
72
|
-
ruby_version: 2.6.
|
73
|
-
rails_version: 6.0.
|
184
|
+
ruby_version: 2.6.10
|
185
|
+
rails_version: 6.0.6.1
|
74
186
|
- bundle_lint_test:
|
75
|
-
name: ruby2-
|
76
|
-
ruby_version: 2.
|
77
|
-
rails_version:
|
187
|
+
name: ruby2-6_rails5-2
|
188
|
+
ruby_version: 2.6.10
|
189
|
+
rails_version: 5.2.8.1
|
data/.rubocop.yml
CHANGED
@@ -1,18 +1,13 @@
|
|
1
|
-
|
1
|
+
inherit_gem:
|
2
|
+
bixby: bixby_default.yml
|
2
3
|
|
3
4
|
inherit_from:
|
4
5
|
- .rubocop_todo.yml
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
DisplayCopNames: true
|
9
|
-
Include:
|
10
|
-
- '**/Rakefile'
|
11
|
-
Exclude:
|
12
|
-
- 'script/**/*'
|
13
|
-
- 'vendor/**/*'
|
7
|
+
Style/FrozenStringLiteralComment:
|
8
|
+
Enabled: false
|
14
9
|
|
15
|
-
Lint/
|
10
|
+
Lint/SuppressedException:
|
16
11
|
Exclude:
|
17
12
|
- 'spec/unit/**/*'
|
18
13
|
- 'spec/integration/**/*'
|
@@ -22,12 +17,19 @@ Lint/HandleExceptions:
|
|
22
17
|
Lint/AssignmentInCondition:
|
23
18
|
Enabled: false
|
24
19
|
|
25
|
-
|
20
|
+
Layout/LineLength:
|
26
21
|
Enabled: false
|
27
22
|
|
28
23
|
Metrics/AbcSize:
|
29
24
|
Enabled: false
|
30
25
|
|
26
|
+
Metrics/BlockLength:
|
27
|
+
Exclude:
|
28
|
+
- 'lib/active_fedora.rb'
|
29
|
+
- 'lib/active_fedora/nested_attributes.rb'
|
30
|
+
- 'lib/active_fedora/rspec_matchers/**/*'
|
31
|
+
- 'lib/tasks/**/*'
|
32
|
+
|
31
33
|
Metrics/BlockNesting:
|
32
34
|
Exclude:
|
33
35
|
- 'lib/active_fedora/autosave_association.rb'
|
@@ -173,7 +175,7 @@ Style/Lambda:
|
|
173
175
|
- 'spec/**/*'
|
174
176
|
|
175
177
|
Layout/IndentationConsistency:
|
176
|
-
EnforcedStyle:
|
178
|
+
EnforcedStyle: indented_internal_methods
|
177
179
|
|
178
180
|
Style/CollectionMethods:
|
179
181
|
PreferredMethods:
|
@@ -240,6 +242,15 @@ Rails/Date:
|
|
240
242
|
Rails/TimeZone:
|
241
243
|
Enabled: false
|
242
244
|
|
245
|
+
Rails/FilePath:
|
246
|
+
Enabled: false
|
247
|
+
|
248
|
+
Rails/ActiveRecordAliases:
|
249
|
+
Enabled: false
|
250
|
+
|
251
|
+
Rails/SkipsModelValidations:
|
252
|
+
Enabled: false
|
253
|
+
|
243
254
|
RSpec/AnyInstance:
|
244
255
|
Enabled: false
|
245
256
|
|
@@ -271,3 +282,6 @@ RSpec/NotToNot:
|
|
271
282
|
|
272
283
|
RSpec/MessageSpies:
|
273
284
|
Enabled: false
|
285
|
+
|
286
|
+
Security/MarshalLoad:
|
287
|
+
Enabled: false
|
data/.rubocop_todo.yml
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -44,6 +44,10 @@ prevalence of racist language in discussions of predatory
|
|
44
44
|
publishing](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6148600/) for
|
45
45
|
further details.
|
46
46
|
|
47
|
+
If you're working on PR for this project, create a feature branch off of `main`.
|
48
|
+
|
49
|
+
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 our repositories.
|
50
|
+
|
47
51
|
## Contribution Tasks
|
48
52
|
|
49
53
|
* Reporting Issues
|
@@ -67,10 +71,10 @@ further details.
|
|
67
71
|
|
68
72
|
* Fork the repository on GitHub
|
69
73
|
* Create a topic branch from where you want to base your work.
|
70
|
-
* This is usually the
|
71
|
-
* To quickly create a topic branch based on
|
72
|
-
* Then checkout the new branch with `git checkout fix/
|
73
|
-
* Please avoid working directly on the `
|
74
|
+
* This is usually the main branch.
|
75
|
+
* To quickly create a topic branch based on main; `git branch fix/main/my_contribution main`
|
76
|
+
* Then checkout the new branch with `git checkout fix/main/my_contribution`.
|
77
|
+
* Please avoid working directly on the `main` branch.
|
74
78
|
* You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
|
75
79
|
* Make sure you have added sufficient tests and documentation for your changes.
|
76
80
|
* Test functionality with RSpec; Test features / UI with Capybara.
|
@@ -131,15 +135,15 @@ further details.
|
|
131
135
|
### Submitting Changes
|
132
136
|
|
133
137
|
* Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
|
134
|
-
* Make sure your branch is up to date with its parent branch (i.e.
|
135
|
-
* `git checkout
|
138
|
+
* Make sure your branch is up to date with its parent branch (i.e. main)
|
139
|
+
* `git checkout main`
|
136
140
|
* `git pull --rebase`
|
137
141
|
* `git checkout <your-branch>`
|
138
|
-
* `git rebase
|
142
|
+
* `git rebase main`
|
139
143
|
* It is a good idea to run your tests again.
|
140
144
|
* If you've made more than one commit take a moment to consider whether squashing commits together would help improve their logical grouping.
|
141
145
|
* [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
|
142
|
-
* `git rebase --interactive
|
146
|
+
* `git rebase --interactive main` ([See Github help](https://help.github.com/articles/interactive-rebase))
|
143
147
|
* 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.
|
144
148
|
* Push your changes to a topic branch in your fork of the repository.
|
145
149
|
* Submit a pull request from your fork to the project.
|
data/Gemfile
CHANGED
@@ -7,12 +7,18 @@ gemspec path: File.expand_path('..', __FILE__)
|
|
7
7
|
gem 'byebug' unless ENV['TRAVIS']
|
8
8
|
gem 'pry-byebug' unless ENV['CI']
|
9
9
|
|
10
|
-
|
10
|
+
if ENV['RAILS_VERSION']
|
11
|
+
gem 'activemodel', ENV['RAILS_VERSION']
|
12
|
+
gem 'rails', ENV['RAILS_VERSION']
|
13
|
+
else
|
14
|
+
gem 'activemodel', '>= 6.0', '< 8'
|
15
|
+
gem 'rails', '>= 6.0', '< 8'
|
16
|
+
end
|
11
17
|
|
12
18
|
group :test do
|
13
|
-
gem 'simplecov', require: false
|
14
19
|
gem 'coveralls', require: false
|
15
20
|
gem 'rspec_junit_formatter'
|
21
|
+
gem 'simplecov', require: false
|
16
22
|
end
|
17
23
|
|
18
24
|
gem 'jruby-openssl', platform: :jruby
|
data/README.md
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
# ActiveFedora
|
2
2
|
|
3
|
-
Code: [![
|
3
|
+
Code: [![Samvera Core Component](https://img.shields.io/badge/samvera-core--component-brightgreen)](https://github.com/samvera/maintenance#samvera-core-components)
|
4
4
|
[![Build Status](https://circleci.com/gh/samvera/active_fedora.svg?style=svg)](https://circleci.com/gh/samvera/active_fedora)
|
5
|
-
[![Coverage Status](https://coveralls.io/repos/github/samvera/active_fedora/badge.svg?branch=
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/github/samvera/active_fedora/badge.svg?branch=main)](https://coveralls.io/github/samvera/active_fedora?branch=main)
|
6
|
+
[![Version](https://img.shields.io/gem/v/active-fedora)](https://rubygems.org/gems/active-fedora)
|
6
7
|
|
7
8
|
Docs: [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
|
8
9
|
[![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
|
9
10
|
|
10
|
-
|
11
|
+
Community Support: [![Samvera Community Slack](https://img.shields.io/badge/samvera-slack-blueviolet)](http://slack.samvera.org/)
|
11
12
|
|
12
13
|
# What is ActiveFedora?
|
13
14
|
|
@@ -101,6 +102,12 @@ is installed, run:
|
|
101
102
|
rake spec
|
102
103
|
```
|
103
104
|
|
105
|
+
## Contributing
|
106
|
+
|
107
|
+
If you're working on PR for this project, create a feature branch off of `main`.
|
108
|
+
|
109
|
+
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.
|
110
|
+
|
104
111
|
# Release Process
|
105
112
|
|
106
113
|
The [release process](https://github.com/samvera/active_fedora/wiki/Release-management-process) is documented on the wiki.
|
data/active-fedora.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
4
|
require "active_fedora/version"
|
4
5
|
|
5
6
|
Gem::Specification.new do |s|
|
@@ -8,39 +9,38 @@ Gem::Specification.new do |s|
|
|
8
9
|
s.platform = Gem::Platform::RUBY
|
9
10
|
s.authors = ["Matt Zumwalt", "McClain Looney", "Justin Coyne"]
|
10
11
|
s.email = ["samvera-tech@googlegroups.com"]
|
11
|
-
s.homepage =
|
12
|
-
s.summary =
|
13
|
-
s.description =
|
12
|
+
s.homepage = 'https://github.com/samvera/active_fedora'
|
13
|
+
s.summary = 'A convenience libary for manipulating documents in the Fedora Repository.'
|
14
|
+
s.description = 'ActiveFedora provides for creating and managing objects in the Fedora Repository Architecture.'
|
14
15
|
s.license = "Apache-2.0"
|
15
|
-
s.
|
16
|
+
s.metadata = { "rubygems_mfa_required" => "true" }
|
17
|
+
s.required_ruby_version = '>= 2.6'
|
16
18
|
|
17
19
|
s.add_dependency "activemodel", '>= 5.1'
|
18
20
|
s.add_dependency "activesupport", '>= 5.1'
|
19
21
|
s.add_dependency "active-triples", '>= 0.11.0', '< 2.0.0'
|
20
22
|
s.add_dependency "deprecation"
|
21
|
-
s.add_dependency 'faraday', '~> 0
|
23
|
+
s.add_dependency 'faraday', '~> 1.0'
|
22
24
|
s.add_dependency 'faraday-encoding', '>= 0.0.5'
|
23
25
|
s.add_dependency "ldp", '>= 0.7.0', '< 2'
|
24
26
|
s.add_dependency 'rsolr', '>= 1.1.2', '< 3'
|
25
27
|
s.add_dependency "ruby-progressbar", '~> 1.0'
|
26
28
|
|
29
|
+
s.add_development_dependency "bixby"
|
27
30
|
s.add_development_dependency "equivalent-xml"
|
28
31
|
s.add_development_dependency 'fcrepo_wrapper', '~> 0.2'
|
29
32
|
s.add_development_dependency "github_changelog_generator"
|
30
33
|
s.add_development_dependency "rdoc"
|
31
|
-
s.add_development_dependency "psych", "< 4" # Restricted because 4.0+ do not work with rubocop 0.56.x
|
32
34
|
s.add_development_dependency "rails"
|
33
35
|
s.add_development_dependency "rake"
|
34
36
|
s.add_development_dependency "rspec", "~> 3.5"
|
35
37
|
s.add_development_dependency "rspec-its"
|
36
|
-
s.add_development_dependency "rubocop", '~> 0.56.0'
|
37
|
-
s.add_development_dependency "rubocop-rspec", '~> 1.12.0'
|
38
38
|
s.add_development_dependency "simplecov", '~> 0.8'
|
39
|
-
s.add_development_dependency "solr_wrapper", "~>
|
39
|
+
s.add_development_dependency "solr_wrapper", "~> 4.0"
|
40
40
|
s.add_development_dependency "yard"
|
41
41
|
|
42
42
|
s.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR).select { |f| File.dirname(f) !~ %r{\A"?spec\/?} }
|
43
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
43
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
44
44
|
s.extra_rdoc_files = [
|
45
45
|
"LICENSE",
|
46
46
|
"README.md"
|
@@ -11,11 +11,11 @@ module ActiveFedora
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def [](name)
|
14
|
-
association(name)
|
14
|
+
association(name)&.reader
|
15
15
|
end
|
16
16
|
|
17
17
|
def []=(name, object)
|
18
|
-
association(name)
|
18
|
+
association(name)&.writer(object)
|
19
19
|
end
|
20
20
|
|
21
21
|
def association(name)
|
@@ -84,6 +84,7 @@ module ActiveFedora
|
|
84
84
|
super
|
85
85
|
end
|
86
86
|
end
|
87
|
+
|
87
88
|
##
|
88
89
|
# Represents the result of merging two association hashes.
|
89
90
|
# @note As the keys can come from multiple models, the attributes become
|
@@ -91,11 +92,13 @@ module ActiveFedora
|
|
91
92
|
class Merged < AssociationHash
|
92
93
|
attr_reader :first, :second
|
93
94
|
|
95
|
+
# rubocop:disable Lint/MissingSuper
|
94
96
|
def initialize(first, second)
|
95
97
|
@first = first
|
96
98
|
@base = first.base
|
97
99
|
@second = second
|
98
100
|
end
|
101
|
+
# rubocop:enable Lint/MissingSuper
|
99
102
|
|
100
103
|
def [](name)
|
101
104
|
first[name] || second[name]
|
@@ -119,7 +119,7 @@ module ActiveFedora
|
|
119
119
|
reset
|
120
120
|
end
|
121
121
|
|
122
|
-
def initialize_attributes(record, except_from_scope_attributes = nil)
|
122
|
+
def initialize_attributes(record, except_from_scope_attributes = nil) # :nodoc:
|
123
123
|
except_from_scope_attributes ||= {}
|
124
124
|
skip_assign = [reflection.foreign_key].compact
|
125
125
|
assigned_keys = record.changed
|
@@ -141,9 +141,7 @@ module ActiveFedora
|
|
141
141
|
if (reflection.has_one? || reflection.collection?) && !options[:through]
|
142
142
|
attributes[reflection.foreign_key] = owner[reflection.active_record_primary_key]
|
143
143
|
|
144
|
-
if reflection.options[:as]
|
145
|
-
attributes[reflection.type] = owner.class.base_class.name
|
146
|
-
end
|
144
|
+
attributes[reflection.type] = owner.class.base_class.name if reflection.options[:as]
|
147
145
|
end
|
148
146
|
|
149
147
|
attributes
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module ActiveFedora
|
2
2
|
module Associations
|
3
|
-
class BasicContainsAssociation < ContainsAssociation
|
3
|
+
class BasicContainsAssociation < ContainsAssociation # :nodoc:
|
4
4
|
def find_target
|
5
|
-
uris = owner.resource.query(predicate: options[:predicate])
|
5
|
+
uris = owner.resource.query({ predicate: options[:predicate] })
|
6
6
|
.map { |r| r.object.to_s }
|
7
7
|
|
8
8
|
uris.map { |object_uri| klass.find(klass.uri_to_id(object_uri)) }
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module ActiveFedora::Associations::Builder
|
2
|
-
class Association
|
2
|
+
class Association # :nodoc:
|
3
3
|
class << self
|
4
4
|
attr_accessor :extensions
|
5
5
|
end
|
@@ -36,7 +36,7 @@ module ActiveFedora::Associations::Builder
|
|
36
36
|
def self.build_scope(scope, extension)
|
37
37
|
new_scope = scope
|
38
38
|
|
39
|
-
new_scope = proc { instance_exec(&scope) } if scope
|
39
|
+
new_scope = proc { instance_exec(&scope) } if scope&.arity&.zero?
|
40
40
|
|
41
41
|
new_scope = wrap_scope new_scope, extension if extension
|
42
42
|
|
@@ -114,9 +114,7 @@ module ActiveFedora::Associations::Builder
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def self.check_dependent_options(dependent)
|
117
|
-
unless valid_dependent_options.include? dependent
|
118
|
-
raise ArgumentError, "The :dependent option must be one of #{valid_dependent_options}, but is :#{dependent}"
|
119
|
-
end
|
117
|
+
raise ArgumentError, "The :dependent option must be one of #{valid_dependent_options}, but is :#{dependent}" unless valid_dependent_options.include? dependent
|
120
118
|
end
|
121
119
|
|
122
120
|
def self.add_destroy_callbacks(model, reflection)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module ActiveFedora::Associations::Builder
|
2
|
-
class BelongsTo < SingularAssociation
|
2
|
+
class BelongsTo < SingularAssociation # :nodoc:
|
3
3
|
def self.macro
|
4
4
|
:belongs_to
|
5
5
|
end
|
@@ -19,9 +19,7 @@ module ActiveFedora::Associations::Builder
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.define_validations(model, reflection)
|
22
|
-
if reflection.options.key?(:required)
|
23
|
-
reflection.options[:optional] = !reflection.options.delete(:required)
|
24
|
-
end
|
22
|
+
reflection.options[:optional] = !reflection.options.delete(:required) if reflection.options.key?(:required)
|
25
23
|
|
26
24
|
required = if reflection.options[:optional].nil?
|
27
25
|
model.belongs_to_required_by_default
|
@@ -31,9 +29,7 @@ module ActiveFedora::Associations::Builder
|
|
31
29
|
|
32
30
|
super
|
33
31
|
|
34
|
-
if required
|
35
|
-
model.validates_presence_of reflection.name, message: :required
|
36
|
-
end
|
32
|
+
model.validates_presence_of reflection.name, message: :required if required
|
37
33
|
end
|
38
34
|
end
|
39
35
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'active_fedora/associations'
|
2
2
|
module ActiveFedora::Associations::Builder
|
3
|
-
class CollectionAssociation < Association
|
3
|
+
class CollectionAssociation < Association # :nodoc:
|
4
4
|
CALLBACKS = [:before_add, :after_add, :before_remove, :after_remove].freeze
|
5
5
|
|
6
6
|
def self.valid_options(options)
|
@@ -15,11 +15,11 @@ module ActiveFedora::Associations::Builder
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.define_extensions(model, name)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
return unless block_given?
|
19
|
+
|
20
|
+
extension_module_name = "#{model.name.demodulize}#{name.to_s.camelize}AssociationExtension"
|
21
|
+
extension = Module.new(&Proc.new)
|
22
|
+
model.parent.const_set(extension_module_name, extension)
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.define_callback(model, callback_name, name, options)
|
@@ -44,7 +44,7 @@ module ActiveFedora::Associations::Builder
|
|
44
44
|
|
45
45
|
def self.wrap_scope(scope, mod)
|
46
46
|
if scope
|
47
|
-
if scope.arity
|
47
|
+
if scope.arity.positive?
|
48
48
|
proc { |owner| instance_exec(owner, &scope).extending(mod) }
|
49
49
|
else
|
50
50
|
proc { instance_exec(&scope).extending(mod) }
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module ActiveFedora::Associations::Builder
|
2
|
-
class DirectlyContains < CollectionAssociation
|
2
|
+
class DirectlyContains < CollectionAssociation # :nodoc:
|
3
3
|
def self.macro
|
4
4
|
:directly_contains
|
5
5
|
end
|
@@ -10,11 +10,9 @@ module ActiveFedora::Associations::Builder
|
|
10
10
|
|
11
11
|
def self.validate_options(options)
|
12
12
|
super
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
raise ArgumentError, "Predicate must be a kind of RDF::URI"
|
17
|
-
end
|
13
|
+
|
14
|
+
raise ArgumentError, "You must specify a :has_member_relation or :is_member_of_relation predicate for #{name}" if !options[:has_member_relation] && !options[:is_member_of_relation]
|
15
|
+
raise ArgumentError, "Predicate must be a kind of RDF::URI" if !options[:has_member_relation].is_a?(RDF::URI) && !options[:is_member_of_relation].is_a?(RDF::URI)
|
18
16
|
end
|
19
17
|
end
|
20
18
|
end
|