speedy-af 0.1.3 → 0.2.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 +47 -0
- data/.rubocop.yml +4 -176
- data/.rubocop_todo.yml +47 -40
- data/Gemfile +3 -0
- data/README.md +1 -1
- data/Rakefile +1 -0
- data/lib/speedy-af.rb +1 -0
- data/lib/speedy_af/base.rb +74 -81
- data/lib/speedy_af/indexed_content.rb +5 -4
- data/lib/speedy_af/ordered_aggregation_index.rb +1 -0
- data/lib/speedy_af/version.rb +2 -1
- data/lib/speedy_af.rb +1 -0
- data/spec/fixture_classes.rb +1 -0
- data/spec/integration/base_spec.rb +12 -9
- data/spec/integration/ordered_aggregation_index_spec.rb +1 -0
- data/spec/spec_helper.rb +7 -6
- data/speedy-af.gemspec +8 -9
- metadata +35 -29
- data/.travis.yml +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ed5f4d42ff93fc2fb41bbc8096025cd873767f3f01e9182ea87f309dbb7f6b0
|
4
|
+
data.tar.gz: def94b1cb7b8f0dd8e8241d4e8dba0b1f80e849cb10ebe0346d788f18bf8b3b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2607efe588e3b14c24712c27cfa847be6eec358abc77adbe0e47d0f68ac93e7a551184c4ac9b5486e3ba75b41989b85cf2d3a865fe00c8a0aed1460abb1b1839
|
7
|
+
data.tar.gz: e79f5bb789b2527dbd728eae084ba42600d637a8284818eedbed2a7c2af2d1a7068b50830c35b6092d9f911c25df31dc49e2da2a60e0a934851200f050306b69
|
@@ -0,0 +1,47 @@
|
|
1
|
+
version: 2.1
|
2
|
+
orbs:
|
3
|
+
samvera: samvera/circleci-orb@1
|
4
|
+
jobs:
|
5
|
+
bundle_and_test:
|
6
|
+
parameters:
|
7
|
+
ruby_version:
|
8
|
+
type: string
|
9
|
+
rails_version:
|
10
|
+
type: string
|
11
|
+
bundler_version:
|
12
|
+
type: string
|
13
|
+
default: 2.0.2
|
14
|
+
ffmpeg_version:
|
15
|
+
type: string
|
16
|
+
default: 4.1.4
|
17
|
+
executor:
|
18
|
+
name: 'samvera/ruby_fcrepo_solr'
|
19
|
+
ruby_version: << parameters.ruby_version >>
|
20
|
+
solr_version: 7-alpine
|
21
|
+
environment:
|
22
|
+
RAILS_VERSION: << parameters.rails_version >>
|
23
|
+
working_directory: ~/project
|
24
|
+
steps:
|
25
|
+
- samvera/cached_checkout
|
26
|
+
|
27
|
+
- samvera/bundle:
|
28
|
+
ruby_version: << parameters.ruby_version >>
|
29
|
+
bundler_version: << parameters.bundler_version >>
|
30
|
+
|
31
|
+
- samvera/rubocop
|
32
|
+
|
33
|
+
- samvera/install_solr_core
|
34
|
+
|
35
|
+
- samvera/parallel_rspec
|
36
|
+
|
37
|
+
workflows:
|
38
|
+
ci:
|
39
|
+
jobs:
|
40
|
+
- bundle_and_test:
|
41
|
+
name: "ruby2-7_rails6-0"
|
42
|
+
ruby_version: "2.7.5"
|
43
|
+
rails_version: "6.0.4.4"
|
44
|
+
- bundle_and_test:
|
45
|
+
name: "ruby2-7_rails5-2"
|
46
|
+
ruby_version: "2.7.5"
|
47
|
+
rails_version: "5.2.6"
|
data/.rubocop.yml
CHANGED
@@ -1,178 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
inherit_from:
|
4
|
-
- .rubocop_todo.yml
|
5
|
-
|
6
|
-
AllCops:
|
7
|
-
TargetRubyVersion: 2.2
|
8
|
-
DisplayCopNames: true
|
9
|
-
Include:
|
10
|
-
- '**/Rakefile'
|
11
|
-
Exclude:
|
12
|
-
- 'script/**/*'
|
13
|
-
- 'vendor/**/*'
|
14
|
-
|
15
|
-
Lint/HandleExceptions:
|
16
|
-
Exclude:
|
17
|
-
- 'spec/unit/**/*'
|
18
|
-
|
19
|
-
Lint/AssignmentInCondition:
|
20
|
-
Enabled: false
|
21
|
-
|
22
|
-
Metrics/LineLength:
|
23
|
-
Enabled: false
|
24
|
-
|
25
|
-
Metrics/AbcSize:
|
26
|
-
Enabled: false
|
27
|
-
|
28
|
-
Metrics/BlockNesting:
|
29
|
-
Exclude:
|
30
|
-
|
31
|
-
Metrics/CyclomaticComplexity:
|
32
|
-
Max: 7
|
33
|
-
Severity: warning
|
34
|
-
Exclude:
|
35
|
-
|
36
|
-
Metrics/PerceivedComplexity:
|
37
|
-
Exclude:
|
38
|
-
|
39
|
-
Metrics/ModuleLength:
|
40
|
-
Exclude:
|
41
|
-
|
42
|
-
Metrics/ClassLength:
|
43
|
-
Enabled: false
|
44
|
-
|
45
|
-
Metrics/MethodLength:
|
46
|
-
Enabled: false
|
47
|
-
|
48
|
-
Style/MethodName:
|
49
|
-
Exclude:
|
50
|
-
|
51
|
-
Style/AndOr:
|
52
|
-
Exclude:
|
53
|
-
|
54
|
-
Style/AccessorMethodName:
|
55
|
-
Exclude:
|
56
|
-
|
57
|
-
Style/PredicateName:
|
58
|
-
Exclude:
|
59
|
-
|
60
|
-
Style/GuardClause:
|
61
|
-
Exclude:
|
62
|
-
|
63
|
-
Style/TrivialAccessors:
|
64
|
-
Exclude:
|
65
|
-
|
66
|
-
Style/EachWithObject:
|
67
|
-
Exclude:
|
68
|
-
|
69
|
-
Style/CaseEquality:
|
70
|
-
Exclude:
|
71
|
-
|
72
|
-
Style/BlockDelimiters:
|
73
|
-
Exclude:
|
74
|
-
- 'spec/**/*'
|
75
|
-
|
76
|
-
Style/BlockEndNewline:
|
77
|
-
Exclude:
|
78
|
-
- 'spec/**/*'
|
79
|
-
|
80
|
-
Style/MultilineBlockLayout:
|
81
|
-
Exclude:
|
82
|
-
- 'spec/**/*'
|
83
|
-
|
84
|
-
Style/Semicolon:
|
85
|
-
Exclude:
|
86
|
-
- 'spec/**/*'
|
1
|
+
inherit_from: .rubocop_todo.yml
|
87
2
|
|
88
|
-
|
89
|
-
Exclude:
|
90
|
-
- 'spec/**/*'
|
91
|
-
|
92
|
-
Style/IndentationConsistency:
|
93
|
-
EnforcedStyle: rails
|
94
|
-
|
95
|
-
Style/CollectionMethods:
|
96
|
-
PreferredMethods:
|
97
|
-
collect: 'map'
|
98
|
-
collect!: 'map!'
|
99
|
-
inject: 'reduce'
|
100
|
-
detect: 'find'
|
101
|
-
find_all: 'select'
|
102
|
-
|
103
|
-
Style/WordArray:
|
104
|
-
Enabled: false
|
105
|
-
|
106
|
-
Style/RegexpLiteral:
|
107
|
-
Enabled: false
|
108
|
-
|
109
|
-
Style/StringLiterals:
|
110
|
-
Enabled: false
|
111
|
-
|
112
|
-
Style/ClassAndModuleChildren:
|
113
|
-
Enabled: false
|
114
|
-
|
115
|
-
Style/Documentation:
|
116
|
-
Enabled: false
|
117
|
-
|
118
|
-
Style/GlobalVars:
|
119
|
-
Exclude:
|
120
|
-
- 'spec/**/*'
|
121
|
-
|
122
|
-
Style/SingleLineBlockParams:
|
123
|
-
Enabled: false
|
124
|
-
|
125
|
-
Style/ClassVars:
|
126
|
-
Exclude:
|
127
|
-
|
128
|
-
Style/SignalException:
|
129
|
-
Enabled: false
|
130
|
-
|
131
|
-
Style/FileName:
|
132
|
-
Exclude:
|
133
|
-
- 'lib/speedy-af.rb'
|
134
|
-
|
135
|
-
Style/ZeroLengthPredicate:
|
136
|
-
Exclude:
|
137
|
-
|
138
|
-
Performance/RedundantMerge:
|
139
|
-
Exclude:
|
140
|
-
|
141
|
-
Rails:
|
142
|
-
Enabled: true
|
143
|
-
|
144
|
-
Rails/Output:
|
145
|
-
Exclude:
|
146
|
-
|
147
|
-
Rails/Date:
|
148
|
-
Enabled: false
|
149
|
-
|
150
|
-
Rails/TimeZone:
|
151
|
-
Enabled: false
|
152
|
-
|
153
|
-
RSpec/AnyInstance:
|
154
|
-
Enabled: false
|
155
|
-
|
156
|
-
RSpec/ExampleWording:
|
157
|
-
CustomTransform:
|
158
|
-
be: is
|
159
|
-
have: has
|
160
|
-
not: does not
|
161
|
-
NOT: does NOT
|
162
|
-
IgnoredWords:
|
163
|
-
- only
|
164
|
-
|
165
|
-
RSpec/FilePath:
|
166
|
-
Enabled: false
|
167
|
-
|
168
|
-
RSpec/InstanceVariable:
|
169
|
-
Enabled: false
|
170
|
-
|
171
|
-
RSpec/DescribeClass:
|
172
|
-
Exclude:
|
173
|
-
|
174
|
-
RSpec/DescribedClass:
|
175
|
-
Exclude:
|
3
|
+
require: rubocop-rspec
|
176
4
|
|
177
|
-
|
178
|
-
|
5
|
+
inherit_gem:
|
6
|
+
bixby: bixby_default.yml
|
data/.rubocop_todo.yml
CHANGED
@@ -1,55 +1,62 @@
|
|
1
|
-
require: rubocop-rspec
|
2
|
-
|
3
1
|
# This configuration was generated by
|
4
2
|
# `rubocop --auto-gen-config`
|
5
|
-
# on
|
3
|
+
# on 2022-02-16 16:30:36 -0500 using RuboCop version 0.85.1.
|
6
4
|
# The point is for the user to remove these configuration records
|
7
5
|
# one by one as the offenses are removed from the code base.
|
8
6
|
# Note that changes in the inspected code, or installation of new
|
9
7
|
# versions of RuboCop, may require this file to be generated again.
|
10
8
|
|
11
|
-
# Offense count:
|
12
|
-
# Configuration parameters:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
# Offense count: 40
|
17
|
-
RSpec/LeadingSubject:
|
18
|
-
Enabled: false
|
9
|
+
# Offense count: 5
|
10
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
11
|
+
# ExcludedMethods: refine
|
12
|
+
Metrics/BlockLength:
|
13
|
+
Max: 143
|
19
14
|
|
20
|
-
# Offense count:
|
21
|
-
|
22
|
-
|
23
|
-
|
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'
|
15
|
+
# Offense count: 1
|
16
|
+
# Configuration parameters: CountComments.
|
17
|
+
Metrics/ClassLength:
|
18
|
+
Max: 165
|
29
19
|
|
30
20
|
# Offense count: 1
|
31
|
-
|
32
|
-
|
33
|
-
|
21
|
+
# Configuration parameters: IgnoredMethods.
|
22
|
+
Metrics/CyclomaticComplexity:
|
23
|
+
Max: 7
|
34
24
|
|
35
|
-
# Offense count:
|
36
|
-
# Configuration parameters:
|
37
|
-
|
38
|
-
|
39
|
-
Enabled: false
|
25
|
+
# Offense count: 1
|
26
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
27
|
+
Metrics/MethodLength:
|
28
|
+
Max: 15
|
40
29
|
|
41
|
-
# Offense count:
|
42
|
-
|
43
|
-
|
30
|
+
# Offense count: 1
|
31
|
+
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
32
|
+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
33
|
+
Naming/FileName:
|
34
|
+
Exclude:
|
35
|
+
- '**/Gemfile'
|
36
|
+
- '**/*.rake'
|
37
|
+
- 'Capfile'
|
38
|
+
- 'config/deploy/*'
|
39
|
+
- 'lib/speedy-af.rb'
|
44
40
|
|
45
|
-
# Offense count:
|
46
|
-
# Configuration parameters:
|
47
|
-
RSpec/
|
48
|
-
|
41
|
+
# Offense count: 2
|
42
|
+
# Configuration parameters: Max.
|
43
|
+
RSpec/ExampleLength:
|
44
|
+
Exclude:
|
45
|
+
- 'spec/integration/base_spec.rb'
|
49
46
|
|
50
|
-
# Offense count:
|
51
|
-
|
52
|
-
|
47
|
+
# Offense count: 3
|
48
|
+
# Cop supports --auto-correct.
|
49
|
+
# Configuration parameters: Include.
|
50
|
+
# Include: **/Rakefile, **/*.rake
|
51
|
+
Rails/RakeEnvironment:
|
52
|
+
Exclude:
|
53
|
+
- 'lib/capistrano/tasks/**/*.rake'
|
54
|
+
- 'Rakefile'
|
53
55
|
|
54
|
-
|
55
|
-
|
56
|
+
# Offense count: 1
|
57
|
+
# Cop supports --auto-correct.
|
58
|
+
# Configuration parameters: EnforcedStyle.
|
59
|
+
# SupportedStyles: strict, flexible
|
60
|
+
Rails/TimeZone:
|
61
|
+
Exclude:
|
62
|
+
- 'lib/speedy_af/base.rb'
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Code: [](http://badge.fury.io/rb/speedy_af)
|
2
|
-
[](https://circleci.com/gh/samvera-labs/speedy_af)
|
3
3
|
[](https://coveralls.io/github/samvera-labs/speedy_af?branch=master)
|
4
4
|
[](https://codeclimate.com/github/samvera-labs/speedy_af)
|
5
5
|
[](https://gemnasium.com/samvera-labs/speedy_af)
|
data/Rakefile
CHANGED
data/lib/speedy-af.rb
CHANGED
data/lib/speedy_af/base.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'ostruct'
|
2
3
|
|
3
4
|
module SpeedyAF
|
@@ -120,95 +121,87 @@ module SpeedyAF
|
|
120
121
|
|
121
122
|
protected
|
122
123
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
124
|
+
def reflection_for(sym)
|
125
|
+
return nil unless model.respond_to?(:reflections)
|
126
|
+
reflection_name = sym.to_s.sub(/_id(s?)$/, '\1').to_sym
|
127
|
+
model.reflections[reflection_name] || model.reflections[:"#{reflection_name.to_s.singularize}_proxies"]
|
128
|
+
end
|
128
129
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
130
|
+
def parse_solr_field(k, v)
|
131
|
+
# :nocov:
|
132
|
+
transforms = {
|
133
|
+
'dt' => ->(m) { Time.parse(m) },
|
134
|
+
'b' => ->(m) { m },
|
135
|
+
'db' => ->(m) { m.to_f },
|
136
|
+
'f' => ->(m) { m.to_f },
|
137
|
+
'i' => ->(m) { m.to_i },
|
138
|
+
'l' => ->(m) { m.to_i },
|
139
|
+
nil => ->(m) { m }
|
140
|
+
}
|
141
|
+
# :nocov:
|
142
|
+
attr_name, type, _stored, _indexed, _multi = k.scan(/^(.+)_(.+)(s)(i?)(m?)$/).first
|
143
|
+
return [k, v] if attr_name.nil?
|
144
|
+
value = Array(v).map { |m| transforms.fetch(type, transforms[nil]).call(m) }
|
145
|
+
value = value.first unless @model.respond_to?(:properties) && multiple?(@model.properties[attr_name])
|
146
|
+
[attr_name, value]
|
147
|
+
end
|
147
148
|
|
148
|
-
|
149
|
-
|
150
|
-
|
149
|
+
def multiple?(prop)
|
150
|
+
prop.present? && prop.respond_to?(:multiple?) && prop.multiple?
|
151
|
+
end
|
151
152
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
end
|
162
|
-
if reflection.is_a?(ActiveFedora::Reflection::HasSubresourceReflection)
|
163
|
-
return load_subresource_content(reflection)
|
164
|
-
end
|
165
|
-
# :nocov:
|
166
|
-
raise NotAvailable, "`#{reflection.name}' cannot be quick-loaded. Falling back to model."
|
167
|
-
# :nocov:
|
168
|
-
end
|
153
|
+
def load_from_reflection(reflection, ids_only = false)
|
154
|
+
return load_through_reflection(reflection, ids_only) if reflection.options.key?(:through)
|
155
|
+
return load_belongs_to_reflection(reflection.predicate_for_solr, ids_only) if reflection.belongs_to? && reflection.respond_to?(:predicate_for_solr)
|
156
|
+
return load_has_many_reflection(reflection.predicate_for_solr, ids_only) if reflection.has_many? && reflection.respond_to?(:predicate_for_solr)
|
157
|
+
return load_subresource_content(reflection) if reflection.is_a?(ActiveFedora::Reflection::HasSubresourceReflection)
|
158
|
+
# :nocov:
|
159
|
+
raise NotAvailable, "`#{reflection.name}' cannot be quick-loaded. Falling back to model."
|
160
|
+
# :nocov:
|
161
|
+
end
|
169
162
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
163
|
+
def load_through_reflection(reflection, ids_only = false)
|
164
|
+
ids = case reflection.options[:through]
|
165
|
+
when 'ActiveFedora::Aggregation::Proxy' then proxy_ids(reflection)
|
166
|
+
else subresource_ids(reflection)
|
167
|
+
end
|
168
|
+
return ids if ids_only
|
169
|
+
query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids(ids)
|
170
|
+
Base.where(query, order: -> { ids })
|
171
|
+
end
|
179
172
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
173
|
+
def proxy_ids(reflection)
|
174
|
+
docs = ActiveFedora::SolrService.query %(id:#{id}/#{reflection.name}/*), rows: SOLR_ALL
|
175
|
+
docs.collect { |doc| doc['proxyFor_ssim'] }.flatten
|
176
|
+
end
|
184
177
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
178
|
+
def subresource_ids(reflection)
|
179
|
+
subresource = reflection.options[:through]
|
180
|
+
docs = ActiveFedora::SolrService.query %(id:"#{id}/#{subresource}"), rows: 1
|
181
|
+
return [] if docs.empty?
|
182
|
+
ids = docs.first['ordered_targets_ssim']
|
183
|
+
return [] if ids.nil?
|
184
|
+
ids
|
185
|
+
end
|
193
186
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
187
|
+
def load_belongs_to_reflection(predicate, ids_only = false)
|
188
|
+
id = @attrs[predicate.to_sym]
|
189
|
+
return id if ids_only
|
190
|
+
Base.find(id)
|
191
|
+
end
|
199
192
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
193
|
+
def load_has_many_reflection(predicate, ids_only = false)
|
194
|
+
query = %(#{predicate}_ssim:#{id})
|
195
|
+
return Base.where(query) unless ids_only
|
196
|
+
docs = ActiveFedora::SolrService.query query, rows: SOLR_ALL
|
197
|
+
docs.collect { |doc| doc['id'] }
|
198
|
+
end
|
206
199
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
200
|
+
def load_subresource_content(reflection)
|
201
|
+
subresource = reflection.name
|
202
|
+
docs = ActiveFedora::SolrService.query(%(id:"#{id}/#{subresource}"), rows: 1)
|
203
|
+
raise NotAvailable, "`#{subresource}' is not indexed" if docs.empty? || !docs.first.key?('has_model_ssim')
|
204
|
+
@attrs[subresource] = Base.from(docs).first
|
205
|
+
end
|
213
206
|
end
|
214
207
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module SpeedyAF
|
2
3
|
module IndexedContent
|
3
4
|
extend ActiveSupport::Concern
|
@@ -16,7 +17,7 @@ module SpeedyAF
|
|
16
17
|
doc[:mime_type_ss] = mime_type
|
17
18
|
doc[:original_name_ss] = original_name
|
18
19
|
doc[:size_is] = content.present? ? content.size : 0
|
19
|
-
doc[:'empty?_bs'] = content.
|
20
|
+
doc[:'empty?_bs'] = content.blank?
|
20
21
|
doc[:content_ss] = content if index_content?
|
21
22
|
end
|
22
23
|
end
|
@@ -27,8 +28,8 @@ module SpeedyAF
|
|
27
28
|
|
28
29
|
protected
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
def index_content?
|
32
|
+
has_content? && mime_type =~ /(^text\/)|([\/\+]xml$)/ && size < MAX_CONTENT_SIZE && content !~ /\x00/
|
33
|
+
end
|
33
34
|
end
|
34
35
|
end
|
data/lib/speedy_af/version.rb
CHANGED
data/lib/speedy_af.rb
CHANGED
data/spec/fixture_classes.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
require 'rdf/vocab/dc'
|
3
4
|
|
@@ -7,27 +8,29 @@ describe SpeedyAF::Base do
|
|
7
8
|
|
8
9
|
let!(:library) { Library.create }
|
9
10
|
let!(:book) { Book.new title: 'Ordered Things', publisher: 'ActiveFedora Performance LLC', library: library }
|
10
|
-
let!(:chapters)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
let!(:chapters) do
|
12
|
+
[
|
13
|
+
Chapter.create(title: 'Chapter 3', contributor: ['Hopper', 'Lovelace', 'Johnson']),
|
14
|
+
Chapter.create(title: 'Chapter 1', contributor: ['Rogers', 'Johnson', 'Stark', 'Romanoff']),
|
15
|
+
Chapter.create(title: 'Chapter 2', contributor: ['Alice', 'Bob', 'Charlie'])
|
16
|
+
]
|
17
|
+
end
|
18
|
+
let!(:indexed_content) do
|
16
19
|
<<-IPSUM
|
17
20
|
Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering
|
18
21
|
animata corpora quaeritis. Summus brains sit, morbo vel maleficia? De apocalypsi gorger
|
19
22
|
omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil
|
20
23
|
stalking monstra adventus resi dentevil vultus comedat cerebella viventium.
|
21
24
|
IPSUM
|
22
|
-
|
23
|
-
let!(:unindexed_content)
|
25
|
+
end
|
26
|
+
let!(:unindexed_content) do
|
24
27
|
<<-IPSUM
|
25
28
|
Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos
|
26
29
|
flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum
|
27
30
|
defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror.
|
28
31
|
Nigh tofth eliv ingdead.
|
29
32
|
IPSUM
|
30
|
-
|
33
|
+
end
|
31
34
|
let(:book_presenter) { described_class.find(book.id) }
|
32
35
|
|
33
36
|
context 'lightweight presenter' do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
ENV['environment'] ||= 'test'
|
2
3
|
require 'bundler/setup'
|
3
4
|
|
@@ -9,6 +10,8 @@ SimpleCov.start do
|
|
9
10
|
add_filter '/spec/'
|
10
11
|
end
|
11
12
|
|
13
|
+
require 'byebug'
|
14
|
+
require 'rsolr'
|
12
15
|
require 'active-fedora'
|
13
16
|
require 'speedy_af'
|
14
17
|
require 'rspec'
|
@@ -17,12 +20,10 @@ require 'rspec/its'
|
|
17
20
|
require 'active_fedora/cleaner'
|
18
21
|
RSpec.configure do |config|
|
19
22
|
# Stub out test stuff.
|
20
|
-
config.before
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
$stderr.puts e.message
|
25
|
-
end
|
23
|
+
config.before do
|
24
|
+
ActiveFedora::Cleaner.clean!
|
25
|
+
rescue Faraday::ConnectionFailed, RSolr::Error::ConnectionRefused => e
|
26
|
+
$stderr.puts e.message
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
data/speedy-af.gemspec
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require File.expand_path('../lib/speedy_af/version', __FILE__)
|
2
3
|
|
3
4
|
Gem::Specification.new do |s|
|
4
5
|
s.name = 'speedy-af'
|
5
6
|
s.version = SpeedyAF::VERSION
|
6
7
|
|
7
|
-
if s.respond_to? :required_rubygems_version=
|
8
|
-
s.required_rubygems_version = Gem::Requirement.new('>= 0')
|
9
|
-
end
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
10
9
|
s.authors = ['Michael B. Klein']
|
11
10
|
s.description = 'Performance enhancements for ActiveFedora'
|
12
11
|
s.email = 'mbklein@gmail.com'
|
@@ -24,16 +23,16 @@ Gem::Specification.new do |s|
|
|
24
23
|
s.files = `git ls-files`.split("\n")
|
25
24
|
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
26
25
|
|
27
|
-
s.add_dependency 'active-fedora',
|
28
|
-
s.add_dependency 'activesupport', '
|
29
|
-
s.add_development_dependency 'solr_wrapper'
|
30
|
-
s.add_development_dependency 'fcrepo_wrapper'
|
26
|
+
s.add_dependency 'active-fedora', '>= 11.0.0'
|
27
|
+
s.add_dependency 'activesupport', '> 5.2', '< 6.1'
|
28
|
+
s.add_development_dependency 'solr_wrapper'
|
29
|
+
s.add_development_dependency 'fcrepo_wrapper'
|
31
30
|
s.add_development_dependency 'simplecov'
|
32
31
|
s.add_development_dependency 'coveralls'
|
33
32
|
s.add_development_dependency 'rspec', '~> 3.0'
|
34
33
|
s.add_development_dependency 'rspec-its'
|
34
|
+
s.add_development_dependency 'rspec_junit_formatter'
|
35
35
|
s.add_development_dependency 'rake'
|
36
36
|
s.add_development_dependency 'rdoc'
|
37
|
-
s.add_development_dependency '
|
38
|
-
s.add_development_dependency 'rubocop-rspec', '~> 1.8.0'
|
37
|
+
s.add_development_dependency 'bixby'
|
39
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: speedy-af
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael B. Klein
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active-fedora
|
@@ -28,44 +28,50 @@ dependencies:
|
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
+
- - ">"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.2'
|
31
34
|
- - "<"
|
32
35
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
36
|
+
version: '6.1'
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
41
|
+
- - ">"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '5.2'
|
38
44
|
- - "<"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
46
|
+
version: '6.1'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: solr_wrapper
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - "
|
51
|
+
- - ">="
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0
|
53
|
+
version: '0'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- - "
|
58
|
+
- - ">="
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0
|
60
|
+
version: '0'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: fcrepo_wrapper
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
|
-
- - "
|
65
|
+
- - ">="
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0
|
67
|
+
version: '0'
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
|
-
- - "
|
72
|
+
- - ">="
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0
|
74
|
+
version: '0'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: simplecov
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,7 +129,7 @@ dependencies:
|
|
123
129
|
- !ruby/object:Gem::Version
|
124
130
|
version: '0'
|
125
131
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
132
|
+
name: rspec_junit_formatter
|
127
133
|
requirement: !ruby/object:Gem::Requirement
|
128
134
|
requirements:
|
129
135
|
- - ">="
|
@@ -137,7 +143,7 @@ dependencies:
|
|
137
143
|
- !ruby/object:Gem::Version
|
138
144
|
version: '0'
|
139
145
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
146
|
+
name: rake
|
141
147
|
requirement: !ruby/object:Gem::Requirement
|
142
148
|
requirements:
|
143
149
|
- - ">="
|
@@ -151,33 +157,33 @@ dependencies:
|
|
151
157
|
- !ruby/object:Gem::Version
|
152
158
|
version: '0'
|
153
159
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
160
|
+
name: rdoc
|
155
161
|
requirement: !ruby/object:Gem::Requirement
|
156
162
|
requirements:
|
157
|
-
- - "
|
163
|
+
- - ">="
|
158
164
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0
|
165
|
+
version: '0'
|
160
166
|
type: :development
|
161
167
|
prerelease: false
|
162
168
|
version_requirements: !ruby/object:Gem::Requirement
|
163
169
|
requirements:
|
164
|
-
- - "
|
170
|
+
- - ">="
|
165
171
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0
|
172
|
+
version: '0'
|
167
173
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
174
|
+
name: bixby
|
169
175
|
requirement: !ruby/object:Gem::Requirement
|
170
176
|
requirements:
|
171
|
-
- - "
|
177
|
+
- - ">="
|
172
178
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
179
|
+
version: '0'
|
174
180
|
type: :development
|
175
181
|
prerelease: false
|
176
182
|
version_requirements: !ruby/object:Gem::Requirement
|
177
183
|
requirements:
|
178
|
-
- - "
|
184
|
+
- - ">="
|
179
185
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
186
|
+
version: '0'
|
181
187
|
description: Performance enhancements for ActiveFedora
|
182
188
|
email: mbklein@gmail.com
|
183
189
|
executables: []
|
@@ -187,10 +193,10 @@ extra_rdoc_files:
|
|
187
193
|
- README.md
|
188
194
|
- LICENSE
|
189
195
|
files:
|
196
|
+
- ".circleci/config.yml"
|
190
197
|
- ".gitignore"
|
191
198
|
- ".rubocop.yml"
|
192
199
|
- ".rubocop_todo.yml"
|
193
|
-
- ".travis.yml"
|
194
200
|
- CONTRIBUTING.md
|
195
201
|
- Gemfile
|
196
202
|
- LICENSE
|
@@ -211,7 +217,7 @@ homepage: http://github.com/samvera-labs/speedy_af
|
|
211
217
|
licenses:
|
212
218
|
- APACHE2
|
213
219
|
metadata: {}
|
214
|
-
post_install_message:
|
220
|
+
post_install_message:
|
215
221
|
rdoc_options: []
|
216
222
|
require_paths:
|
217
223
|
- lib
|
@@ -226,8 +232,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
232
|
- !ruby/object:Gem::Version
|
227
233
|
version: '0'
|
228
234
|
requirements: []
|
229
|
-
rubygems_version: 3.
|
230
|
-
signing_key:
|
235
|
+
rubygems_version: 3.1.6
|
236
|
+
signing_key:
|
231
237
|
specification_version: 4
|
232
238
|
summary: Performance enhancements for ActiveFedora
|
233
239
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
sudo: false
|
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"
|
10
|
-
global_env:
|
11
|
-
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
12
|
-
before_install:
|
13
|
-
- gem update --system
|
14
|
-
before_script:
|
15
|
-
- jdk_switcher use oraclejdk8
|