picky 4.0.0pre1 → 4.0.0pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/aux/picky/cli.rb +6 -2
- data/lib/picky.rb +10 -8
- data/lib/picky/backends/backend.rb +37 -0
- data/lib/picky/backends/file.rb +0 -20
- data/lib/picky/backends/memory.rb +0 -29
- data/lib/picky/backends/redis.rb +74 -15
- data/lib/picky/backends/redis/list.rb +1 -1
- data/lib/picky/backends/sqlite.rb +0 -27
- data/lib/picky/bundle.rb +2 -2
- data/lib/picky/bundle_indexed.rb +1 -1
- data/lib/picky/bundle_indexing.rb +1 -1
- data/lib/picky/categories_indexed.rb +1 -11
- data/lib/picky/category.rb +4 -4
- data/lib/picky/category/location.rb +25 -0
- data/lib/picky/category_realtime.rb +4 -3
- data/lib/picky/console.rb +1 -1
- data/lib/picky/constants.rb +1 -1
- data/lib/picky/ext/maybe_compile.rb +2 -2
- data/lib/picky/extensions/object.rb +3 -2
- data/lib/picky/generators/aliases.rb +7 -2
- data/lib/picky/generators/partial/default.rb +1 -0
- data/lib/picky/generators/similarity/default.rb +1 -0
- data/lib/picky/generators/similarity/phonetic.rb +13 -2
- data/lib/picky/generators/strategy.rb +0 -2
- data/lib/picky/generators/weights/constant.rb +1 -2
- data/lib/picky/generators/weights/default.rb +1 -0
- data/lib/picky/generators/weights/dynamic.rb +1 -1
- data/lib/picky/generators/weights/logarithmic.rb +1 -1
- data/lib/picky/generators/weights/{runtime.rb → stub.rb} +1 -3
- data/lib/picky/index.rb +3 -3
- data/lib/picky/index_indexing.rb +0 -2
- data/lib/picky/index_realtime.rb +1 -1
- data/lib/picky/indexers/base.rb +7 -0
- data/lib/picky/indexers/parallel.rb +2 -4
- data/lib/picky/indexers/serial.rb +2 -0
- data/lib/picky/indexes_indexing.rb +1 -1
- data/lib/picky/interfaces/live_parameters/master_child.rb +175 -0
- data/lib/picky/interfaces/live_parameters/unicorn.rb +37 -0
- data/lib/picky/loader.rb +238 -259
- data/lib/picky/query/allocation.rb +19 -10
- data/lib/picky/query/combination.rb +7 -1
- data/lib/picky/query/combinations.rb +1 -6
- data/lib/picky/query/token.rb +26 -36
- data/lib/picky/results.rb +18 -17
- data/lib/picky/scheduler.rb +2 -1
- data/lib/picky/search.rb +1 -1
- data/lib/picky/sinatra.rb +6 -6
- data/lib/picky/statistics.rb +2 -0
- data/lib/picky/tokenizer.rb +8 -8
- data/lib/picky/wrappers/bundle/calculation.rb +4 -4
- data/lib/picky/wrappers/bundle/location.rb +1 -2
- data/lib/tasks/framework.rake +1 -1
- data/lib/tasks/statistics.rake +1 -1
- data/lib/tasks/try.rake +1 -1
- data/lib/tasks/try.rb +1 -1
- data/spec/aux/picky/cli_spec.rb +12 -12
- data/spec/ext/performant_spec.rb +16 -16
- data/spec/functional/backends/file_spec.rb +78 -7
- data/spec/functional/backends/memory_spec.rb +78 -7
- data/spec/functional/backends/redis_spec.rb +73 -13
- data/spec/functional/dynamic_weights_spec.rb +3 -4
- data/spec/functional/realtime_spec.rb +2 -2
- data/spec/functional/speed_spec.rb +2 -2
- data/spec/functional/terminate_early_spec.rb +3 -3
- data/spec/lib/analytics_spec.rb +1 -1
- data/spec/lib/analyzer_spec.rb +5 -3
- data/spec/lib/categories_indexed_spec.rb +38 -20
- data/spec/lib/category/location_spec.rb +30 -0
- data/spec/lib/character_substituters/west_european_spec.rb +1 -0
- data/spec/lib/extensions/hash_spec.rb +6 -5
- data/spec/lib/extensions/module_spec.rb +6 -6
- data/spec/lib/extensions/object_spec.rb +9 -8
- data/spec/lib/extensions/string_spec.rb +1 -1
- data/spec/lib/generators/similarity/phonetic_spec.rb +11 -0
- data/spec/lib/index_realtime_spec.rb +5 -5
- data/spec/lib/interfaces/{live_parameters_spec.rb → live_parameters/master_child_spec.rb} +26 -26
- data/spec/lib/interfaces/live_parameters/unicorn_spec.rb +160 -0
- data/spec/lib/loader_spec.rb +65 -25
- data/spec/lib/query/allocation_spec.rb +25 -22
- data/spec/lib/query/combinations_spec.rb +13 -36
- data/spec/lib/query/token_spec.rb +144 -131
- data/spec/lib/query/tokens_spec.rb +14 -0
- data/spec/lib/results_spec.rb +14 -8
- data/spec/lib/search_spec.rb +1 -1
- data/spec/lib/sinatra_spec.rb +8 -8
- metadata +28 -91
- data/lib/picky/adapters/rack.rb +0 -34
- data/lib/picky/adapters/rack/base.rb +0 -27
- data/lib/picky/adapters/rack/live_parameters.rb +0 -37
- data/lib/picky/adapters/rack/search.rb +0 -67
- data/lib/picky/application.rb +0 -268
- data/lib/picky/frontend_adapters/rack.rb +0 -161
- data/lib/picky/interfaces/live_parameters.rb +0 -187
- data/lib/picky/sources/base.rb +0 -92
- data/lib/picky/sources/couch.rb +0 -76
- data/lib/picky/sources/csv.rb +0 -83
- data/lib/picky/sources/db.rb +0 -189
- data/lib/picky/sources/delicious.rb +0 -63
- data/lib/picky/sources/mongo.rb +0 -80
- data/lib/picky/wrappers/category/location.rb +0 -38
- data/lib/tasks/routes.rake +0 -8
- data/spec/lib/adapters/rack/base_spec.rb +0 -24
- data/spec/lib/adapters/rack/live_parameters_spec.rb +0 -26
- data/spec/lib/adapters/rack/query_spec.rb +0 -39
- data/spec/lib/application_spec.rb +0 -155
- data/spec/lib/frontend_adapters/rack_spec.rb +0 -294
- data/spec/lib/sources/base_spec.rb +0 -53
- data/spec/lib/sources/couch_spec.rb +0 -114
- data/spec/lib/sources/csv_spec.rb +0 -89
- data/spec/lib/sources/db_spec.rb +0 -125
- data/spec/lib/sources/delicious_spec.rb +0 -94
- data/spec/lib/sources/mongo_spec.rb +0 -50
data/spec/lib/search_spec.rb
CHANGED
@@ -51,7 +51,7 @@ describe Picky::Search do
|
|
51
51
|
context 'no tokenizer predefined' do
|
52
52
|
let(:search) { described_class.new }
|
53
53
|
it 'returns the default tokenizer' do
|
54
|
-
search.tokenizer.should == Picky::Tokenizer.
|
54
|
+
search.tokenizer.should == Picky::Tokenizer.searching
|
55
55
|
end
|
56
56
|
end
|
57
57
|
context 'tokenizer predefined' do
|
data/spec/lib/sinatra_spec.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Picky::Sinatra do
|
4
|
-
|
4
|
+
|
5
5
|
let(:extendee) { Class.new {} }
|
6
|
-
|
6
|
+
|
7
7
|
it 'has no Picky specific methods' do
|
8
8
|
lambda { extendee.indexing }.should raise_error
|
9
9
|
end
|
10
10
|
it 'has no Picky specific methods' do
|
11
11
|
lambda { extendee.searching }.should raise_error
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
context 'after extending' do
|
15
15
|
before(:each) do
|
16
16
|
extendee.extend Picky::Sinatra
|
@@ -22,15 +22,15 @@ describe Picky::Sinatra do
|
|
22
22
|
extendee.send :searching, some: 'option'
|
23
23
|
end
|
24
24
|
it 'gets delegated correctly' do
|
25
|
-
Picky::
|
26
|
-
|
25
|
+
Picky::Tokenizer.should_receive(:default_indexing_with).once.with some: 'option'
|
26
|
+
|
27
27
|
extendee.send :indexing, some: 'option'
|
28
28
|
end
|
29
29
|
it 'gets delegated correctly' do
|
30
|
-
Picky::
|
31
|
-
|
30
|
+
Picky::Tokenizer.should_receive(:default_searching_with).once.with some: 'option'
|
31
|
+
|
32
32
|
extendee.send :searching, some: 'option'
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.0pre2
|
5
5
|
prerelease: 5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70284145905500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,43 +21,21 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70284145905500
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: picky-client
|
27
|
-
requirement: &
|
27
|
+
requirement: &70284145904960 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 4.0.
|
32
|
+
version: 4.0.0pre2
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rack
|
38
|
-
requirement: &70311745502040 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ! '>='
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '0'
|
44
|
-
type: :runtime
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: *70311745502040
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: rack_fast_escape
|
49
|
-
requirement: &70311745501280 !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ! '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
type: :runtime
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: *70311745501280
|
35
|
+
version_requirements: *70284145904960
|
58
36
|
- !ruby/object:Gem::Dependency
|
59
37
|
name: text
|
60
|
-
requirement: &
|
38
|
+
requirement: &70284145904520 !ruby/object:Gem::Requirement
|
61
39
|
none: false
|
62
40
|
requirements:
|
63
41
|
- - ! '>='
|
@@ -65,10 +43,10 @@ dependencies:
|
|
65
43
|
version: '0'
|
66
44
|
type: :runtime
|
67
45
|
prerelease: false
|
68
|
-
version_requirements: *
|
46
|
+
version_requirements: *70284145904520
|
69
47
|
- !ruby/object:Gem::Dependency
|
70
48
|
name: yajl-ruby
|
71
|
-
requirement: &
|
49
|
+
requirement: &70284145904040 !ruby/object:Gem::Requirement
|
72
50
|
none: false
|
73
51
|
requirements:
|
74
52
|
- - ! '>='
|
@@ -76,10 +54,10 @@ dependencies:
|
|
76
54
|
version: '0'
|
77
55
|
type: :runtime
|
78
56
|
prerelease: false
|
79
|
-
version_requirements: *
|
57
|
+
version_requirements: *70284145904040
|
80
58
|
- !ruby/object:Gem::Dependency
|
81
59
|
name: activesupport
|
82
|
-
requirement: &
|
60
|
+
requirement: &70284145903480 !ruby/object:Gem::Requirement
|
83
61
|
none: false
|
84
62
|
requirements:
|
85
63
|
- - ~>
|
@@ -87,10 +65,10 @@ dependencies:
|
|
87
65
|
version: '3.0'
|
88
66
|
type: :runtime
|
89
67
|
prerelease: false
|
90
|
-
version_requirements: *
|
68
|
+
version_requirements: *70284145903480
|
91
69
|
- !ruby/object:Gem::Dependency
|
92
70
|
name: procrastinate
|
93
|
-
requirement: &
|
71
|
+
requirement: &70284145902860 !ruby/object:Gem::Requirement
|
94
72
|
none: false
|
95
73
|
requirements:
|
96
74
|
- - ~>
|
@@ -98,21 +76,10 @@ dependencies:
|
|
98
76
|
version: '0.4'
|
99
77
|
type: :runtime
|
100
78
|
prerelease: false
|
101
|
-
version_requirements: *
|
79
|
+
version_requirements: *70284145902860
|
102
80
|
- !ruby/object:Gem::Dependency
|
103
|
-
name:
|
104
|
-
requirement: &
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ! '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
110
|
-
type: :runtime
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: *70311745498540
|
113
|
-
- !ruby/object:Gem::Dependency
|
114
|
-
name: sinatra
|
115
|
-
requirement: &70311745498080 !ruby/object:Gem::Requirement
|
81
|
+
name: rack_fast_escape
|
82
|
+
requirement: &70284145902240 !ruby/object:Gem::Requirement
|
116
83
|
none: false
|
117
84
|
requirements:
|
118
85
|
- - ! '>='
|
@@ -120,7 +87,7 @@ dependencies:
|
|
120
87
|
version: '0'
|
121
88
|
type: :runtime
|
122
89
|
prerelease: false
|
123
|
-
version_requirements: *
|
90
|
+
version_requirements: *70284145902240
|
124
91
|
description: Fast Ruby semantic text search engine with comfortable single field interface.
|
125
92
|
email: florian.hanke+picky@gmail.com
|
126
93
|
executables:
|
@@ -130,13 +97,8 @@ extensions:
|
|
130
97
|
extra_rdoc_files: []
|
131
98
|
files:
|
132
99
|
- aux/picky/cli.rb
|
133
|
-
- lib/picky/adapters/rack/base.rb
|
134
|
-
- lib/picky/adapters/rack/live_parameters.rb
|
135
|
-
- lib/picky/adapters/rack/search.rb
|
136
|
-
- lib/picky/adapters/rack.rb
|
137
100
|
- lib/picky/analytics.rb
|
138
101
|
- lib/picky/analyzer.rb
|
139
|
-
- lib/picky/application.rb
|
140
102
|
- lib/picky/backends/backend.rb
|
141
103
|
- lib/picky/backends/file/basic.rb
|
142
104
|
- lib/picky/backends/file/json.rb
|
@@ -171,6 +133,7 @@ files:
|
|
171
133
|
- lib/picky/categories_indexed.rb
|
172
134
|
- lib/picky/categories_indexing.rb
|
173
135
|
- lib/picky/categories_realtime.rb
|
136
|
+
- lib/picky/category/location.rb
|
174
137
|
- lib/picky/category.rb
|
175
138
|
- lib/picky/category_convenience.rb
|
176
139
|
- lib/picky/category_indexed.rb
|
@@ -189,7 +152,6 @@ files:
|
|
189
152
|
- lib/picky/extensions/object.rb
|
190
153
|
- lib/picky/extensions/string.rb
|
191
154
|
- lib/picky/extensions/symbol.rb
|
192
|
-
- lib/picky/frontend_adapters/rack.rb
|
193
155
|
- lib/picky/generators/aliases.rb
|
194
156
|
- lib/picky/generators/partial/default.rb
|
195
157
|
- lib/picky/generators/partial/infix.rb
|
@@ -209,8 +171,8 @@ files:
|
|
209
171
|
- lib/picky/generators/weights/default.rb
|
210
172
|
- lib/picky/generators/weights/dynamic.rb
|
211
173
|
- lib/picky/generators/weights/logarithmic.rb
|
212
|
-
- lib/picky/generators/weights/runtime.rb
|
213
174
|
- lib/picky/generators/weights/strategy.rb
|
175
|
+
- lib/picky/generators/weights/stub.rb
|
214
176
|
- lib/picky/helpers/indexing.rb
|
215
177
|
- lib/picky/helpers/measuring.rb
|
216
178
|
- lib/picky/index.rb
|
@@ -225,7 +187,8 @@ files:
|
|
225
187
|
- lib/picky/indexes_convenience.rb
|
226
188
|
- lib/picky/indexes_indexed.rb
|
227
189
|
- lib/picky/indexes_indexing.rb
|
228
|
-
- lib/picky/interfaces/live_parameters.rb
|
190
|
+
- lib/picky/interfaces/live_parameters/master_child.rb
|
191
|
+
- lib/picky/interfaces/live_parameters/unicorn.rb
|
229
192
|
- lib/picky/loader.rb
|
230
193
|
- lib/picky/migrations/from_30_to_31.rb
|
231
194
|
- lib/picky/performant.rb
|
@@ -245,12 +208,6 @@ files:
|
|
245
208
|
- lib/picky/scheduler.rb
|
246
209
|
- lib/picky/search.rb
|
247
210
|
- lib/picky/sinatra.rb
|
248
|
-
- lib/picky/sources/base.rb
|
249
|
-
- lib/picky/sources/couch.rb
|
250
|
-
- lib/picky/sources/csv.rb
|
251
|
-
- lib/picky/sources/db.rb
|
252
|
-
- lib/picky/sources/delicious.rb
|
253
|
-
- lib/picky/sources/mongo.rb
|
254
211
|
- lib/picky/statistics.rb
|
255
212
|
- lib/picky/tasks.rb
|
256
213
|
- lib/picky/tokenizer.rb
|
@@ -259,13 +216,11 @@ files:
|
|
259
216
|
- lib/picky/wrappers/bundle/exact_partial.rb
|
260
217
|
- lib/picky/wrappers/bundle/location.rb
|
261
218
|
- lib/picky/wrappers/bundle/wrapper.rb
|
262
|
-
- lib/picky/wrappers/category/location.rb
|
263
219
|
- lib/picky.rb
|
264
220
|
- lib/tasks/try.rb
|
265
221
|
- lib/tasks/application.rake
|
266
222
|
- lib/tasks/framework.rake
|
267
223
|
- lib/tasks/index.rake
|
268
|
-
- lib/tasks/routes.rake
|
269
224
|
- lib/tasks/server.rake
|
270
225
|
- lib/tasks/statistics.rake
|
271
226
|
- lib/tasks/todo.rake
|
@@ -288,12 +243,8 @@ files:
|
|
288
243
|
- spec/functional/regression_spec.rb
|
289
244
|
- spec/functional/speed_spec.rb
|
290
245
|
- spec/functional/terminate_early_spec.rb
|
291
|
-
- spec/lib/adapters/rack/base_spec.rb
|
292
|
-
- spec/lib/adapters/rack/live_parameters_spec.rb
|
293
|
-
- spec/lib/adapters/rack/query_spec.rb
|
294
246
|
- spec/lib/analytics_spec.rb
|
295
247
|
- spec/lib/analyzer_spec.rb
|
296
|
-
- spec/lib/application_spec.rb
|
297
248
|
- spec/lib/backends/backend_spec.rb
|
298
249
|
- spec/lib/backends/file/basic_spec.rb
|
299
250
|
- spec/lib/backends/file_spec.rb
|
@@ -316,6 +267,7 @@ files:
|
|
316
267
|
- spec/lib/bundling_spec.rb
|
317
268
|
- spec/lib/calculations/location_spec.rb
|
318
269
|
- spec/lib/categories_indexed_spec.rb
|
270
|
+
- spec/lib/category/location_spec.rb
|
319
271
|
- spec/lib/category_indexed_spec.rb
|
320
272
|
- spec/lib/category_indexing_spec.rb
|
321
273
|
- spec/lib/category_spec.rb
|
@@ -326,7 +278,6 @@ files:
|
|
326
278
|
- spec/lib/extensions/object_spec.rb
|
327
279
|
- spec/lib/extensions/string_spec.rb
|
328
280
|
- spec/lib/extensions/symbol_spec.rb
|
329
|
-
- spec/lib/frontend_adapters/rack_spec.rb
|
330
281
|
- spec/lib/generators/aliases_spec.rb
|
331
282
|
- spec/lib/generators/cacher_strategy_spec.rb
|
332
283
|
- spec/lib/generators/partial/default_spec.rb
|
@@ -360,7 +311,8 @@ files:
|
|
360
311
|
- spec/lib/indexes_spec.rb
|
361
312
|
- spec/lib/indexing/bundle_partial_generation_speed_spec.rb
|
362
313
|
- spec/lib/indexing/bundle_spec.rb
|
363
|
-
- spec/lib/interfaces/
|
314
|
+
- spec/lib/interfaces/live_parameters/master_child_spec.rb
|
315
|
+
- spec/lib/interfaces/live_parameters/unicorn_spec.rb
|
364
316
|
- spec/lib/loader_spec.rb
|
365
317
|
- spec/lib/query/allocation_spec.rb
|
366
318
|
- spec/lib/query/allocations_spec.rb
|
@@ -380,12 +332,6 @@ files:
|
|
380
332
|
- spec/lib/search_spec.rb
|
381
333
|
- spec/lib/sinatra_spec.rb
|
382
334
|
- spec/lib/solr/schema_generator_spec.rb
|
383
|
-
- spec/lib/sources/base_spec.rb
|
384
|
-
- spec/lib/sources/couch_spec.rb
|
385
|
-
- spec/lib/sources/csv_spec.rb
|
386
|
-
- spec/lib/sources/db_spec.rb
|
387
|
-
- spec/lib/sources/delicious_spec.rb
|
388
|
-
- spec/lib/sources/mongo_spec.rb
|
389
335
|
- spec/lib/statistics_spec.rb
|
390
336
|
- spec/lib/tasks/try_spec.rb
|
391
337
|
- spec/lib/tokenizer_spec.rb
|
@@ -432,12 +378,8 @@ test_files:
|
|
432
378
|
- spec/functional/regression_spec.rb
|
433
379
|
- spec/functional/speed_spec.rb
|
434
380
|
- spec/functional/terminate_early_spec.rb
|
435
|
-
- spec/lib/adapters/rack/base_spec.rb
|
436
|
-
- spec/lib/adapters/rack/live_parameters_spec.rb
|
437
|
-
- spec/lib/adapters/rack/query_spec.rb
|
438
381
|
- spec/lib/analytics_spec.rb
|
439
382
|
- spec/lib/analyzer_spec.rb
|
440
|
-
- spec/lib/application_spec.rb
|
441
383
|
- spec/lib/backends/backend_spec.rb
|
442
384
|
- spec/lib/backends/file/basic_spec.rb
|
443
385
|
- spec/lib/backends/file_spec.rb
|
@@ -460,6 +402,7 @@ test_files:
|
|
460
402
|
- spec/lib/bundling_spec.rb
|
461
403
|
- spec/lib/calculations/location_spec.rb
|
462
404
|
- spec/lib/categories_indexed_spec.rb
|
405
|
+
- spec/lib/category/location_spec.rb
|
463
406
|
- spec/lib/category_indexed_spec.rb
|
464
407
|
- spec/lib/category_indexing_spec.rb
|
465
408
|
- spec/lib/category_spec.rb
|
@@ -470,7 +413,6 @@ test_files:
|
|
470
413
|
- spec/lib/extensions/object_spec.rb
|
471
414
|
- spec/lib/extensions/string_spec.rb
|
472
415
|
- spec/lib/extensions/symbol_spec.rb
|
473
|
-
- spec/lib/frontend_adapters/rack_spec.rb
|
474
416
|
- spec/lib/generators/aliases_spec.rb
|
475
417
|
- spec/lib/generators/cacher_strategy_spec.rb
|
476
418
|
- spec/lib/generators/partial/default_spec.rb
|
@@ -504,7 +446,8 @@ test_files:
|
|
504
446
|
- spec/lib/indexes_spec.rb
|
505
447
|
- spec/lib/indexing/bundle_partial_generation_speed_spec.rb
|
506
448
|
- spec/lib/indexing/bundle_spec.rb
|
507
|
-
- spec/lib/interfaces/
|
449
|
+
- spec/lib/interfaces/live_parameters/master_child_spec.rb
|
450
|
+
- spec/lib/interfaces/live_parameters/unicorn_spec.rb
|
508
451
|
- spec/lib/loader_spec.rb
|
509
452
|
- spec/lib/query/allocation_spec.rb
|
510
453
|
- spec/lib/query/allocations_spec.rb
|
@@ -524,12 +467,6 @@ test_files:
|
|
524
467
|
- spec/lib/search_spec.rb
|
525
468
|
- spec/lib/sinatra_spec.rb
|
526
469
|
- spec/lib/solr/schema_generator_spec.rb
|
527
|
-
- spec/lib/sources/base_spec.rb
|
528
|
-
- spec/lib/sources/couch_spec.rb
|
529
|
-
- spec/lib/sources/csv_spec.rb
|
530
|
-
- spec/lib/sources/db_spec.rb
|
531
|
-
- spec/lib/sources/delicious_spec.rb
|
532
|
-
- spec/lib/sources/mongo_spec.rb
|
533
470
|
- spec/lib/statistics_spec.rb
|
534
471
|
- spec/lib/tasks/try_spec.rb
|
535
472
|
- spec/lib/tokenizer_spec.rb
|
data/lib/picky/adapters/rack.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
module Picky
|
2
|
-
|
3
|
-
module Adapters
|
4
|
-
|
5
|
-
# This is an adapter that is plugged into a Rack outlet.
|
6
|
-
#
|
7
|
-
# It looks at what is given to it and generate an appropriate
|
8
|
-
# adapter for it.
|
9
|
-
#
|
10
|
-
# For example, if you give it a query, it will extract the query param etc.
|
11
|
-
# and call search on it if it is called by Rack.
|
12
|
-
#
|
13
|
-
# Usage:
|
14
|
-
# Adapters::Rack.app_for(thing, options)
|
15
|
-
#
|
16
|
-
module Rack
|
17
|
-
|
18
|
-
# Generates the appropriate app for Rack.
|
19
|
-
#
|
20
|
-
@@mapping = {
|
21
|
-
:search => Search,
|
22
|
-
:parameters => LiveParameters
|
23
|
-
}
|
24
|
-
def self.app_for thing, options = {}
|
25
|
-
@@mapping.each_pair do |method, adapter|
|
26
|
-
return adapter.new(thing).to_app(options) if thing.respond_to?(method)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Picky
|
2
|
-
|
3
|
-
module Adapters
|
4
|
-
# Adapter that is plugged into a Rack outlet.
|
5
|
-
#
|
6
|
-
module Rack
|
7
|
-
|
8
|
-
# Subclasses of this class should respond to
|
9
|
-
# * to_app(options)
|
10
|
-
#
|
11
|
-
class Base
|
12
|
-
|
13
|
-
# Puts together an appropriately structured Rack response.
|
14
|
-
#
|
15
|
-
# Note: Bytesize is needed to have special characters not trip up Rack.
|
16
|
-
#
|
17
|
-
def respond_with response, content_type = 'application/json'
|
18
|
-
[200, { 'Content-Type' => content_type, 'Content-Length' => response.bytesize.to_s }, [response]]
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Picky
|
2
|
-
|
3
|
-
module Adapters
|
4
|
-
|
5
|
-
#
|
6
|
-
#
|
7
|
-
module Rack
|
8
|
-
|
9
|
-
class LiveParameters < Base
|
10
|
-
|
11
|
-
def initialize live_parameters
|
12
|
-
@live_parameters = live_parameters
|
13
|
-
end
|
14
|
-
|
15
|
-
#
|
16
|
-
#
|
17
|
-
def to_app options = {}
|
18
|
-
# For capturing by the lambda block.
|
19
|
-
#
|
20
|
-
live_parameters = @live_parameters
|
21
|
-
|
22
|
-
lambda do |env|
|
23
|
-
params = ::Rack::Request.new(env).params
|
24
|
-
|
25
|
-
results = live_parameters.parameters params
|
26
|
-
|
27
|
-
respond_with results.to_json
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|