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.
Files changed (208) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +6 -7
  4. data/.rubocop_todo.yml +55 -0
  5. data/.solr_wrapper +6 -0
  6. data/.travis.yml +6 -9
  7. data/Gemfile +1 -0
  8. data/History.txt +34 -0
  9. data/README.md +1 -3
  10. data/active-fedora.gemspec +7 -13
  11. data/lib/active_fedora/aggregation/list_source.rb +2 -0
  12. data/lib/active_fedora/associations/association_scope.rb +1 -1
  13. data/lib/active_fedora/associations/builder/aggregation.rb +1 -1
  14. data/lib/active_fedora/associations/builder/association.rb +1 -1
  15. data/lib/active_fedora/associations/builder/orders.rb +11 -3
  16. data/lib/active_fedora/associations/collection_association.rb +5 -5
  17. data/lib/active_fedora/associations/collection_proxy.rb +10 -10
  18. data/lib/active_fedora/associations/contained_finder.rb +2 -2
  19. data/lib/active_fedora/associations/has_and_belongs_to_many_association.rb +1 -1
  20. data/lib/active_fedora/associations/has_many_association.rb +2 -2
  21. data/lib/active_fedora/associations/has_subresource_association.rb +2 -2
  22. data/lib/active_fedora/associations/orders_association.rb +4 -0
  23. data/lib/active_fedora/associations/rdf.rb +2 -0
  24. data/lib/active_fedora/attribute_assignment.rb +0 -1
  25. data/lib/active_fedora/attribute_methods/dirty.rb +1 -1
  26. data/lib/active_fedora/attribute_methods.rb +1 -1
  27. data/lib/active_fedora/attributes.rb +1 -1
  28. data/lib/active_fedora/base.rb +4 -8
  29. data/lib/active_fedora/change_set.rb +6 -2
  30. data/lib/active_fedora/cleaner.rb +1 -1
  31. data/lib/active_fedora/containers/container.rb +1 -1
  32. data/lib/active_fedora/core.rb +33 -30
  33. data/lib/active_fedora/fedora.rb +6 -2
  34. data/lib/active_fedora/fedora_attributes.rb +1 -1
  35. data/lib/active_fedora/file/streaming.rb +1 -1
  36. data/lib/active_fedora/file.rb +2 -1
  37. data/lib/active_fedora/file_configurator.rb +3 -3
  38. data/lib/active_fedora/indexing.rb +1 -18
  39. data/lib/active_fedora/indexing_service.rb +0 -9
  40. data/lib/active_fedora/initializing_connection.rb +1 -1
  41. data/lib/active_fedora/loadable_from_json.rb +12 -1
  42. data/lib/active_fedora/model_classifier.rb +1 -1
  43. data/lib/active_fedora/nested_attributes.rb +2 -2
  44. data/lib/active_fedora/null_logger.rb +10 -0
  45. data/lib/active_fedora/orders/list_node.rb +2 -2
  46. data/lib/active_fedora/orders/ordered_list.rb +8 -4
  47. data/lib/active_fedora/orders/target_proxy.rb +4 -0
  48. data/lib/active_fedora/querying.rb +1 -1
  49. data/lib/active_fedora/railtie.rb +2 -2
  50. data/lib/active_fedora/rake_support.rb +1 -1
  51. data/lib/active_fedora/rdf/field_map_entry.rb +6 -0
  52. data/lib/active_fedora/rdf/persistence.rb +1 -0
  53. data/lib/active_fedora/rdf/value_caster.rb +15 -0
  54. data/lib/active_fedora/rdf.rb +1 -1
  55. data/lib/active_fedora/relation/delegation.rb +4 -0
  56. data/lib/active_fedora/relation/finder_methods.rb +3 -1
  57. data/lib/active_fedora/solr_hit.rb +1 -14
  58. data/lib/active_fedora/solr_query_builder.rb +17 -13
  59. data/lib/active_fedora/version.rb +1 -1
  60. data/lib/active_fedora/with_metadata/metadata_node.rb +2 -1
  61. data/lib/active_fedora.rb +1 -12
  62. data/lib/generators/active_fedora/config/solr/templates/solr/config/solrconfig.xml +11 -0
  63. data/lib/generators/active_fedora/config/solr/templates/solr_wrapper_test.yml +1 -1
  64. data/lib/generators/active_fedora/model/model_generator.rb +1 -1
  65. data/lib/generators/active_fedora/model/templates/model.rb.erb +4 -4
  66. data/lib/tasks/active_fedora_dev.rake +1 -1
  67. data/spec/config_helper.rb +1 -1
  68. data/spec/integration/associations_spec.rb +23 -24
  69. data/spec/integration/attached_files_spec.rb +19 -9
  70. data/spec/integration/attributes_spec.rb +12 -16
  71. data/spec/integration/autosave_association_spec.rb +6 -6
  72. data/spec/integration/base_spec.rb +8 -8
  73. data/spec/integration/basic_contains_association_spec.rb +1 -1
  74. data/spec/integration/clean_connection_spec.rb +1 -1
  75. data/spec/integration/collection_association_spec.rb +2 -5
  76. data/spec/integration/date_time_properties_spec.rb +1 -17
  77. data/spec/integration/direct_container_spec.rb +12 -12
  78. data/spec/integration/directly_contains_one_association_spec.rb +11 -13
  79. data/spec/integration/eradicate_spec.rb +1 -1
  80. data/spec/integration/fedora_solr_sync_spec.rb +2 -2
  81. data/spec/integration/file_fixity_spec.rb +6 -8
  82. data/spec/integration/file_spec.rb +37 -39
  83. data/spec/integration/generators/solr_generator_spec.rb +7 -10
  84. data/spec/integration/has_and_belongs_to_many_associations_spec.rb +7 -7
  85. data/spec/integration/has_many_associations_spec.rb +9 -11
  86. data/spec/integration/indexing_spec.rb +2 -2
  87. data/spec/integration/indirect_container_spec.rb +11 -12
  88. data/spec/integration/json_serialization_spec.rb +4 -4
  89. data/spec/integration/query_result_builder_spec.rb +9 -21
  90. data/spec/integration/rdf_nested_attributes_spec.rb +7 -7
  91. data/spec/integration/relation_delegation_spec.rb +8 -10
  92. data/spec/integration/relation_spec.rb +13 -16
  93. data/spec/integration/scoped_query_spec.rb +3 -3
  94. data/spec/integration/scoping_spec.rb +3 -3
  95. data/spec/integration/solr_hit_spec.rb +4 -15
  96. data/spec/integration/versionable_spec.rb +73 -327
  97. data/spec/integration/with_metadata_spec.rb +1 -1
  98. data/spec/spec_helper.rb +52 -10
  99. data/spec/unit/active_fedora_spec.rb +1 -1
  100. data/spec/unit/aggregation/list_source_spec.rb +37 -37
  101. data/spec/unit/aggregation/ordered_reader_spec.rb +4 -4
  102. data/spec/unit/association_hash_spec.rb +17 -31
  103. data/spec/unit/attached_files_spec.rb +35 -32
  104. data/spec/unit/attributes_spec.rb +25 -25
  105. data/spec/unit/base_active_model_spec.rb +8 -8
  106. data/spec/unit/base_cma_spec.rb +1 -1
  107. data/spec/unit/base_extra_spec.rb +7 -22
  108. data/spec/unit/base_spec.rb +21 -27
  109. data/spec/unit/builder/has_and_belongs_to_many_spec.rb +1 -1
  110. data/spec/unit/callback_spec.rb +2 -2
  111. data/spec/unit/change_set_spec.rb +5 -5
  112. data/spec/unit/checksum_spec.rb +2 -2
  113. data/spec/unit/code_configurator_spec.rb +1 -1
  114. data/spec/unit/core/fedora_id_translator_spec.rb +2 -2
  115. data/spec/unit/core/fedora_uri_translator_spec.rb +2 -2
  116. data/spec/unit/core/logger_spec.rb +18 -0
  117. data/spec/unit/core_spec.rb +68 -32
  118. data/spec/unit/default_model_mapper_spec.rb +6 -6
  119. data/spec/unit/fedora_spec.rb +3 -4
  120. data/spec/unit/file_configurator_spec.rb +96 -96
  121. data/spec/unit/file_path_builder_spec.rb +3 -3
  122. data/spec/unit/file_spec.rb +93 -61
  123. data/spec/unit/files_hash_spec.rb +9 -9
  124. data/spec/unit/filter_spec.rb +3 -3
  125. data/spec/unit/finder_methods_spec.rb +3 -3
  126. data/spec/unit/forbidden_attributes_protection_spec.rb +2 -2
  127. data/spec/unit/has_and_belongs_to_many_association_spec.rb +14 -15
  128. data/spec/unit/has_many_association_spec.rb +28 -13
  129. data/spec/unit/indexers/global_indexer_spec.rb +6 -6
  130. data/spec/unit/indexing_service_spec.rb +5 -5
  131. data/spec/unit/indexing_spec.rb +8 -8
  132. data/spec/unit/inheritance_spec.rb +11 -7
  133. data/spec/unit/loadable_from_json_spec.rb +4 -4
  134. data/spec/unit/logger_spec.rb +1 -1
  135. data/spec/unit/model_classifier_spec.rb +5 -5
  136. data/spec/unit/ordered_spec.rb +144 -147
  137. data/spec/unit/orders/list_node_spec.rb +22 -22
  138. data/spec/unit/orders/ordered_list_spec.rb +96 -96
  139. data/spec/unit/orders/reflection_spec.rb +4 -4
  140. data/spec/unit/pathing_spec.rb +4 -4
  141. data/spec/unit/persistence_spec.rb +28 -28
  142. data/spec/unit/property_spec.rb +2 -2
  143. data/spec/unit/query_spec.rb +12 -12
  144. data/spec/unit/rdf/indexing_service_spec.rb +29 -29
  145. data/spec/unit/readonly_spec.rb +5 -4
  146. data/spec/unit/reflection_spec.rb +3 -3
  147. data/spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb +9 -9
  148. data/spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb +9 -9
  149. data/spec/unit/rspec_matchers/have_predicate_matcher_spec.rb +9 -9
  150. data/spec/unit/schema_indexing_strategy_spec.rb +5 -5
  151. data/spec/unit/serializers_spec.rb +3 -4
  152. data/spec/unit/solr_config_options_spec.rb +13 -16
  153. data/spec/unit/solr_hit_spec.rb +9 -9
  154. data/spec/unit/solr_service_spec.rb +4 -10
  155. data/spec/unit/sparql_insert_spec.rb +2 -2
  156. data/spec/unit/validations_spec.rb +12 -12
  157. data/spec/unit/with_metadata/default_metadata_class_factory_spec.rb +3 -2
  158. data/spec/unit/with_metadata/metadata_node_spec.rb +3 -2
  159. metadata +30 -130
  160. data/lib/active_fedora/datastreams/nokogiri_datastreams.rb +0 -119
  161. data/lib/active_fedora/datastreams.rb +0 -6
  162. data/lib/active_fedora/nom_datastream.rb +0 -73
  163. data/lib/active_fedora/om_datastream.rb +0 -118
  164. data/lib/active_fedora/profile_indexing_service.rb +0 -11
  165. data/lib/active_fedora/qualified_dublin_core_datastream.rb +0 -158
  166. data/lib/active_fedora/rdf/datastream_indexing.rb +0 -49
  167. data/lib/active_fedora/rdf/ntriples_rdf_datastream.rb +0 -13
  168. data/lib/active_fedora/rdf/rdf_datastream.rb +0 -167
  169. data/lib/active_fedora/rdf/rdfxml_datastream.rb +0 -13
  170. data/lib/active_fedora/solr_instance_loader.rb +0 -47
  171. data/solr/config/_rest_managed.json +0 -3
  172. data/solr/config/admin-extra.html +0 -31
  173. data/solr/config/elevate.xml +0 -36
  174. data/solr/config/mapping-ISOLatin1Accent.txt +0 -246
  175. data/solr/config/protwords.txt +0 -21
  176. data/solr/config/schema.xml +0 -372
  177. data/solr/config/scripts.conf +0 -24
  178. data/solr/config/solrconfig.xml +0 -311
  179. data/solr/config/spellings.txt +0 -2
  180. data/solr/config/stopwords.txt +0 -58
  181. data/solr/config/stopwords_en.txt +0 -58
  182. data/solr/config/synonyms.txt +0 -31
  183. data/solr/config/xslt/example.xsl +0 -132
  184. data/solr/config/xslt/example_atom.xsl +0 -67
  185. data/solr/config/xslt/example_rss.xsl +0 -66
  186. data/solr/config/xslt/luke.xsl +0 -337
  187. data/spec/fixtures/damsObjectModel.xml +0 -38
  188. data/spec/fixtures/dublin_core_rdf_descMetadata.nt +0 -13
  189. data/spec/fixtures/mixed_rdf_descMetadata.nt +0 -7
  190. data/spec/fixtures/mods_articles/mods_article1.xml +0 -98
  191. data/spec/fixtures/solr_rdf_descMetadata.nt +0 -7
  192. data/spec/integration/complex_rdf_datastream_spec.rb +0 -228
  193. data/spec/integration/datastream_rdf_nested_attributes_spec.rb +0 -179
  194. data/spec/integration/ntriples_datastream_spec.rb +0 -203
  195. data/spec/integration/om_datastream_spec.rb +0 -78
  196. data/spec/integration/solr_instance_loader_spec.rb +0 -156
  197. data/spec/samples/hydra-mods_article_datastream.rb +0 -517
  198. data/spec/samples/models/mods_article.rb +0 -9
  199. data/spec/samples/oral_history_sample.xml +0 -38
  200. data/spec/samples/oral_history_xml.xml +0 -35
  201. data/spec/samples/samples.rb +0 -2
  202. data/spec/unit/nom_datastream_spec.rb +0 -60
  203. data/spec/unit/ntriples_datastream_spec.rb +0 -170
  204. data/spec/unit/om_datastream_spec.rb +0 -294
  205. data/spec/unit/qualified_dublin_core_datastream_spec.rb +0 -119
  206. data/spec/unit/rdf_datastream_spec.rb +0 -84
  207. data/spec/unit/rdf_resource_datastream_spec.rb +0 -204
  208. data/spec/unit/rdfxml_datastream_spec.rb +0 -106
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87658dd9989ef6b9dcb8e43ec5b1cd5d7cb05348
4
- data.tar.gz: 86e4e8778223f2c8716cfafa305da4a6b1fc6e4c
3
+ metadata.gz: d30a0af700ab6f5855f2ac0dae9bd20aace608b3
4
+ data.tar.gz: f2e755860c2c67c4559c339c1468fa0a23b6038f
5
5
  SHA512:
