active-fedora 10.1.0 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +6 -7
- data/.rubocop_todo.yml +55 -0
- data/.solr_wrapper +6 -0
- data/.travis.yml +6 -9
- data/Gemfile +1 -0
- data/History.txt +34 -0
- data/README.md +1 -3
- data/active-fedora.gemspec +7 -13
- data/lib/active_fedora/aggregation/list_source.rb +2 -0
- data/lib/active_fedora/associations/association_scope.rb +1 -1
- data/lib/active_fedora/associations/builder/aggregation.rb +1 -1
- data/lib/active_fedora/associations/builder/association.rb +1 -1
- data/lib/active_fedora/associations/builder/orders.rb +11 -3
- data/lib/active_fedora/associations/collection_association.rb +5 -5
- data/lib/active_fedora/associations/collection_proxy.rb +10 -10
- data/lib/active_fedora/associations/contained_finder.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 +2 -2
- data/lib/active_fedora/associations/has_subresource_association.rb +2 -2
- data/lib/active_fedora/associations/orders_association.rb +4 -0
- data/lib/active_fedora/associations/rdf.rb +2 -0
- data/lib/active_fedora/attribute_assignment.rb +0 -1
- data/lib/active_fedora/attribute_methods/dirty.rb +1 -1
- data/lib/active_fedora/attribute_methods.rb +1 -1
- data/lib/active_fedora/attributes.rb +1 -1
- data/lib/active_fedora/base.rb +4 -8
- data/lib/active_fedora/change_set.rb +6 -2
- data/lib/active_fedora/cleaner.rb +1 -1
- data/lib/active_fedora/containers/container.rb +1 -1
- data/lib/active_fedora/core.rb +33 -30
- data/lib/active_fedora/fedora.rb +6 -2
- data/lib/active_fedora/fedora_attributes.rb +1 -1
- data/lib/active_fedora/file/streaming.rb +1 -1
- data/lib/active_fedora/file.rb +2 -1
- data/lib/active_fedora/file_configurator.rb +3 -3
- data/lib/active_fedora/indexing.rb +1 -18
- data/lib/active_fedora/indexing_service.rb +0 -9
- data/lib/active_fedora/initializing_connection.rb +1 -1
- data/lib/active_fedora/loadable_from_json.rb +12 -1
- data/lib/active_fedora/model_classifier.rb +1 -1
- data/lib/active_fedora/nested_attributes.rb +2 -2
- data/lib/active_fedora/null_logger.rb +10 -0
- data/lib/active_fedora/orders/list_node.rb +2 -2
- data/lib/active_fedora/orders/ordered_list.rb +8 -4
- data/lib/active_fedora/orders/target_proxy.rb +4 -0
- data/lib/active_fedora/querying.rb +1 -1
- data/lib/active_fedora/railtie.rb +2 -2
- data/lib/active_fedora/rake_support.rb +1 -1
- data/lib/active_fedora/rdf/field_map_entry.rb +6 -0
- data/lib/active_fedora/rdf/persistence.rb +1 -0
- data/lib/active_fedora/rdf/value_caster.rb +15 -0
- data/lib/active_fedora/rdf.rb +1 -1
- data/lib/active_fedora/relation/delegation.rb +4 -0
- data/lib/active_fedora/relation/finder_methods.rb +3 -1
- data/lib/active_fedora/solr_hit.rb +1 -14
- data/lib/active_fedora/solr_query_builder.rb +17 -13
- data/lib/active_fedora/version.rb +1 -1
- data/lib/active_fedora/with_metadata/metadata_node.rb +2 -1
- data/lib/active_fedora.rb +1 -12
- data/lib/generators/active_fedora/config/solr/templates/solr/config/solrconfig.xml +11 -0
- data/lib/generators/active_fedora/config/solr/templates/solr_wrapper_test.yml +1 -1
- data/lib/generators/active_fedora/model/model_generator.rb +1 -1
- data/lib/generators/active_fedora/model/templates/model.rb.erb +4 -4
- data/lib/tasks/active_fedora_dev.rake +1 -1
- data/spec/config_helper.rb +1 -1
- data/spec/integration/associations_spec.rb +23 -24
- data/spec/integration/attached_files_spec.rb +19 -9
- data/spec/integration/attributes_spec.rb +12 -16
- data/spec/integration/autosave_association_spec.rb +6 -6
- data/spec/integration/base_spec.rb +8 -8
- data/spec/integration/basic_contains_association_spec.rb +1 -1
- data/spec/integration/clean_connection_spec.rb +1 -1
- data/spec/integration/collection_association_spec.rb +2 -5
- data/spec/integration/date_time_properties_spec.rb +1 -17
- data/spec/integration/direct_container_spec.rb +12 -12
- data/spec/integration/directly_contains_one_association_spec.rb +11 -13
- data/spec/integration/eradicate_spec.rb +1 -1
- data/spec/integration/fedora_solr_sync_spec.rb +2 -2
- data/spec/integration/file_fixity_spec.rb +6 -8
- data/spec/integration/file_spec.rb +37 -39
- data/spec/integration/generators/solr_generator_spec.rb +7 -10
- data/spec/integration/has_and_belongs_to_many_associations_spec.rb +7 -7
- data/spec/integration/has_many_associations_spec.rb +9 -11
- data/spec/integration/indexing_spec.rb +2 -2
- data/spec/integration/indirect_container_spec.rb +11 -12
- data/spec/integration/json_serialization_spec.rb +4 -4
- data/spec/integration/query_result_builder_spec.rb +9 -21
- data/spec/integration/rdf_nested_attributes_spec.rb +7 -7
- data/spec/integration/relation_delegation_spec.rb +8 -10
- data/spec/integration/relation_spec.rb +13 -16
- data/spec/integration/scoped_query_spec.rb +3 -3
- data/spec/integration/scoping_spec.rb +3 -3
- data/spec/integration/solr_hit_spec.rb +4 -15
- data/spec/integration/versionable_spec.rb +73 -327
- data/spec/integration/with_metadata_spec.rb +1 -1
- data/spec/spec_helper.rb +52 -10
- data/spec/unit/active_fedora_spec.rb +1 -1
- data/spec/unit/aggregation/list_source_spec.rb +37 -37
- data/spec/unit/aggregation/ordered_reader_spec.rb +4 -4
- data/spec/unit/association_hash_spec.rb +17 -31
- data/spec/unit/attached_files_spec.rb +35 -32
- data/spec/unit/attributes_spec.rb +25 -25
- data/spec/unit/base_active_model_spec.rb +8 -8
- data/spec/unit/base_cma_spec.rb +1 -1
- data/spec/unit/base_extra_spec.rb +7 -22
- data/spec/unit/base_spec.rb +21 -27
- data/spec/unit/builder/has_and_belongs_to_many_spec.rb +1 -1
- data/spec/unit/callback_spec.rb +2 -2
- data/spec/unit/change_set_spec.rb +5 -5
- data/spec/unit/checksum_spec.rb +2 -2
- data/spec/unit/code_configurator_spec.rb +1 -1
- data/spec/unit/core/fedora_id_translator_spec.rb +2 -2
- data/spec/unit/core/fedora_uri_translator_spec.rb +2 -2
- data/spec/unit/core/logger_spec.rb +18 -0
- data/spec/unit/core_spec.rb +68 -32
- data/spec/unit/default_model_mapper_spec.rb +6 -6
- data/spec/unit/fedora_spec.rb +3 -4
- data/spec/unit/file_configurator_spec.rb +96 -96
- data/spec/unit/file_path_builder_spec.rb +3 -3
- data/spec/unit/file_spec.rb +93 -61
- data/spec/unit/files_hash_spec.rb +9 -9
- data/spec/unit/filter_spec.rb +3 -3
- data/spec/unit/finder_methods_spec.rb +3 -3
- data/spec/unit/forbidden_attributes_protection_spec.rb +2 -2
- data/spec/unit/has_and_belongs_to_many_association_spec.rb +14 -15
- data/spec/unit/has_many_association_spec.rb +28 -13
- data/spec/unit/indexers/global_indexer_spec.rb +6 -6
- data/spec/unit/indexing_service_spec.rb +5 -5
- data/spec/unit/indexing_spec.rb +8 -8
- data/spec/unit/inheritance_spec.rb +11 -7
- data/spec/unit/loadable_from_json_spec.rb +4 -4
- data/spec/unit/logger_spec.rb +1 -1
- data/spec/unit/model_classifier_spec.rb +5 -5
- data/spec/unit/ordered_spec.rb +144 -147
- data/spec/unit/orders/list_node_spec.rb +22 -22
- data/spec/unit/orders/ordered_list_spec.rb +96 -96
- data/spec/unit/orders/reflection_spec.rb +4 -4
- data/spec/unit/pathing_spec.rb +4 -4
- data/spec/unit/persistence_spec.rb +28 -28
- data/spec/unit/property_spec.rb +2 -2
- data/spec/unit/query_spec.rb +12 -12
- data/spec/unit/rdf/indexing_service_spec.rb +29 -29
- data/spec/unit/readonly_spec.rb +5 -4
- data/spec/unit/reflection_spec.rb +3 -3
- data/spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb +9 -9
- data/spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb +9 -9
- data/spec/unit/rspec_matchers/have_predicate_matcher_spec.rb +9 -9
- data/spec/unit/schema_indexing_strategy_spec.rb +5 -5
- data/spec/unit/serializers_spec.rb +3 -4
- data/spec/unit/solr_config_options_spec.rb +13 -16
- data/spec/unit/solr_hit_spec.rb +9 -9
- data/spec/unit/solr_service_spec.rb +4 -10
- data/spec/unit/sparql_insert_spec.rb +2 -2
- data/spec/unit/validations_spec.rb +12 -12
- data/spec/unit/with_metadata/default_metadata_class_factory_spec.rb +3 -2
- data/spec/unit/with_metadata/metadata_node_spec.rb +3 -2
- metadata +30 -130
- data/lib/active_fedora/datastreams/nokogiri_datastreams.rb +0 -119
- data/lib/active_fedora/datastreams.rb +0 -6
- data/lib/active_fedora/nom_datastream.rb +0 -73
- data/lib/active_fedora/om_datastream.rb +0 -118
- data/lib/active_fedora/profile_indexing_service.rb +0 -11
- data/lib/active_fedora/qualified_dublin_core_datastream.rb +0 -158
- data/lib/active_fedora/rdf/datastream_indexing.rb +0 -49
- data/lib/active_fedora/rdf/ntriples_rdf_datastream.rb +0 -13
- data/lib/active_fedora/rdf/rdf_datastream.rb +0 -167
- data/lib/active_fedora/rdf/rdfxml_datastream.rb +0 -13
- data/lib/active_fedora/solr_instance_loader.rb +0 -47
- data/solr/config/_rest_managed.json +0 -3
- data/solr/config/admin-extra.html +0 -31
- data/solr/config/elevate.xml +0 -36
- data/solr/config/mapping-ISOLatin1Accent.txt +0 -246
- data/solr/config/protwords.txt +0 -21
- data/solr/config/schema.xml +0 -372
- data/solr/config/scripts.conf +0 -24
- data/solr/config/solrconfig.xml +0 -311
- data/solr/config/spellings.txt +0 -2
- data/solr/config/stopwords.txt +0 -58
- data/solr/config/stopwords_en.txt +0 -58
- data/solr/config/synonyms.txt +0 -31
- data/solr/config/xslt/example.xsl +0 -132
- data/solr/config/xslt/example_atom.xsl +0 -67
- data/solr/config/xslt/example_rss.xsl +0 -66
- data/solr/config/xslt/luke.xsl +0 -337
- data/spec/fixtures/damsObjectModel.xml +0 -38
- data/spec/fixtures/dublin_core_rdf_descMetadata.nt +0 -13
- data/spec/fixtures/mixed_rdf_descMetadata.nt +0 -7
- data/spec/fixtures/mods_articles/mods_article1.xml +0 -98
- data/spec/fixtures/solr_rdf_descMetadata.nt +0 -7
- data/spec/integration/complex_rdf_datastream_spec.rb +0 -228
- data/spec/integration/datastream_rdf_nested_attributes_spec.rb +0 -179
- data/spec/integration/ntriples_datastream_spec.rb +0 -203
- data/spec/integration/om_datastream_spec.rb +0 -78
- data/spec/integration/solr_instance_loader_spec.rb +0 -156
- data/spec/samples/hydra-mods_article_datastream.rb +0 -517
- data/spec/samples/models/mods_article.rb +0 -9
- data/spec/samples/oral_history_sample.xml +0 -38
- data/spec/samples/oral_history_xml.xml +0 -35
- data/spec/samples/samples.rb +0 -2
- data/spec/unit/nom_datastream_spec.rb +0 -60
- data/spec/unit/ntriples_datastream_spec.rb +0 -170
- data/spec/unit/om_datastream_spec.rb +0 -294
- data/spec/unit/qualified_dublin_core_datastream_spec.rb +0 -119
- data/spec/unit/rdf_datastream_spec.rb +0 -84
- data/spec/unit/rdf_resource_datastream_spec.rb +0 -204
- data/spec/unit/rdfxml_datastream_spec.rb +0 -106
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d30a0af700ab6f5855f2ac0dae9bd20aace608b3
|
|
4
|
+
data.tar.gz: f2e755860c2c67c4559c339c1468fa0a23b6038f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 61d91bdf7413839f75fa6be613786888dd74fd0a19253cc911886fbf6877d6b2d1903cb924c6312d0e92c5cc7d719f7394e5d5ab1c6d9d960a40b15c7d885125
|
|
7
|
+
data.tar.gz: f11e71036ebc0316ebc79bef415d98e0f0fa09036f3ce7438cf6839baf3cca87a168f1ec53e83366913e24d33d246d3d394647ac21a9c5480a1f92610a67a030
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
require: rubocop-rspec
|
|
2
|
+
|
|
3
|
+
inherit_from:
|
|
4
|
+
- .rubocop_todo.yml
|
|
5
|
+
|
|
1
6
|
AllCops:
|
|
2
7
|
TargetRubyVersion: 2.2
|
|
3
8
|
DisplayCopNames: true
|
|
@@ -42,7 +47,6 @@ Metrics/CyclomaticComplexity:
|
|
|
42
47
|
- 'lib/active_fedora/associations/builder/directly_contains_one.rb'
|
|
43
48
|
- 'lib/active_fedora/file_configurator.rb'
|
|
44
49
|
- 'lib/active_fedora/file.rb'
|
|
45
|
-
- 'lib/active_fedora/datastreams/nokogiri_datastreams.rb'
|
|
46
50
|
- 'lib/active_fedora/attribute_methods.rb'
|
|
47
51
|
- 'lib/active_fedora/scoping/named.rb'
|
|
48
52
|
- 'lib/active_fedora/inheritance.rb'
|
|
@@ -53,7 +57,6 @@ Metrics/PerceivedComplexity:
|
|
|
53
57
|
- 'lib/active_fedora/relation/finder_methods.rb'
|
|
54
58
|
- 'lib/active_fedora/nested_attributes.rb'
|
|
55
59
|
- 'lib/active_fedora/file_configurator.rb'
|
|
56
|
-
- 'lib/active_fedora/datastreams/nokogiri_datastreams.rb'
|
|
57
60
|
- 'lib/active_fedora/autosave_association.rb'
|
|
58
61
|
- 'lib/active_fedora/associations/has_many_association.rb'
|
|
59
62
|
- 'lib/active_fedora/associations/has_and_belongs_to_many_association.rb'
|
|
@@ -76,10 +79,7 @@ Metrics/ModuleLength:
|
|
|
76
79
|
|
|
77
80
|
Metrics/ClassLength:
|
|
78
81
|
Exclude:
|
|
79
|
-
- 'spec/samples/hydra-mods_article_datastream.rb'
|
|
80
|
-
- 'lib/active_fedora/rdf/rdf_datastream.rb'
|
|
81
82
|
- 'lib/active_fedora/rdf/fcrepo.rb'
|
|
82
|
-
- 'lib/active_fedora/qualified_dublin_core_datastream.rb'
|
|
83
83
|
- 'lib/active_fedora/file_configurator.rb'
|
|
84
84
|
- 'lib/active_fedora/file.rb'
|
|
85
85
|
- 'lib/active_fedora/associations/association.rb'
|
|
@@ -89,6 +89,7 @@ Metrics/ClassLength:
|
|
|
89
89
|
- 'lib/active_fedora/reflection.rb'
|
|
90
90
|
- 'lib/active_fedora/orders/ordered_list.rb'
|
|
91
91
|
- 'lib/active_fedora/solr_service.rb'
|
|
92
|
+
- 'lib/active_fedora/associations/orders_association.rb'
|
|
92
93
|
|
|
93
94
|
Metrics/MethodLength:
|
|
94
95
|
Enabled: false
|
|
@@ -117,7 +118,6 @@ Style/PredicateName:
|
|
|
117
118
|
- 'lib/active_fedora/versionable.rb'
|
|
118
119
|
- 'lib/active_fedora/reflection.rb'
|
|
119
120
|
- 'lib/active_fedora/pathing.rb'
|
|
120
|
-
- 'lib/active_fedora/om_datastream.rb'
|
|
121
121
|
- 'lib/active_fedora/nested_attributes.rb'
|
|
122
122
|
- 'lib/active_fedora/clean_connection.rb'
|
|
123
123
|
- 'lib/active_fedora/attributes.rb'
|
|
@@ -215,7 +215,6 @@ Style/SignalException:
|
|
|
215
215
|
Style/FileName:
|
|
216
216
|
Exclude:
|
|
217
217
|
- 'lib/active-fedora.rb'
|
|
218
|
-
- 'spec/samples/hydra-mods_article_datastream.rb'
|
|
219
218
|
|
|
220
219
|
Style/ZeroLengthPredicate:
|
|
221
220
|
Exclude:
|
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require: rubocop-rspec
|
|
2
|
+
|
|
3
|
+
# This configuration was generated by
|
|
4
|
+
# `rubocop --auto-gen-config`
|
|
5
|
+
# on 2016-08-25 16:34:38 -0700 using RuboCop version 0.42.0.
|
|
6
|
+
# The point is for the user to remove these configuration records
|
|
7
|
+
# one by one as the offenses are removed from the code base.
|
|
8
|
+
# Note that changes in the inspected code, or installation of new
|
|
9
|
+
# versions of RuboCop, may require this file to be generated again.
|
|
10
|
+
|
|
11
|
+
# Offense count: 116
|
|
12
|
+
# Configuration parameters: Max.
|
|
13
|
+
RSpec/ExampleLength:
|
|
14
|
+
Enabled: false
|
|
15
|
+
|
|
16
|
+
# Offense count: 40
|
|
17
|
+
RSpec/LeadingSubject:
|
|
18
|
+
Enabled: false
|
|
19
|
+
|
|
20
|
+
# Offense count: 15
|
|
21
|
+
RSpec/LetSetup:
|
|
22
|
+
Exclude:
|
|
23
|
+
- 'spec/integration/collection_association_spec.rb'
|
|
24
|
+
- 'spec/integration/delete_all_spec.rb'
|
|
25
|
+
- 'spec/integration/has_many_associations_spec.rb'
|
|
26
|
+
- 'spec/integration/nested_attribute_spec.rb'
|
|
27
|
+
- 'spec/integration/persistence_spec.rb'
|
|
28
|
+
- 'spec/unit/has_and_belongs_to_many_association_spec.rb'
|
|
29
|
+
|
|
30
|
+
# Offense count: 1
|
|
31
|
+
RSpec/MessageChain:
|
|
32
|
+
Exclude:
|
|
33
|
+
- 'spec/unit/file_spec.rb'
|
|
34
|
+
|
|
35
|
+
# Offense count: 218
|
|
36
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
37
|
+
# SupportedStyles: allow, expect
|
|
38
|
+
RSpec/MessageExpectation:
|
|
39
|
+
Enabled: false
|
|
40
|
+
|
|
41
|
+
# Offense count: 238
|
|
42
|
+
RSpec/MultipleExpectations:
|
|
43
|
+
Max: 8
|
|
44
|
+
|
|
45
|
+
# Offense count: 394
|
|
46
|
+
# Configuration parameters: MaxNesting.
|
|
47
|
+
RSpec/NestedGroups:
|
|
48
|
+
Enabled: false
|
|
49
|
+
|
|
50
|
+
# Offense count: 94
|
|
51
|
+
RSpec/SubjectStub:
|
|
52
|
+
Enabled: false
|
|
53
|
+
|
|
54
|
+
RSpec/VerifiedDoubles:
|
|
55
|
+
Enabled: false
|
data/.solr_wrapper
ADDED
data/.travis.yml
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
language: ruby
|
|
2
2
|
cache: bundler
|
|
3
3
|
sudo: false
|
|
4
|
-
rvm:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
env:
|
|
11
|
-
- "RAILS_VERSION=4.2.6"
|
|
12
|
-
|
|
4
|
+
rvm: 2.4.0
|
|
5
|
+
matrix:
|
|
6
|
+
include:
|
|
7
|
+
- rvm: 2.3.3
|
|
8
|
+
env: "RAILS_VERSION=4.2.7.1"
|
|
9
|
+
- env: "RSOLR_VERSION=2.0.0.pre1"
|
|
13
10
|
global_env:
|
|
14
11
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
|
15
12
|
before_script:
|
data/Gemfile
CHANGED
data/History.txt
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
v11.1.0
|
|
2
|
+
2017-01-12: Casting an RDF::URI to a RDF::URI is unnecessary [Justin Coyne]
|
|
3
|
+
|
|
4
|
+
2017-01-06: Replace deprecated Fixnum with Integer [Justin Coyne]
|
|
5
|
+
|
|
6
|
+
2017-01-06: Pin rubocop-rspec to 1.8.0 [Justin Coyne]
|
|
7
|
+
|
|
8
|
+
2017-01-06: Add Ruby 2.4.0 to the test matrix [Justin Coyne]
|
|
9
|
+
|
|
10
|
+
2016-12-19: Removing invalid namespaces from tests [Esmé Cowles]
|
|
11
|
+
|
|
12
|
+
2016-12-16: Correct the documentation [Justin Coyne]
|
|
13
|
+
|
|
14
|
+
2016-11-14: Use base_uri instead of relying on id_to_uri [Chris Colvard]
|
|
15
|
+
|
|
16
|
+
2016-11-14: Add base_uri convenience method [Chris Colvard]
|
|
17
|
+
|
|
18
|
+
2016-11-09: There is no need to pin rake anylonger [Justin Coyne]
|
|
19
|
+
|
|
20
|
+
2016-10-28: Allow logger to be set by default. Fixes #1170 [Justin Coyne]
|
|
21
|
+
|
|
22
|
+
2016-10-28: Add return value YARD doc [Justin Coyne]
|
|
23
|
+
|
|
24
|
+
2016-10-28: Update to latest Rubocop [Adam Wead]
|
|
25
|
+
|
|
26
|
+
2016-10-27: Stop spamming IRC with Travis builds [Michael J. Giarlo]
|
|
27
|
+
|
|
28
|
+
2016-10-19: Changing file to accept any object that responds to URI including
|
|
29
|
+
another File object or a Version [Carolyn Cole]
|
|
30
|
+
|
|
31
|
+
2016-09-30: Test with rsolr 2.x [Chris Beer]
|
|
32
|
+
|
|
33
|
+
2016-09-22: Use ActiveFedora::NullLogger [Adam Wead]
|
|
34
|
+
|
|
1
35
|
v9.10.1
|
|
2
36
|
2016-03-26: Fix #reflect_on_association. [Trey Pendragon]
|
|
3
37
|
|
data/README.md
CHANGED
|
@@ -75,11 +75,9 @@ rake active_fedora:ci
|
|
|
75
75
|
If you want to run the tests manually, follow these instructions:
|
|
76
76
|
|
|
77
77
|
```bash
|
|
78
|
-
solr_wrapper
|
|
78
|
+
solr_wrapper
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
You can switch `hydra-test` to `hydra-dev` if you want to create a collection for development.
|
|
82
|
-
|
|
83
81
|
To start FCRepo, open another shell and run:
|
|
84
82
|
|
|
85
83
|
```bash
|
data/active-fedora.gemspec
CHANGED
|
@@ -14,32 +14,26 @@ Gem::Specification.new do |s|
|
|
|
14
14
|
s.license = "APACHE2"
|
|
15
15
|
s.required_ruby_version = '~> 2.0'
|
|
16
16
|
|
|
17
|
-
s.add_dependency 'rsolr', '
|
|
17
|
+
s.add_dependency 'rsolr', '>= 1.1.2', '< 3'
|
|
18
18
|
s.add_dependency 'solrizer', '~> 3.4'
|
|
19
|
-
s.add_dependency 'om', '~> 3.1'
|
|
20
|
-
s.add_dependency 'nom-xml', '>= 0.5.1'
|
|
21
19
|
s.add_dependency "activesupport", '>= 4.2.4', '< 6'
|
|
22
20
|
s.add_dependency "activemodel", '>= 4.2', '< 6'
|
|
23
|
-
s.add_dependency "active-triples", '~> 0.
|
|
24
|
-
s.add_dependency "rdf-rdfxml", '~> 1.1'
|
|
25
|
-
s.add_dependency "linkeddata"
|
|
21
|
+
s.add_dependency "active-triples", '~> 0.11.0'
|
|
26
22
|
s.add_dependency "deprecation"
|
|
27
|
-
s.add_dependency "ldp", '~> 0.
|
|
23
|
+
s.add_dependency "ldp", '~> 0.6.0'
|
|
28
24
|
|
|
29
25
|
s.add_development_dependency "rails"
|
|
30
26
|
s.add_development_dependency "rdoc"
|
|
31
27
|
s.add_development_dependency "yard"
|
|
32
|
-
|
|
33
|
-
s.add_development_dependency "
|
|
34
|
-
s.add_development_dependency "solr_wrapper", "~> 0.4"
|
|
28
|
+
s.add_development_dependency "rake"
|
|
29
|
+
s.add_development_dependency "solr_wrapper", "~> 0.15"
|
|
35
30
|
s.add_development_dependency 'fcrepo_wrapper', '~> 0.2'
|
|
36
31
|
s.add_development_dependency "rspec", "~> 3.0"
|
|
37
32
|
s.add_development_dependency "rspec-its"
|
|
38
33
|
s.add_development_dependency "equivalent-xml"
|
|
39
34
|
s.add_development_dependency "simplecov", '~> 0.8'
|
|
40
|
-
|
|
41
|
-
s.add_development_dependency "rubocop", '~>
|
|
42
|
-
s.add_development_dependency "rubocop-rspec", '~> 1.4'
|
|
35
|
+
s.add_development_dependency "rubocop", '~> 0.42.0'
|
|
36
|
+
s.add_development_dependency "rubocop-rspec", '~> 1.8.0'
|
|
43
37
|
|
|
44
38
|
s.files = `git ls-files`.split("\n")
|
|
45
39
|
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
|
@@ -73,6 +73,8 @@ module ActiveFedora
|
|
|
73
73
|
# Assert head and tail
|
|
74
74
|
self.head = ordered_self.head.next.rdf_subject
|
|
75
75
|
self.tail = ordered_self.tail.prev.rdf_subject
|
|
76
|
+
head_will_change!
|
|
77
|
+
tail_will_change!
|
|
76
78
|
graph = ordered_self.to_graph
|
|
77
79
|
resource << graph
|
|
78
80
|
# Set node subjects to a term in AF JUST so that AF will persist the
|
|
@@ -31,7 +31,7 @@ module ActiveFedora
|
|
|
31
31
|
scope = scope.where(ActiveFedora::SolrQueryBuilder.construct_query_for_rel(association.send(:find_reflection) => owner.id))
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
is_first_chain = i
|
|
34
|
+
is_first_chain = i.zero?
|
|
35
35
|
is_first_chain ? klass : reflection.klass
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -19,7 +19,7 @@ module ActiveFedora::Associations::Builder
|
|
|
19
19
|
private_class_method :indirect_options
|
|
20
20
|
|
|
21
21
|
def self.has_member_relation(options)
|
|
22
|
-
options[:has_member_relation] || ::RDF::DC.hasPart
|
|
22
|
+
options[:has_member_relation] || ::RDF::Vocab::DC.hasPart
|
|
23
23
|
end
|
|
24
24
|
private_class_method :has_member_relation
|
|
25
25
|
|
|
@@ -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 && scope.arity
|
|
39
|
+
new_scope = proc { instance_exec(&scope) } if scope && scope.arity.zero?
|
|
40
40
|
|
|
41
41
|
new_scope = wrap_scope new_scope, extension if extension
|
|
42
42
|
|
|
@@ -14,6 +14,9 @@ module ActiveFedora::Associations::Builder
|
|
|
14
14
|
mixin.redefine_method(target_accessor(name)) do
|
|
15
15
|
association(name).target_reader
|
|
16
16
|
end
|
|
17
|
+
mixin.redefine_method("#{target_accessor(name, pluralize: false)}_ids") do
|
|
18
|
+
association(name).target_ids_reader
|
|
19
|
+
end
|
|
17
20
|
mixin.redefine_method("#{target_accessor(name)}=") do |nodes|
|
|
18
21
|
association(name).target_writer(nodes)
|
|
19
22
|
end
|
|
@@ -27,7 +30,7 @@ module ActiveFedora::Associations::Builder
|
|
|
27
30
|
model.send(:define_method, :apply_first_and_last) do
|
|
28
31
|
source = send(options[:through])
|
|
29
32
|
source.save
|
|
30
|
-
return if
|
|
33
|
+
return if head_ids == source.head_id && tail_ids == source.tail_id
|
|
31
34
|
self.head = source.head_id
|
|
32
35
|
self.tail = source.tail_id
|
|
33
36
|
save! if changed?
|
|
@@ -50,8 +53,13 @@ module ActiveFedora::Associations::Builder
|
|
|
50
53
|
end
|
|
51
54
|
end
|
|
52
55
|
|
|
53
|
-
def self.target_accessor(name)
|
|
54
|
-
name.to_s.gsub("_proxies", "")
|
|
56
|
+
def self.target_accessor(name, pluralize: true)
|
|
57
|
+
name = name.to_s.gsub("_proxies", "")
|
|
58
|
+
if pluralize
|
|
59
|
+
name.pluralize
|
|
60
|
+
else
|
|
61
|
+
name
|
|
62
|
+
end
|
|
55
63
|
end
|
|
56
64
|
private_class_method :target_accessor
|
|
57
65
|
|
|
@@ -94,7 +94,7 @@ module ActiveFedora
|
|
|
94
94
|
if loaded?
|
|
95
95
|
size.zero?
|
|
96
96
|
else
|
|
97
|
-
@target.blank? && count_records
|
|
97
|
+
@target.blank? && count_records.zero?
|
|
98
98
|
end
|
|
99
99
|
end
|
|
100
100
|
|
|
@@ -204,7 +204,7 @@ module ActiveFedora
|
|
|
204
204
|
# Note that this method will _always_ remove records from the database
|
|
205
205
|
# ignoring the +:dependent+ option.
|
|
206
206
|
def destroy(*records)
|
|
207
|
-
records = find(records) if records.any? { |record| record.is_a?(
|
|
207
|
+
records = find(records) if records.any? { |record| record.is_a?(Integer) || record.is_a?(String) }
|
|
208
208
|
delete_or_destroy(records, :destroy)
|
|
209
209
|
end
|
|
210
210
|
|
|
@@ -250,7 +250,7 @@ module ActiveFedora
|
|
|
250
250
|
finder_query = construct_query
|
|
251
251
|
return [] if finder_query.empty?
|
|
252
252
|
rows = opts.delete(:rows) { count }
|
|
253
|
-
return [] if rows
|
|
253
|
+
return [] if rows.zero?
|
|
254
254
|
SolrService.query(finder_query, { rows: rows }.merge(opts))
|
|
255
255
|
end
|
|
256
256
|
|
|
@@ -291,7 +291,7 @@ module ActiveFedora
|
|
|
291
291
|
def construct_query
|
|
292
292
|
@solr_query ||= begin
|
|
293
293
|
clauses = { find_reflection => @owner.id }
|
|
294
|
-
clauses[:has_model] = @reflection.
|
|
294
|
+
clauses[:has_model] = @reflection.klass.to_rdf_representation if @reflection.klass != ActiveFedora::Base
|
|
295
295
|
ActiveFedora::SolrQueryBuilder.construct_query_for_rel(clauses)
|
|
296
296
|
end
|
|
297
297
|
end
|
|
@@ -305,7 +305,7 @@ module ActiveFedora
|
|
|
305
305
|
records.each { |record| set_inverse_instance(record) }
|
|
306
306
|
records
|
|
307
307
|
rescue ObjectNotFoundError, Ldp::Gone => e
|
|
308
|
-
ActiveFedora::Base.logger.error "Solr and Fedora may be out of sync:\n" + e.message
|
|
308
|
+
ActiveFedora::Base.logger.error "Solr and Fedora may be out of sync:\n" + e.message
|
|
309
309
|
reset
|
|
310
310
|
[]
|
|
311
311
|
end
|
|
@@ -115,7 +115,7 @@ module ActiveFedora
|
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
# Finds an object in the collection responding to the +id+. Uses the same
|
|
118
|
-
# rules as <tt>ActiveFedora::Base.find</tt>. Returns <tt>ActiveFedora::
|
|
118
|
+
# rules as <tt>ActiveFedora::Base.find</tt>. Returns <tt>ActiveFedora::ObjectNotFoundError</tt>
|
|
119
119
|
# error if the object can not be found.
|
|
120
120
|
#
|
|
121
121
|
# class Person < ActiveFedora::Base
|
|
@@ -130,7 +130,7 @@ module ActiveFedora
|
|
|
130
130
|
# # ]
|
|
131
131
|
#
|
|
132
132
|
# person.pets.find(1) # => #<Pet id: 1, name: "Fancy-Fancy", person_id: 1>
|
|
133
|
-
# person.pets.find(4) # => ActiveFedora::
|
|
133
|
+
# person.pets.find(4) # => ActiveFedora::ObjectNotFoundError: Couldn't find Pet with id=4
|
|
134
134
|
#
|
|
135
135
|
# person.pets.find(2) { |pet| pet.name.downcase! }
|
|
136
136
|
# # => #<Pet id: 2, name: "fancy-fancy", person_id: 1>
|
|
@@ -394,7 +394,7 @@ module ActiveFedora
|
|
|
394
394
|
# # ]
|
|
395
395
|
#
|
|
396
396
|
# Pet.find(1, 2, 3)
|
|
397
|
-
# # => ActiveFedora::
|
|
397
|
+
# # => ActiveFedora::ObjectNotFoundError
|
|
398
398
|
#
|
|
399
399
|
# If it is set to <tt>:delete_all</tt>, all the objects are deleted
|
|
400
400
|
# *without* calling their +destroy+ method.
|
|
@@ -419,7 +419,7 @@ module ActiveFedora
|
|
|
419
419
|
# # ]
|
|
420
420
|
#
|
|
421
421
|
# Pet.find(1, 2, 3)
|
|
422
|
-
# # => ActiveFedora::
|
|
422
|
+
# # => ActiveFedora::ObjectNotFoundError
|
|
423
423
|
def delete_all
|
|
424
424
|
@association.delete_all
|
|
425
425
|
end
|
|
@@ -511,7 +511,7 @@ module ActiveFedora
|
|
|
511
511
|
# # => [#<Pet id: 2, name: "Spook", person_id: 1>]
|
|
512
512
|
#
|
|
513
513
|
# Pet.find(1, 3)
|
|
514
|
-
# # => ActiveFedora::
|
|
514
|
+
# # => ActiveFedora::ObjectNotFoundError: Couldn't find all Pets with IDs (1, 3)
|
|
515
515
|
#
|
|
516
516
|
# If it is set to <tt>:delete_all</tt>, all the +records+ are deleted
|
|
517
517
|
# *without* calling their +destroy+ method.
|
|
@@ -539,9 +539,9 @@ module ActiveFedora
|
|
|
539
539
|
# # ]
|
|
540
540
|
#
|
|
541
541
|
# Pet.find(1)
|
|
542
|
-
# # => ActiveFedora::
|
|
542
|
+
# # => ActiveFedora::ObjectNotFoundError: Couldn't find Pet with id=1
|
|
543
543
|
#
|
|
544
|
-
# You can pass +
|
|
544
|
+
# You can pass +Integer+ or +String+ values, it finds the records
|
|
545
545
|
# responding to the +id+ and executes delete on them.
|
|
546
546
|
#
|
|
547
547
|
# class Person < ActiveFedora::Base
|
|
@@ -603,9 +603,9 @@ module ActiveFedora
|
|
|
603
603
|
# person.pets.size # => 0
|
|
604
604
|
# person.pets # => []
|
|
605
605
|
#
|
|
606
|
-
# Pet.find(1, 2, 3) # => ActiveFedora::
|
|
606
|
+
# Pet.find(1, 2, 3) # => ActiveFedora::ObjectNotFoundError: Couldn't find all Pets with IDs (1, 2, 3)
|
|
607
607
|
#
|
|
608
|
-
# You can pass +
|
|
608
|
+
# You can pass +Integer+ or +String+ values, it finds the records
|
|
609
609
|
# responding to the +id+ and then deletes them from the database.
|
|
610
610
|
#
|
|
611
611
|
# person.pets.size # => 3
|
|
@@ -635,7 +635,7 @@ module ActiveFedora
|
|
|
635
635
|
# person.pets.size # => 0
|
|
636
636
|
# person.pets # => []
|
|
637
637
|
#
|
|
638
|
-
# Pet.find(4, 5, 6) # => ActiveFedora::
|
|
638
|
+
# Pet.find(4, 5, 6) # => ActiveFedora::ObjectNotFoundError: Couldn't find all Pets with IDs (4, 5, 6)
|
|
639
639
|
def destroy(*records)
|
|
640
640
|
@association.destroy(*records)
|
|
641
641
|
end
|
|
@@ -29,7 +29,7 @@ module ActiveFedora::Associations
|
|
|
29
29
|
private
|
|
30
30
|
|
|
31
31
|
def matching_ids(record)
|
|
32
|
-
IDComposite.new(proxy_ids(record) & contained_ids, repository.translate_uri_to_id)
|
|
32
|
+
IDComposite.new(proxy_ids(record) & contained_ids.to_a, repository.translate_uri_to_id)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def proxy_ids(record)
|
|
@@ -40,7 +40,7 @@ module ActiveFedora::Associations
|
|
|
40
40
|
# a slow fedora call
|
|
41
41
|
def relation_subjects(record)
|
|
42
42
|
query = ActiveFedora::SolrQueryBuilder.construct_query_for_rel(
|
|
43
|
-
[[:has_model, proxy_class.
|
|
43
|
+
[[:has_model, proxy_class.to_rdf_representation], [:proxyFor, record.id]]
|
|
44
44
|
)
|
|
45
45
|
ActiveFedora::SolrService.query(query, fl: 'id').map(&:rdf_uri)
|
|
46
46
|
end
|
|
@@ -21,7 +21,7 @@ module ActiveFedora
|
|
|
21
21
|
if reflection.options[:inverse_of]
|
|
22
22
|
inverse = reflection.inverse_of
|
|
23
23
|
if owner.new_record?
|
|
24
|
-
ActiveFedora::Base.logger.warn("has_and_belongs_to_many #{reflection.inspect} is cowardly refusing to insert the inverse relationship into #{record}, because #{owner} is not persisted yet.")
|
|
24
|
+
ActiveFedora::Base.logger.warn("has_and_belongs_to_many #{reflection.inspect} is cowardly refusing to insert the inverse relationship into #{record}, because #{owner} is not persisted yet.")
|
|
25
25
|
elsif inverse.has_and_belongs_to_many?
|
|
26
26
|
record[inverse.foreign_key] ||= []
|
|
27
27
|
record[inverse.foreign_key] += [owner.id]
|
|
@@ -19,7 +19,7 @@ module ActiveFedora
|
|
|
19
19
|
# If there's nothing in the database and @target has no new records
|
|
20
20
|
# we are certain the current target is an empty array. This is a
|
|
21
21
|
# documented side-effect of the method that may avoid an extra SELECT.
|
|
22
|
-
@target ||= [] and loaded! if count
|
|
22
|
+
@target ||= [] and loaded! if count.zero?
|
|
23
23
|
|
|
24
24
|
count
|
|
25
25
|
end
|
|
@@ -83,7 +83,7 @@ module ActiveFedora
|
|
|
83
83
|
protected
|
|
84
84
|
|
|
85
85
|
def find_polymorphic_inverse(record)
|
|
86
|
-
record.reflections.values.find { |r| !r.has_many? && r.
|
|
86
|
+
record.reflections.values.find { |r| !r.has_many? && r.predicate == reflection.predicate }
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
# Deletes the records according to the <tt>:dependent</tt> option.
|
|
@@ -25,12 +25,12 @@ module ActiveFedora
|
|
|
25
25
|
|
|
26
26
|
def find_or_initialize_target(&block)
|
|
27
27
|
if reflection.klass < ActiveFedora::File
|
|
28
|
-
reflection.build_association(target_uri, &block)
|
|
28
|
+
reflection.build_association(id: target_uri, &block)
|
|
29
29
|
else
|
|
30
30
|
reflection.klass.find(target_uri)
|
|
31
31
|
end
|
|
32
32
|
rescue ActiveFedora::ObjectNotFoundError
|
|
33
|
-
reflection.build_association(target_uri, &block)
|
|
33
|
+
reflection.build_association(id: target_uri, &block)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def replace(record)
|
|
@@ -10,6 +10,7 @@ module ActiveFedora
|
|
|
10
10
|
additions = incoming_objects - current_objects
|
|
11
11
|
deletions.each { |object| owner.resource.delete([owner.rdf_subject, reflection.predicate, object]) }
|
|
12
12
|
additions.each { |object| owner.resource.insert([owner.rdf_subject, reflection.predicate, object]) }
|
|
13
|
+
owner.resource.persist!
|
|
13
14
|
owner.send(:attribute_will_change!, reflection.name)
|
|
14
15
|
end
|
|
15
16
|
|
|
@@ -21,6 +22,7 @@ module ActiveFedora
|
|
|
21
22
|
filtered_results.each do |candidate|
|
|
22
23
|
owner.resource.delete([owner.rdf_subject, reflection.predicate, candidate])
|
|
23
24
|
end
|
|
25
|
+
owner.resource.persist!
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
private
|
|
@@ -6,7 +6,7 @@ module ActiveFedora
|
|
|
6
6
|
def set_value(*val)
|
|
7
7
|
attribute = val.first
|
|
8
8
|
unless [:has_model, :modified_date].include? attribute
|
|
9
|
-
attribute_will_change!(attribute) unless self[val.first] == val.last
|
|
9
|
+
attribute_will_change!(attribute) unless Array(self[val.first]).to_set == Array(val.last).to_set
|
|
10
10
|
end
|
|
11
11
|
super
|
|
12
12
|
end
|
|
@@ -144,7 +144,7 @@ module ActiveFedora
|
|
|
144
144
|
|
|
145
145
|
# @param [Symbol] field the field to find or create
|
|
146
146
|
# @param [Class] klass the class to use to delegate the attribute (e.g.
|
|
147
|
-
# ActiveTripleAttribute
|
|
147
|
+
# ActiveTripleAttribute)
|
|
148
148
|
# @param [Hash] args
|
|
149
149
|
# @option args [String] :delegate_target the path to the delegate
|
|
150
150
|
# @option args [Class] :klass the class to create
|
data/lib/active_fedora/base.rb
CHANGED
|
@@ -10,16 +10,12 @@ module ActiveFedora
|
|
|
10
10
|
#
|
|
11
11
|
# =The Basics
|
|
12
12
|
# class Oralhistory < ActiveFedora::Base
|
|
13
|
-
#
|
|
14
|
-
# m.field "narrator", :string
|
|
15
|
-
# m.field "narrator", :text
|
|
16
|
-
# end
|
|
13
|
+
# property :creator, predicate: RDF::Vocab::DC.creator
|
|
17
14
|
# end
|
|
18
15
|
#
|
|
19
|
-
# The above example creates a Fedora object with a
|
|
20
|
-
# narrator and bio field.
|
|
16
|
+
# The above example creates a Fedora object with a property named "creator"
|
|
21
17
|
#
|
|
22
|
-
# Attached files defined with +
|
|
18
|
+
# Attached files defined with +has_subresource+ and iis accessed via the +attached_files+ member hash.
|
|
23
19
|
#
|
|
24
20
|
class Base
|
|
25
21
|
extend ActiveModel::Naming
|
|
@@ -40,11 +36,11 @@ module ActiveFedora
|
|
|
40
36
|
include Associations
|
|
41
37
|
include AutosaveAssociation
|
|
42
38
|
include NestedAttributes
|
|
43
|
-
include Reflection
|
|
44
39
|
include Serialization
|
|
45
40
|
|
|
46
41
|
include AttachedFiles
|
|
47
42
|
include FedoraAttributes
|
|
43
|
+
include Reflection
|
|
48
44
|
include AttributeMethods
|
|
49
45
|
include Attributes
|
|
50
46
|
include Versionable
|
|
@@ -23,8 +23,12 @@ module ActiveFedora
|
|
|
23
23
|
result[predicate] = graph.query(subject: object.rdf_subject, predicate: predicate)
|
|
24
24
|
elsif object.class.properties.keys.include?(key)
|
|
25
25
|
predicate = graph.reflections.reflect_on_property(key).predicate
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
results = graph.query(subject: object.rdf_subject, predicate: predicate)
|
|
27
|
+
new_graph = child_graphs(results.map(&:object))
|
|
28
|
+
results.each do |res|
|
|
29
|
+
new_graph << res
|
|
30
|
+
end
|
|
31
|
+
result[predicate] = new_graph
|
|
28
32
|
elsif key == 'type'.freeze
|
|
29
33
|
# working around https://github.com/ActiveTriples/ActiveTriples/issues/122
|
|
30
34
|
predicate = ::RDF.type
|