speedy-af 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rubocop.yml +178 -0
- data/.rubocop_todo.yml +55 -0
- data/.travis.yml +15 -0
- data/CONTRIBUTING.md +113 -0
- data/Gemfile +5 -0
- data/LICENSE +12 -0
- data/README.md +100 -0
- data/Rakefile +46 -0
- data/lib/speedy-af.rb +1 -0
- data/lib/speedy_af.rb +7 -0
- data/lib/speedy_af/base.rb +214 -0
- data/lib/speedy_af/indexed_content.rb +34 -0
- data/lib/speedy_af/ordered_aggregation_index.rb +26 -0
- data/lib/speedy_af/version.rb +3 -0
- data/spec/fixture_classes.rb +48 -0
- data/spec/integration/base_spec.rb +169 -0
- data/spec/integration/ordered_aggregation_index_spec.rb +40 -0
- data/spec/spec_helper.rb +36 -0
- data/speedy-af.gemspec +39 -0
- metadata +234 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SpeedyAF::OrderedAggregationIndex do
|
4
|
+
before { load_fixture_classes! }
|
5
|
+
after { unload_fixture_classes! }
|
6
|
+
|
7
|
+
describe 'method injection' do
|
8
|
+
subject(:book) { Book.new }
|
9
|
+
|
10
|
+
it 'respond to index methods' do
|
11
|
+
expect(book).to respond_to(:indexed_chapter_ids)
|
12
|
+
expect(book).to respond_to(:indexed_chapters)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'indexing' do
|
17
|
+
subject(:book) { Book.new }
|
18
|
+
|
19
|
+
it 'empty' do
|
20
|
+
expect(book.indexed_chapter_ids).to be_empty
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'with chapters' do
|
24
|
+
let!(:chapters) { 1.upto(5).map { Chapter.create } }
|
25
|
+
|
26
|
+
before do
|
27
|
+
book.ordered_chapters = chapters.reverse
|
28
|
+
book.save
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'loads indexed chapter IDs' do
|
32
|
+
expect(book.indexed_chapter_ids).to eq(book.ordered_chapter_ids)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'loads indexed chapters' do
|
36
|
+
expect(book.indexed_chapters.to_a).to eq(book.ordered_chapters.to_a)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
ENV['environment'] ||= 'test'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require 'simplecov'
|
5
|
+
require 'coveralls'
|
6
|
+
Coveralls.wear! if ENV['TRAVIS']
|
7
|
+
|
8
|
+
SimpleCov.start do
|
9
|
+
add_filter '/spec/'
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'active-fedora'
|
13
|
+
require 'speedy_af'
|
14
|
+
require 'rspec'
|
15
|
+
require 'rspec/its'
|
16
|
+
|
17
|
+
require 'active_fedora/cleaner'
|
18
|
+
RSpec.configure do |config|
|
19
|
+
# Stub out test stuff.
|
20
|
+
config.before(:each) do
|
21
|
+
begin
|
22
|
+
ActiveFedora::Cleaner.clean!
|
23
|
+
rescue Faraday::ConnectionFailed, RSolr::Error::ConnectionRefused => e
|
24
|
+
$stderr.puts e.message
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def load_fixture_classes!
|
30
|
+
load File.expand_path('../fixture_classes.rb', __FILE__)
|
31
|
+
end
|
32
|
+
|
33
|
+
def unload_fixture_classes!
|
34
|
+
Object.send(:remove_const, :SpeedySpecs)
|
35
|
+
SpeedyAF::Proxy.constants.each { |proxy| SpeedyAF::Proxy.send(:remove_const, proxy) }
|
36
|
+
end
|
data/speedy-af.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path('../lib/speedy_af/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'speedy-af'
|
5
|
+
s.version = SpeedyAF::VERSION
|
6
|
+
|
7
|
+
if s.respond_to? :required_rubygems_version=
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0')
|
9
|
+
end
|
10
|
+
s.authors = ['Michael B. Klein']
|
11
|
+
s.description = 'Performance enhancements for ActiveFedora'
|
12
|
+
s.email = 'mbklein@gmail.com'
|
13
|
+
s.extra_rdoc_files = [
|
14
|
+
'CONTRIBUTING.md',
|
15
|
+
'README.md',
|
16
|
+
'LICENSE'
|
17
|
+
]
|
18
|
+
s.homepage = 'http://github.com/samvera-labs/speedy_af'
|
19
|
+
s.licenses = 'APACHE2'
|
20
|
+
s.require_paths = ['lib']
|
21
|
+
s.rubygems_version = '1.5.2'
|
22
|
+
s.summary = 'Performance enhancements for ActiveFedora'
|
23
|
+
|
24
|
+
s.files = `git ls-files`.split("\n")
|
25
|
+
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
26
|
+
|
27
|
+
s.add_dependency 'active-fedora', ['>= 11.0.0']
|
28
|
+
s.add_dependency 'activesupport'
|
29
|
+
s.add_development_dependency 'solr_wrapper', '~> 0.15'
|
30
|
+
s.add_development_dependency 'fcrepo_wrapper', '~> 0.2'
|
31
|
+
s.add_development_dependency 'simplecov'
|
32
|
+
s.add_development_dependency 'coveralls'
|
33
|
+
s.add_development_dependency 'rspec', '~> 3.0'
|
34
|
+
s.add_development_dependency 'rspec-its'
|
35
|
+
s.add_development_dependency 'rake'
|
36
|
+
s.add_development_dependency 'rdoc'
|
37
|
+
s.add_development_dependency 'rubocop', '~> 0.42.0'
|
38
|
+
s.add_development_dependency 'rubocop-rspec', '~> 1.8.0'
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,234 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: speedy-af
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael B. Klein
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-06-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: active-fedora
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 11.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 11.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: solr_wrapper
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.15'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.15'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: fcrepo_wrapper
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.2'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.2'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: coveralls
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec-its
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rake
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rdoc
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 0.42.0
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 0.42.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rubocop-rspec
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 1.8.0
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 1.8.0
|
181
|
+
description: Performance enhancements for ActiveFedora
|
182
|
+
email: mbklein@gmail.com
|
183
|
+
executables: []
|
184
|
+
extensions: []
|
185
|
+
extra_rdoc_files:
|
186
|
+
- CONTRIBUTING.md
|
187
|
+
- README.md
|
188
|
+
- LICENSE
|
189
|
+
files:
|
190
|
+
- ".gitignore"
|
191
|
+
- ".rubocop.yml"
|
192
|
+
- ".rubocop_todo.yml"
|
193
|
+
- ".travis.yml"
|
194
|
+
- CONTRIBUTING.md
|
195
|
+
- Gemfile
|
196
|
+
- LICENSE
|
197
|
+
- README.md
|
198
|
+
- Rakefile
|
199
|
+
- lib/speedy-af.rb
|
200
|
+
- lib/speedy_af.rb
|
201
|
+
- lib/speedy_af/base.rb
|
202
|
+
- lib/speedy_af/indexed_content.rb
|
203
|
+
- lib/speedy_af/ordered_aggregation_index.rb
|
204
|
+
- lib/speedy_af/version.rb
|
205
|
+
- spec/fixture_classes.rb
|
206
|
+
- spec/integration/base_spec.rb
|
207
|
+
- spec/integration/ordered_aggregation_index_spec.rb
|
208
|
+
- spec/spec_helper.rb
|
209
|
+
- speedy-af.gemspec
|
210
|
+
homepage: http://github.com/samvera-labs/speedy_af
|
211
|
+
licenses:
|
212
|
+
- APACHE2
|
213
|
+
metadata: {}
|
214
|
+
post_install_message:
|
215
|
+
rdoc_options: []
|
216
|
+
require_paths:
|
217
|
+
- lib
|
218
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
223
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
224
|
+
requirements:
|
225
|
+
- - ">="
|
226
|
+
- !ruby/object:Gem::Version
|
227
|
+
version: '0'
|
228
|
+
requirements: []
|
229
|
+
rubyforge_project:
|
230
|
+
rubygems_version: 2.5.1
|
231
|
+
signing_key:
|
232
|
+
specification_version: 4
|
233
|
+
summary: Performance enhancements for ActiveFedora
|
234
|
+
test_files: []
|