active-fedora 13.3.0 → 14.0.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/.circleci/config.yml +106 -46
- data/.rubocop.yml +26 -12
- data/.rubocop_todo.yml +1 -1
- data/Gemfile +3 -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 +1 -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 +1 -3
- 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 +25 -52
|
@@ -35,12 +35,10 @@ module ActiveFedora
|
|
|
35
35
|
# empty, tail.prev is the first element.
|
|
36
36
|
def tail
|
|
37
37
|
@tail ||=
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
head.next
|
|
43
|
-
end
|
|
38
|
+
if tail_subject
|
|
39
|
+
TailSentinel.new(self, prev_node: build_node(tail_subject))
|
|
40
|
+
else
|
|
41
|
+
head.next
|
|
44
42
|
end
|
|
45
43
|
end
|
|
46
44
|
|
|
@@ -113,14 +111,14 @@ module ActiveFedora
|
|
|
113
111
|
# @param [ListNode] node Node to delete
|
|
114
112
|
def delete_node(node)
|
|
115
113
|
node = ordered_reader.find { |x| x == node }
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
114
|
+
return unless node
|
|
115
|
+
|
|
116
|
+
prev_node = node.prev
|
|
117
|
+
next_node = node.next
|
|
118
|
+
node.prev.next = next_node
|
|
119
|
+
node.next.prev = prev_node
|
|
120
|
+
@changed = true
|
|
121
|
+
node
|
|
124
122
|
end
|
|
125
123
|
|
|
126
124
|
# @param [Integer] loc Index of node to delete.
|
|
@@ -173,9 +171,7 @@ module ActiveFedora
|
|
|
173
171
|
# the first.
|
|
174
172
|
def proxy_in
|
|
175
173
|
proxies = to_a.map(&:proxy_in_id).compact.uniq
|
|
176
|
-
if proxies.length > 1
|
|
177
|
-
ActiveFedora::Base.logger.warn "WARNING: List contains nodes aggregated under different URIs. Returning only the first."
|
|
178
|
-
end
|
|
174
|
+
ActiveFedora::Base.logger.warn "WARNING: List contains nodes aggregated under different URIs. Returning only the first." if proxies.length > 1
|
|
179
175
|
proxies.first
|
|
180
176
|
end
|
|
181
177
|
|
|
@@ -208,9 +204,7 @@ module ActiveFedora
|
|
|
208
204
|
|
|
209
205
|
def new_node_subject
|
|
210
206
|
node = ::RDF::URI("##{::RDF::Node.new.id}")
|
|
211
|
-
while node_cache.key?(node)
|
|
212
|
-
node = ::RDF::URI("##{::RDF::Node.new.id}")
|
|
213
|
-
end
|
|
207
|
+
node = ::RDF::URI("##{::RDF::Node.new.id}") while node_cache.key?(node)
|
|
214
208
|
node
|
|
215
209
|
end
|
|
216
210
|
|
|
@@ -251,14 +245,14 @@ module ActiveFedora
|
|
|
251
245
|
end
|
|
252
246
|
|
|
253
247
|
class HeadSentinel < Sentinel
|
|
254
|
-
def initialize(*args)
|
|
248
|
+
def initialize(*args, **kwargs)
|
|
255
249
|
super
|
|
256
250
|
@next ||= TailSentinel.new(parent, prev_node: self)
|
|
257
251
|
end
|
|
258
252
|
end
|
|
259
253
|
|
|
260
254
|
class TailSentinel < Sentinel
|
|
261
|
-
def initialize(*args)
|
|
255
|
+
def initialize(*args, **kwargs)
|
|
262
256
|
super
|
|
263
257
|
prev.next = self if prev && prev.next != self
|
|
264
258
|
end
|
|
@@ -26,6 +26,7 @@ module ActiveFedora::RDF
|
|
|
26
26
|
subClassOf: "info:fedora/fedora-system:def/model#FedoraObject".freeze,
|
|
27
27
|
type: "info:fedora/fedora-system:def/model#FedoraObject".freeze
|
|
28
28
|
end
|
|
29
|
+
|
|
29
30
|
class Model < ::RDF::StrictVocabulary("info:fedora/fedora-system:def/model#")
|
|
30
31
|
# Class definitions
|
|
31
32
|
term :FedoraObject,
|
|
@@ -176,6 +177,7 @@ module ActiveFedora::RDF
|
|
|
176
177
|
range: "xsd:boolean".freeze,
|
|
177
178
|
type: "rdf:Property".freeze
|
|
178
179
|
end
|
|
180
|
+
|
|
179
181
|
class RelsExt < ::RDF::StrictVocabulary("info:fedora/fedora-system:def/relations-external#")
|
|
180
182
|
# Property definitions
|
|
181
183
|
property :fedoraRelationship,
|
|
@@ -293,6 +295,7 @@ module ActiveFedora::RDF
|
|
|
293
295
|
"owl:inverseOf" => %(info:fedora/fedora-system:def/relations-external#hasSubset).freeze,
|
|
294
296
|
type: "rdf:Property".freeze
|
|
295
297
|
end
|
|
298
|
+
|
|
296
299
|
class View < ::RDF::StrictVocabulary("info:fedora/fedora-system:def/view#")
|
|
297
300
|
property :disseminates,
|
|
298
301
|
comment: %(A property used to indicate that an object contains a datastream).freeze,
|
|
@@ -183,11 +183,8 @@ module ActiveFedora
|
|
|
183
183
|
end
|
|
184
184
|
|
|
185
185
|
def check_validity_of_inverse!
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
raise InverseOfAssociationNotFoundError, self
|
|
189
|
-
end
|
|
190
|
-
end
|
|
186
|
+
return if polymorphic?
|
|
187
|
+
raise InverseOfAssociationNotFoundError, self if has_inverse? && inverse_of.nil?
|
|
191
188
|
end
|
|
192
189
|
|
|
193
190
|
def alias_candidate(name)
|
|
@@ -214,6 +211,7 @@ module ActiveFedora
|
|
|
214
211
|
|
|
215
212
|
attr_reader :active_fedora
|
|
216
213
|
|
|
214
|
+
# rubocop:disable Lint/MissingSuper
|
|
217
215
|
def initialize(name, scope, options, active_fedora)
|
|
218
216
|
@name = name
|
|
219
217
|
@scope = scope
|
|
@@ -222,6 +220,7 @@ module ActiveFedora
|
|
|
222
220
|
@klass = options[:anonymous_class]
|
|
223
221
|
@automatic_inverse_of = nil
|
|
224
222
|
end
|
|
223
|
+
# rubocop:enable Lint/MissingSuper
|
|
225
224
|
|
|
226
225
|
def autosave=(autosave)
|
|
227
226
|
@options[:autosave] = autosave
|
|
@@ -262,7 +261,7 @@ module ActiveFedora
|
|
|
262
261
|
|
|
263
262
|
# Holds all the meta-data about an association as it was specified in the
|
|
264
263
|
# Active Record class.
|
|
265
|
-
class AssociationReflection < MacroReflection
|
|
264
|
+
class AssociationReflection < MacroReflection # :nodoc:
|
|
266
265
|
attr_accessor :parent_reflection # Reflection
|
|
267
266
|
|
|
268
267
|
def initialize(name, scope, options, active_fedora)
|
|
@@ -295,9 +294,7 @@ module ActiveFedora
|
|
|
295
294
|
end
|
|
296
295
|
|
|
297
296
|
def solr_key
|
|
298
|
-
@solr_key ||=
|
|
299
|
-
ActiveFedora.index_field_mapper.solr_name(predicate_for_solr, :symbol)
|
|
300
|
-
end
|
|
297
|
+
@solr_key ||= ActiveFedora.index_field_mapper.solr_name(predicate_for_solr, :symbol)
|
|
301
298
|
end
|
|
302
299
|
|
|
303
300
|
def check_validity!
|
|
@@ -314,7 +311,7 @@ module ActiveFedora
|
|
|
314
311
|
def collect_join_chain
|
|
315
312
|
[self]
|
|
316
313
|
end
|
|
317
|
-
alias chain collect_join_chain # TODO Remove alias, See https://github.com/samvera/active_fedora/issues/1347
|
|
314
|
+
alias chain collect_join_chain # TODO: Remove alias, See https://github.com/samvera/active_fedora/issues/1347
|
|
318
315
|
|
|
319
316
|
def has_inverse?
|
|
320
317
|
inverse_name
|
|
@@ -445,7 +442,7 @@ module ActiveFedora
|
|
|
445
442
|
"#{name.to_s.singularize}_ids"
|
|
446
443
|
elsif options[:as]
|
|
447
444
|
"#{options[:as]}_id"
|
|
448
|
-
elsif inverse_of
|
|
445
|
+
elsif inverse_of&.collection?
|
|
449
446
|
# for a has_many that is the inverse of a has_and_belongs_to_many
|
|
450
447
|
"#{options[:inverse_of].to_s.singularize}_ids"
|
|
451
448
|
else
|
|
@@ -103,9 +103,7 @@ module ActiveFedora
|
|
|
103
103
|
def search_by_id(id, opts = {})
|
|
104
104
|
opts[:rows] = 1
|
|
105
105
|
result = search_with_conditions({ id: id }, opts)
|
|
106
|
-
if result.empty?
|
|
107
|
-
raise ActiveFedora::ObjectNotFoundError, "Object '#{id}' not found in solr"
|
|
108
|
-
end
|
|
106
|
+
raise ActiveFedora::ObjectNotFoundError, "Object '#{id}' not found in solr" if result.empty?
|
|
109
107
|
result.first
|
|
110
108
|
end
|
|
111
109
|
|
|
@@ -118,11 +116,9 @@ module ActiveFedora
|
|
|
118
116
|
cast = opts.delete(:cast)
|
|
119
117
|
search_in_batches(conditions, opts.merge(fl: ActiveFedora.id_field)) do |group|
|
|
120
118
|
group.each do |hit|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
ActiveFedora::Base.logger.error "Although #{hit[ActiveFedora.id_field]} was found in Solr, it doesn't seem to exist in Fedora. The index is out of synch."
|
|
125
|
-
end
|
|
119
|
+
yield(load_from_fedora(hit[ActiveFedora.id_field], cast))
|
|
120
|
+
rescue Ldp::Gone, ActiveFedora::ObjectNotFoundError
|
|
121
|
+
ActiveFedora::Base.logger.error "Although #{hit[ActiveFedora.id_field]} was found in Solr, it doesn't seem to exist in Fedora. The index is out of synch."
|
|
126
122
|
end
|
|
127
123
|
end
|
|
128
124
|
end
|
|
@@ -145,7 +141,7 @@ module ActiveFedora
|
|
|
145
141
|
opts[:q] = create_query(conditions)
|
|
146
142
|
opts[:qt] = @klass.solr_query_handler
|
|
147
143
|
# set default sort to created date ascending
|
|
148
|
-
opts[:sort] = @klass.default_sort_params
|
|
144
|
+
opts[:sort] = @klass.default_sort_params if opts[:sort].blank?
|
|
149
145
|
|
|
150
146
|
batch_size = opts.delete(:batch_size) || 1000
|
|
151
147
|
select_path = ActiveFedora::SolrService.select_path
|
|
@@ -194,9 +190,7 @@ module ActiveFedora
|
|
|
194
190
|
ActiveFedora::Base
|
|
195
191
|
else
|
|
196
192
|
resource_class = ActiveFedora.model_mapper.classifier(resource).best_model
|
|
197
|
-
unless equivalent_class?(resource_class)
|
|
198
|
-
raise ActiveFedora::ModelMismatch, "Expected #{@klass}. Got: #{resource_class}"
|
|
199
|
-
end
|
|
193
|
+
raise ActiveFedora::ModelMismatch, "Expected #{@klass}. Got: #{resource_class}" unless equivalent_class?(resource_class)
|
|
200
194
|
resource_class
|
|
201
195
|
end
|
|
202
196
|
end
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
require 'active_support/
|
|
1
|
+
require 'active_support/core_ext/module/attribute_accessors_per_thread'
|
|
2
2
|
|
|
3
3
|
module ActiveFedora
|
|
4
4
|
class RuntimeRegistry
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
attr_accessor :solr_service, :fedora_connection
|
|
5
|
+
thread_mattr_accessor :solr_service, :fedora_connection
|
|
8
6
|
end
|
|
9
7
|
end
|
|
@@ -46,7 +46,7 @@ module ActiveFedora
|
|
|
46
46
|
super || default_scopes.any? || respond_to?(:default_scope)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
def before_remove_const
|
|
49
|
+
def before_remove_const # :nodoc:
|
|
50
50
|
self.current_scope = nil
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -110,9 +110,7 @@ module ActiveFedora
|
|
|
110
110
|
def build_default_scope(base_rel = nil) # :nodoc:
|
|
111
111
|
return if abstract_class?
|
|
112
112
|
|
|
113
|
-
if default_scope_override.nil?
|
|
114
|
-
self.default_scope_override = !Base.is_a?(method(:default_scope).owner)
|
|
115
|
-
end
|
|
113
|
+
self.default_scope_override = !Base.is_a?(method(:default_scope).owner) if default_scope_override.nil?
|
|
116
114
|
|
|
117
115
|
if default_scope_override
|
|
118
116
|
# The user has defined their own default scope method, so call that
|
|
@@ -138,9 +138,7 @@ module ActiveFedora
|
|
|
138
138
|
# Article.published.featured.latest_article
|
|
139
139
|
# Article.featured.titles
|
|
140
140
|
def scope(name, body, &block)
|
|
141
|
-
unless body.respond_to?(:call)
|
|
142
|
-
raise ArgumentError, 'The scope body needs to be callable.'
|
|
143
|
-
end
|
|
141
|
+
raise ArgumentError, 'The scope body needs to be callable.' unless body.respond_to?(:call)
|
|
144
142
|
|
|
145
143
|
if dangerous_class_method?(name)
|
|
146
144
|
raise ArgumentError, "You tried to define a scope named \"#{name}\" " \
|
|
@@ -10,11 +10,11 @@ module ActiveFedora
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
module ClassMethods
|
|
13
|
-
def current_scope
|
|
13
|
+
def current_scope # :nodoc:
|
|
14
14
|
ScopeRegistry.value_for(:current_scope, self)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def current_scope=(scope)
|
|
17
|
+
def current_scope=(scope) # :nodoc:
|
|
18
18
|
ScopeRegistry.set_value_for(:current_scope, self, scope)
|
|
19
19
|
end
|
|
20
20
|
|
|
@@ -32,9 +32,7 @@ module ActiveFedora
|
|
|
32
32
|
def instance
|
|
33
33
|
# Register Solr
|
|
34
34
|
|
|
35
|
-
unless ActiveFedora::RuntimeRegistry.solr_service
|
|
36
|
-
register(ActiveFedora.solr_config)
|
|
37
|
-
end
|
|
35
|
+
register(ActiveFedora.solr_config) unless ActiveFedora::RuntimeRegistry.solr_service
|
|
38
36
|
|
|
39
37
|
ActiveFedora::RuntimeRegistry.solr_service
|
|
40
38
|
end
|
|
@@ -8,9 +8,9 @@ module ActiveFedora
|
|
|
8
8
|
|
|
9
9
|
def model_type
|
|
10
10
|
if respond_to?(:metadata)
|
|
11
|
-
metadata.ldp_source.graph.query(predicate: ::RDF.type).objects
|
|
11
|
+
metadata.ldp_source.graph.query({ predicate: ::RDF.type }).objects
|
|
12
12
|
else
|
|
13
|
-
resource.query(subject: resource.rdf_subject, predicate: ::RDF.type).objects
|
|
13
|
+
resource.query({ subject: resource.rdf_subject, predicate: ::RDF.type }).objects
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
@@ -2,9 +2,7 @@ module ActiveFedora
|
|
|
2
2
|
class VersionsGraph < ::RDF::Graph
|
|
3
3
|
def all(opts = {})
|
|
4
4
|
versions = fedora_versions
|
|
5
|
-
unless opts[:include_auto_save]
|
|
6
|
-
versions.reject! { |version| version.label =~ /auto/ }
|
|
7
|
-
end
|
|
5
|
+
versions.reject! { |version| version.label =~ /auto/ } unless opts[:include_auto_save]
|
|
8
6
|
versions.sort_by { |version| DateTime.parse(version.created) }
|
|
9
7
|
rescue ArgumentError, NoMethodError
|
|
10
8
|
raise ActiveFedora::VersionLacksCreateDate
|
|
@@ -21,7 +19,7 @@ module ActiveFedora
|
|
|
21
19
|
end
|
|
22
20
|
|
|
23
21
|
def resources
|
|
24
|
-
query(predicate: ::RDF::Vocab::Fcrepo4.hasVersion)
|
|
22
|
+
query({ predicate: ::RDF::Vocab::Fcrepo4.hasVersion })
|
|
25
23
|
end
|
|
26
24
|
|
|
27
25
|
private
|
|
@@ -39,11 +37,11 @@ module ActiveFedora
|
|
|
39
37
|
end
|
|
40
38
|
|
|
41
39
|
def label_query(statement)
|
|
42
|
-
query(subject: statement.object).query(predicate: ::RDF::Vocab::Fcrepo4.hasVersionLabel).first.object.to_s
|
|
40
|
+
query({ subject: statement.object }).query({ predicate: ::RDF::Vocab::Fcrepo4.hasVersionLabel }).first.object.to_s
|
|
43
41
|
end
|
|
44
42
|
|
|
45
43
|
def created_query(statement)
|
|
46
|
-
query(subject: statement.object).query(predicate: ::RDF::Vocab::Fcrepo4.created).first.object.to_s
|
|
44
|
+
query({ subject: statement.object }).query({ predicate: ::RDF::Vocab::Fcrepo4.created }).first.object.to_s
|
|
47
45
|
end
|
|
48
46
|
|
|
49
47
|
def fedora_versions
|
|
@@ -71,7 +71,7 @@ module ActiveFedora
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
def server_managed_properties
|
|
74
|
-
@server_managed_properties ||= properties.select { |
|
|
74
|
+
@server_managed_properties ||= properties.select { |_k, v| v[:server_managed] }.keys.map(&:to_sym)
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
class << self
|
|
@@ -22,7 +22,7 @@ module ActiveFedora
|
|
|
22
22
|
return unless super && !new_record?
|
|
23
23
|
# TODOs captured as https://github.com/samvera/active_fedora/issues/1331
|
|
24
24
|
metadata_node.metadata_uri = described_by # TODO: only necessary if the URI was < > before
|
|
25
|
-
metadata_node.save # TODO if changed?
|
|
25
|
+
metadata_node.save # TODO: if changed?
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
module ClassMethods
|
data/lib/active_fedora.rb
CHANGED
|
@@ -25,7 +25,7 @@ module RDF
|
|
|
25
25
|
@string ||= begin
|
|
26
26
|
# Show nanoseconds but remove trailing zeros
|
|
27
27
|
nano = @object.strftime('%N').sub(/0+\Z/, EMPTY)
|
|
28
|
-
nano = DOT + nano
|
|
28
|
+
nano = DOT + nano if nano.present?
|
|
29
29
|
@object.strftime(ALTERNATIVE_FORMAT) + nano + @object.strftime(TIMEZONE_FORMAT)
|
|
30
30
|
end
|
|
31
31
|
end
|
|
@@ -33,7 +33,7 @@ module RDF
|
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
module ActiveFedora
|
|
36
|
+
module ActiveFedora # :nodoc:
|
|
37
37
|
extend ActiveSupport::Autoload
|
|
38
38
|
|
|
39
39
|
eager_autoload do
|
|
@@ -156,7 +156,7 @@ module ActiveFedora #:nodoc:
|
|
|
156
156
|
end
|
|
157
157
|
|
|
158
158
|
class << self
|
|
159
|
-
attr_reader :
|
|
159
|
+
attr_reader :solr_config, :config_options
|
|
160
160
|
attr_accessor :configurator
|
|
161
161
|
|
|
162
162
|
def fedora_config
|
|
@@ -174,9 +174,7 @@ module ActiveFedora #:nodoc:
|
|
|
174
174
|
options = {} if options.nil?
|
|
175
175
|
# For backwards compatibility, handle cases where config_path (a String) is passed in as the argument rather than a config_options hash
|
|
176
176
|
# In all other cases, set config_path to config_options[:config_path], which is ok if it's nil
|
|
177
|
-
if options.is_a? String
|
|
178
|
-
raise ArgumentError, "Calling ActiveFedora.init with a path as an argument has been removed. Use ActiveFedora.init(:fedora_config_path=>#{options})"
|
|
179
|
-
end
|
|
177
|
+
raise ArgumentError, "Calling ActiveFedora.init with a path as an argument has been removed. Use ActiveFedora.init(:fedora_config_path=>#{options})" if options.is_a? String
|
|
180
178
|
@fedora_config = nil
|
|
181
179
|
SolrService.reset!
|
|
182
180
|
configurator.init(options)
|
|
@@ -199,7 +197,7 @@ module ActiveFedora #:nodoc:
|
|
|
199
197
|
def environment
|
|
200
198
|
if config_options.fetch(:environment, nil)
|
|
201
199
|
config_options[:environment]
|
|
202
|
-
elsif defined?(Rails.env) && !Rails.env.nil?
|
|
200
|
+
elsif defined?(Rails.env) && !Rails.env.nil? # rubocop:disable Rails/UnknownEnv
|
|
203
201
|
Rails.env.to_s
|
|
204
202
|
elsif defined?(ENV['environment']) && !ENV['environment'].nil?
|
|
205
203
|
ENV['environment']
|
|
@@ -29,7 +29,9 @@
|
|
|
29
29
|
affect both how text is indexed and queried.
|
|
30
30
|
-->
|
|
31
31
|
<luceneMatchVersion>5.0.0</luceneMatchVersion>
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
<lib dir="${solr.install.dir:../../../..}/modules/analysis-extras/lib" />
|
|
34
|
+
<lib dir="${solr.install.dir:../../../..}/modules/extraction/lib" regex=".*\.jar" />>
|
|
33
35
|
<lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lib" />
|
|
34
36
|
<lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lucene-libs" />
|
|
35
37
|
<lib dir="${solr.install.dir:../../../..}/contrib/extraction/lib" regex=".*\.jar" />
|
|
@@ -14,12 +14,12 @@ namespace :active_fedora do
|
|
|
14
14
|
|
|
15
15
|
YARD::Rake::YardocTask.new(:doc) do |yt|
|
|
16
16
|
yt.files = Dir.glob(File.join(project_root, 'lib', '**', '*.rb')) +
|
|
17
|
-
[
|
|
17
|
+
['-', File.join(project_root, 'README.md')]
|
|
18
18
|
yt.options = ['--output-dir', doc_destination, '--readme', 'README.md']
|
|
19
19
|
end
|
|
20
20
|
rescue LoadError
|
|
21
21
|
desc "Generate YARD Documentation"
|
|
22
|
-
task :
|
|
22
|
+
task doc: :environment do
|
|
23
23
|
abort "Please install the YARD gem to generate rdoc."
|
|
24
24
|
end
|
|
25
25
|
end
|
|
@@ -42,7 +42,7 @@ namespace :active_fedora do
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
desc "CI build"
|
|
45
|
-
task :
|
|
45
|
+
task ci: :environment do
|
|
46
46
|
Rake::Task['active_fedora:rubocop'].invoke unless ENV['NO_RUBOCOP']
|
|
47
47
|
ENV['environment'] = "test"
|
|
48
48
|
with_test_server do
|
|
@@ -51,7 +51,7 @@ namespace :active_fedora do
|
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
desc "Execute specs with coverage"
|
|
54
|
-
task :
|
|
54
|
+
task coverage: :environment do
|
|
55
55
|
# Put spec opts in a file named .rspec in root
|
|
56
56
|
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
|
|
57
57
|
ENV['COVERAGE'] = 'true' unless ruby_engine == 'jruby'
|
|
@@ -59,7 +59,7 @@ namespace :active_fedora do
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
desc "Execute specs with coverage"
|
|
62
|
-
task :
|
|
62
|
+
task spec: :environment do
|
|
63
63
|
with_test_server do
|
|
64
64
|
Rake::Task["active_fedora:rspec"].invoke
|
|
65
65
|
end
|