6
- metadata.gz: 240c154b9a54a470c1837752ec2763d2cec77ecdee788e9e82f75c48175f39d56cf8e71ee90ffa4a4c3ef8b4df25341a5755640cfa20a1c89b46d442a7d113fa
7
- data.tar.gz: 50c233379480b07d252afdb6192721fdded0235ff776f579049b619961c9986f14b82bef9b9192261639664d1abc9d8b1af012ef30e240b8aa130ad8db9fda65
6
+ metadata.gz: 61d91bdf7413839f75fa6be613786888dd74fd0a19253cc911886fbf6877d6b2d1903cb924c6312d0e92c5cc7d719f7394e5d5ab1c6d9d960a40b15c7d885125
7
+ data.tar.gz: f11e71036ebc0316ebc79bef415d98e0f0fa09036f3ce7438cf6839baf3cca87a168f1ec53e83366913e24d33d246d3d394647ac21a9c5480a1f92610a67a030
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ bin
15
15
  gemfiles/*.gemfile.lock
16
16
  /fcrepo4-data
17
17
  /fcrepo4-test-data
18
+ /spec/examples.txt
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
@@ -0,0 +1,6 @@
1
+ # Place any default configuration for solr_wrapper here
2
+ # version: 6.1.0
3
+ port: 8985
4
+ collection:
5
+ dir: lib/generators/active_fedora/config/solr/templates/solr/config/
6
+ name: hydra-test
data/.travis.yml CHANGED
@@ -1,15 +1,12 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  sudo: false
4
- rvm:
5
- - 2.3.0
6
-
7
- notifications:
8
- irc: "irc.freenode.org#projecthydra"
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
@@ -8,6 +8,7 @@ gem 'byebug' unless ENV['TRAVIS']
8
8
  gem 'pry-byebug' unless ENV['CI']
9
9
 
10
10
  gem 'activemodel', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
11
+ gem 'rsolr', ENV['RSOLR_VERSION'] if ENV['RSOLR_VERSION']
11
12
 
12
13
  group :test do
13
14
  gem 'simplecov', require: false
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 -d solr/config/ --collection_name hydra-test
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
@@ -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', '~> 1.0', '>= 1.0.10'
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.7.1'
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.5.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
- # Pin rake to 10.0 due to https://github.com/lsegal/yard/issues/947
33
- s.add_development_dependency "rake", '~> 10.0'
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
- # Pin to rubocop 0.38.0 due to https://github.com/nevir/rubocop-rspec/issues/78
41
- s.add_development_dependency "rubocop", '~> 0.38.0'
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 == 0
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 == 0
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 head.map(&:rdf_subject) == source.head_id && tail.map(&:rdf_subject) == source.tail_id
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", "").pluralize
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 == 0
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?(Fixnum) || record.is_a?(String) }
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 == 0
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.class_name.constantize.to_class_uri if @reflection.class_name && @reflection.class_name != 'ActiveFedora::Base'
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 if ActiveFedora::Base.logger
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::RecordNotFound</tt>
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::RecordNotFound: Couldn't find Pet with id=4
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::RecordNotFound
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::RecordNotFound
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::RecordNotFound: Couldn't find all Pets with IDs (1, 3)
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::RecordNotFound: Couldn't find Pet with id=1
542
+ # # => ActiveFedora::ObjectNotFoundError: Couldn't find Pet with id=1
543
543
  #
544
- # You can pass +Fixnum+ or +String+ values, it finds the records
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::RecordNotFound: Couldn't find all Pets with IDs (1, 2, 3)
606
+ # Pet.find(1, 2, 3) # => ActiveFedora::ObjectNotFoundError: Couldn't find all Pets with IDs (1, 2, 3)
607
607
  #
608
- # You can pass +Fixnum+ or +String+ values, it finds the records
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::RecordNotFound: Couldn't find all Pets with IDs (4, 5, 6)
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.to_class_uri], [:proxyFor, record.id]]
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.") if ActiveFedora::Base.logger
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 == 0
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.options[:property] == reflection.options[:property] }
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)
@@ -27,6 +27,10 @@ module ActiveFedora::Associations
27
27
  @target_proxy ||= ActiveFedora::Orders::TargetProxy.new(self)
28
28
  end
29
29
 
30
+ def target_ids_reader
31
+ target_reader.ids
32
+ end
33
+
30
34
  def find_reflection
31
35
  reflection
32
36
  end
@@ -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
@@ -48,7 +48,6 @@ module ActiveFedora
48
48
 
49
49
  def _assign_attribute(k, v)
50
50
  raise UnknownAttributeError.new(self, k) unless respond_to?("#{k}=")
51
-
52
51
  public_send("#{k}=", v)
53
52
  end
54
53
  end
@@ -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
@@ -235,7 +235,7 @@ module ActiveFedora
235
235
  # person = Person.new
236
236
  # person[:age] = '22'
237
237
  # person[:age] # => 22
238
- # person[:age] # => Fixnum
238
+ # person[:age] # => Integer
239
239
  def []=(attr_name, value)
240
240
  write_attribute(attr_name, value)
241
241
  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, OmAttribute, or RdfDatastreamAttribute)
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
@@ -10,16 +10,12 @@ module ActiveFedora
10
10
  #
11
11
  # =The Basics
12
12
  # class Oralhistory < ActiveFedora::Base
13
- # has_metadata "properties", type: ActiveFedora::SimpleDatastream do |m|
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 metadata datastream named "properties", which is composed of 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 +contains+ are accessed via the +attached_files+ member hash.
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
- result[predicate] = graph.query(subject: object.rdf_subject, predicate: predicate)
27
- result[predicate] = child_graphs(result[predicate].objects) << result[predicate]
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
@@ -48,7 +48,7 @@ module ActiveFedora
48
48
  end
49
49
 
50
50
  def self.log(message)
51
- ActiveFedora::Base.logger.debug message if ActiveFedora::Base.logger
51
+ ActiveFedora::Base.logger.debug message
52
52
  end
53
53
  end
54
54
  end