flying-sphinx 0.6.6 → 0.7.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.
- data/HISTORY +7 -0
- data/flying-sphinx.gemspec +3 -3
- data/lib/flying_sphinx.rb +4 -0
- data/lib/flying_sphinx/api.rb +12 -15
- data/lib/flying_sphinx/configuration.rb +4 -123
- data/lib/flying_sphinx/delayed_delta.rb +21 -25
- data/lib/flying_sphinx/index_request.rb +15 -22
- data/lib/flying_sphinx/rails.rb +1 -0
- data/lib/flying_sphinx/railtie.rb +1 -0
- data/lib/flying_sphinx/setting_files.rb +55 -0
- data/lib/flying_sphinx/sphinx_configuration.rb +23 -0
- data/lib/flying_sphinx/tasks.rb +0 -1
- data/lib/flying_sphinx/tunnel.rb +1 -1
- data/lib/flying_sphinx/version.rb +1 -1
- data/spec/light_spec_helper.rb +7 -0
- data/spec/spec_helper.rb +2 -12
- data/spec/specs/api_spec.rb +92 -0
- data/spec/specs/configuration_spec.rb +14 -163
- data/spec/specs/index_request_spec.rb +63 -61
- data/spec/specs/setting_files_spec.rb +92 -0
- data/spec/specs/sphinx_configuration_spec.rb +35 -0
- metadata +34 -25
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'light_spec_helper'
|
2
|
+
require 'flying_sphinx/setting_files'
|
3
|
+
|
4
|
+
describe FlyingSphinx::SettingFiles do
|
5
|
+
let(:files) { FlyingSphinx::SettingFiles.new indices }
|
6
|
+
let(:indices) { [] }
|
7
|
+
|
8
|
+
def index_double(methods)
|
9
|
+
fire_double 'Riddle::Configuration::Index', methods
|
10
|
+
end
|
11
|
+
|
12
|
+
def source_double(methods)
|
13
|
+
fire_double 'Riddle::Configuration::SQLSource', methods
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#upload_to' do
|
17
|
+
let(:api) { fire_double('FlyingSphinx::API') }
|
18
|
+
|
19
|
+
before :each do
|
20
|
+
File.stub :read => 'blah'
|
21
|
+
end
|
22
|
+
|
23
|
+
[:stopwords, :wordforms, :exceptions].each do |setting|
|
24
|
+
it "uploads #{setting} files from indices" do
|
25
|
+
indices << index_double(setting => '/my/file/foo.txt')
|
26
|
+
|
27
|
+
api.should_receive(:post).with('/add_file', :setting => setting.to_s,
|
28
|
+
:file_name => 'foo.txt', :content => 'blah')
|
29
|
+
|
30
|
+
files.upload_to(api)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "does not repeat same files for #{setting}" do
|
34
|
+
indices << index_double(setting => '/my/file/foo.txt')
|
35
|
+
indices << index_double(setting => '/my/file/foo.txt')
|
36
|
+
|
37
|
+
api.should_receive(:post).with('/add_file', :setting => setting.to_s,
|
38
|
+
:file_name => 'foo.txt', :content => 'blah').once
|
39
|
+
|
40
|
+
files.upload_to(api)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "accepts multiples files for #{setting}" do
|
44
|
+
indices << index_double(
|
45
|
+
setting => '/my/file/foo.txt /my/file/bar.txt')
|
46
|
+
|
47
|
+
api.should_receive(:post).with('/add_file', :setting => setting.to_s,
|
48
|
+
:file_name => 'foo.txt', :content => 'blah').once
|
49
|
+
api.should_receive(:post).with('/add_file', :setting => setting.to_s,
|
50
|
+
:file_name => 'bar.txt', :content => 'blah').once
|
51
|
+
|
52
|
+
files.upload_to(api)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
[:mysql_ssl_cert, :mysql_ssl_key, :mysql_ssl_ca].each do |setting|
|
57
|
+
it "uploads #{setting} files from indices" do
|
58
|
+
indices << index_double(:sources => [
|
59
|
+
source_double(setting => '/my/file/foo.txt')])
|
60
|
+
|
61
|
+
api.should_receive(:post).with('/add_file', :setting => setting.to_s,
|
62
|
+
:file_name => 'foo.txt', :content => 'blah')
|
63
|
+
|
64
|
+
files.upload_to(api)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "does not repeat same files for #{setting}" do
|
68
|
+
indices << index_double(:sources => [
|
69
|
+
source_double(setting => '/my/file/foo.txt')])
|
70
|
+
indices << index_double(:sources => [
|
71
|
+
source_double(setting => '/my/file/foo.txt')])
|
72
|
+
|
73
|
+
api.should_receive(:post).with('/add_file', :setting => setting.to_s,
|
74
|
+
:file_name => 'foo.txt', :content => 'blah').once
|
75
|
+
|
76
|
+
files.upload_to(api)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "accepts multiples files for #{setting}" do
|
80
|
+
indices << index_double(:sources => [
|
81
|
+
source_double(setting => '/my/file/foo.txt /my/file/bar.txt')])
|
82
|
+
|
83
|
+
api.should_receive(:post).with('/add_file', :setting => setting.to_s,
|
84
|
+
:file_name => 'foo.txt', :content => 'blah').once
|
85
|
+
api.should_receive(:post).with('/add_file', :setting => setting.to_s,
|
86
|
+
:file_name => 'bar.txt', :content => 'blah').once
|
87
|
+
|
88
|
+
files.upload_to(api)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'light_spec_helper'
|
2
|
+
require 'flying_sphinx/sphinx_configuration'
|
3
|
+
|
4
|
+
describe FlyingSphinx::SphinxConfiguration do
|
5
|
+
let(:configuration) { FlyingSphinx::SphinxConfiguration.new ts_config }
|
6
|
+
let(:ts_config) { fire_double('ThinkingSphinx::Configuration',
|
7
|
+
:configuration => riddle_config, :version => '2.1.0-dev',
|
8
|
+
:generate => true) }
|
9
|
+
let(:riddle_config) { fire_double('Riddle::Configuration',
|
10
|
+
:render => 'foo {}') }
|
11
|
+
|
12
|
+
describe '#upload_to' do
|
13
|
+
let(:api) { fire_double('FlyingSphinx::API', :put => true) }
|
14
|
+
|
15
|
+
it "generates the Sphinx configuration" do
|
16
|
+
ts_config.should_receive(:generate)
|
17
|
+
|
18
|
+
configuration.upload_to api
|
19
|
+
end
|
20
|
+
|
21
|
+
it "sends the configuration to the API" do
|
22
|
+
api.should_receive(:put).with('/', :configuration => 'foo {}',
|
23
|
+
:sphinx_version => '2.1.0-dev', :tunnel => 'false')
|
24
|
+
|
25
|
+
configuration.upload_to api
|
26
|
+
end
|
27
|
+
|
28
|
+
it "informs the API when tunnelling will be required" do
|
29
|
+
api.should_receive(:put).with('/', :configuration => 'foo {}',
|
30
|
+
:sphinx_version => '2.1.0-dev', :tunnel => 'true')
|
31
|
+
|
32
|
+
configuration.upload_to api, true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flying-sphinx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 7
|
9
|
+
- 0
|
10
|
+
version: 0.7.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pat Allan
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-07-
|
18
|
+
date: 2012-07-16 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: thinking-sphinx
|
@@ -116,62 +116,61 @@ dependencies:
|
|
116
116
|
requirement: &id007 !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
119
|
-
- -
|
119
|
+
- - ~>
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
hash:
|
121
|
+
hash: 63
|
122
122
|
segments:
|
123
123
|
- 0
|
124
|
-
-
|
125
|
-
-
|
126
|
-
version: 0.
|
124
|
+
- 9
|
125
|
+
- 2
|
126
|
+
version: 0.9.2
|
127
127
|
type: :development
|
128
128
|
version_requirements: *id007
|
129
129
|
- !ruby/object:Gem::Dependency
|
130
|
-
name:
|
130
|
+
name: rspec
|
131
131
|
prerelease: false
|
132
132
|
requirement: &id008 !ruby/object:Gem::Requirement
|
133
133
|
none: false
|
134
134
|
requirements:
|
135
135
|
- - ~>
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
hash:
|
137
|
+
hash: 21
|
138
138
|
segments:
|
139
|
-
- 0
|
140
|
-
- 8
|
141
139
|
- 2
|
142
|
-
|
140
|
+
- 11
|
141
|
+
version: "2.11"
|
143
142
|
type: :development
|
144
143
|
version_requirements: *id008
|
145
144
|
- !ruby/object:Gem::Dependency
|
146
|
-
name: rspec
|
145
|
+
name: rspec-fire
|
147
146
|
prerelease: false
|
148
147
|
requirement: &id009 !ruby/object:Gem::Requirement
|
149
148
|
none: false
|
150
149
|
requirements:
|
151
150
|
- - ~>
|
152
151
|
- !ruby/object:Gem::Version
|
153
|
-
hash:
|
152
|
+
hash: 19
|
154
153
|
segments:
|
155
|
-
-
|
156
|
-
-
|
154
|
+
- 1
|
155
|
+
- 1
|
157
156
|
- 0
|
158
|
-
version:
|
157
|
+
version: 1.1.0
|
159
158
|
type: :development
|
160
159
|
version_requirements: *id009
|
161
160
|
- !ruby/object:Gem::Dependency
|
162
|
-
name:
|
161
|
+
name: yajl-ruby
|
163
162
|
prerelease: false
|
164
163
|
requirement: &id010 !ruby/object:Gem::Requirement
|
165
164
|
none: false
|
166
165
|
requirements:
|
167
166
|
- - ~>
|
168
167
|
- !ruby/object:Gem::Version
|
169
|
-
hash:
|
168
|
+
hash: 59
|
170
169
|
segments:
|
171
170
|
- 0
|
172
|
-
-
|
173
|
-
-
|
174
|
-
version: 0.
|
171
|
+
- 8
|
172
|
+
- 2
|
173
|
+
version: 0.8.2
|
175
174
|
type: :development
|
176
175
|
version_requirements: *id010
|
177
176
|
- !ruby/object:Gem::Dependency
|
@@ -250,15 +249,21 @@ files:
|
|
250
249
|
- lib/flying_sphinx/index_request.rb
|
251
250
|
- lib/flying_sphinx/rails.rb
|
252
251
|
- lib/flying_sphinx/railtie.rb
|
252
|
+
- lib/flying_sphinx/setting_files.rb
|
253
253
|
- lib/flying_sphinx/sinatra.rb
|
254
|
+
- lib/flying_sphinx/sphinx_configuration.rb
|
254
255
|
- lib/flying_sphinx/tasks.rb
|
255
256
|
- lib/flying_sphinx/tunnel.rb
|
256
257
|
- lib/flying_sphinx/version.rb
|
258
|
+
- spec/light_spec_helper.rb
|
257
259
|
- spec/spec_helper.rb
|
260
|
+
- spec/specs/api_spec.rb
|
258
261
|
- spec/specs/configuration_spec.rb
|
259
262
|
- spec/specs/delayed_delta_spec.rb
|
260
263
|
- spec/specs/flag_as_deleted_job_spec.rb
|
261
264
|
- spec/specs/index_request_spec.rb
|
265
|
+
- spec/specs/setting_files_spec.rb
|
266
|
+
- spec/specs/sphinx_configuration_spec.rb
|
262
267
|
homepage: https://flying-sphinx.com
|
263
268
|
licenses: []
|
264
269
|
|
@@ -297,9 +302,13 @@ signing_key:
|
|
297
302
|
specification_version: 3
|
298
303
|
summary: Sphinx in the Cloud
|
299
304
|
test_files:
|
305
|
+
- spec/light_spec_helper.rb
|
300
306
|
- spec/spec_helper.rb
|
307
|
+
- spec/specs/api_spec.rb
|
301
308
|
- spec/specs/configuration_spec.rb
|
302
309
|
- spec/specs/delayed_delta_spec.rb
|
303
310
|
- spec/specs/flag_as_deleted_job_spec.rb
|
304
311
|
- spec/specs/index_request_spec.rb
|
312
|
+
- spec/specs/setting_files_spec.rb
|
313
|
+
- spec/specs/sphinx_configuration_spec.rb
|
305
314
|
has_rdoc:
|