riddle 1.5.10 → 1.5.11
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 +7 -7
- data/.travis.yml +4 -10
- data/HISTORY +8 -0
- data/lib/riddle/0.9.9/configuration/searchd.rb +2 -6
- data/lib/riddle/auto_version.rb +1 -1
- data/lib/riddle/configuration.rb +4 -2
- data/lib/riddle/configuration/common.rb +26 -0
- data/lib/riddle/configuration/indexer.rb +19 -4
- data/lib/riddle/configuration/parser.rb +7 -2
- data/lib/riddle/configuration/section.rb +5 -1
- data/lib/riddle/query.rb +1 -1
- data/lib/riddle/query/select.rb +1 -1
- data/riddle.gemspec +1 -1
- data/spec/riddle/auto_version_spec.rb +7 -0
- data/spec/riddle/query_spec.rb +1 -1
- data/spec/support/sphinx.rb +2 -0
- data/spec/unit/configuration/common_spec.rb +60 -0
- data/spec/unit/configuration/indexer_spec.rb +37 -0
- data/spec/unit/configuration/searchd_spec.rb +35 -18
- data/spec/unit/message_spec.rb +9 -8
- metadata +57 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 55868c085e98a4ee1485e4b2b571cac9e712d7f6
|
4
|
+
data.tar.gz: e9c77b9c6d818662404f86951a839df4e0358cd4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 48cdfd60502df6763b278b0f64f7750554c2075ea9c66cebbf86f4a886891d1b0beb33924f04cd09f17367b8992cbef47571237396157118bee2852a7acb7815
|
7
|
+
data.tar.gz: f7751e152943f0ba712132cce958ff5688524e204628e1975727cc4c978fb3ff5ded9f78d64e6f69a52ca1567b5a02048aec93749b1dffdbc89518e85a9c2e17
|
data/.travis.yml
CHANGED
@@ -1,20 +1,14 @@
|
|
1
1
|
language: ruby
|
2
|
-
before_install:
|
3
|
-
- sudo apt-get install postgresql-server-dev-9.1 libmysql++-dev -y
|
4
|
-
- curl -O http://fs-packages.s3.amazonaws.com/fs-sphinx-1.10_x86_64_12.04.deb
|
5
|
-
- sudo dpkg -i fs-sphinx-1.10_x86_64_12.04.deb
|
6
|
-
- curl -O http://fs-packages.s3.amazonaws.com/fs-sphinx-2.0.9_x86_64_12.04.deb
|
7
|
-
- sudo dpkg -i fs-sphinx-2.0.9_x86_64_12.04.deb
|
8
|
-
- curl -O http://fs-packages.s3.amazonaws.com/fs-sphinx-2.1.4_x86_64_12.04.deb
|
9
|
-
- sudo dpkg -i fs-sphinx-2.1.4_x86_64_12.04.deb
|
10
2
|
rvm:
|
11
3
|
- 1.8.7
|
12
4
|
- 1.9.2
|
13
5
|
- 1.9.3
|
6
|
+
- 2.0.0
|
7
|
+
- 2.1.0
|
14
8
|
- jruby-18mode
|
15
9
|
env:
|
16
|
-
- SPHINX_BIN=/usr/local/sphinx-1.10/bin SPHINX_VERSION=1.10
|
17
10
|
- SPHINX_BIN=/usr/local/sphinx-2.0.9/bin SPHINX_VERSION=2.0.9
|
18
|
-
- SPHINX_BIN=/usr/local/sphinx-2.1.
|
11
|
+
- SPHINX_BIN=/usr/local/sphinx-2.1.3/bin SPHINX_VERSION=2.1.3
|
12
|
+
- SPHINX_BIN=/usr/local/sphinx-2.2.1/bin SPHINX_VERSION=2.2.1
|
19
13
|
before_script: killall searchd; echo ''
|
20
14
|
after_script: killall searchd; echo ''
|
data/HISTORY
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
1.5.11 - April 19th 2014
|
2
|
+
- Riddle::Query.escape covers = and & characters.
|
3
|
+
- Hold onto address and port settings when crafting the equivalent listen setting, but don't render them.
|
4
|
+
- Allow for Sphinx's common settings section (Trevor Smith). Optional and initially disabled.
|
5
|
+
- Allow for multiple attributes in GROUP BY clauses (J. Garcia).
|
6
|
+
- Riddle::Query.escape covers < and > characters.
|
7
|
+
- The parser should not presume indexer and searchd sections exist.
|
8
|
+
|
1
9
|
1.5.10 - January 11th 2014
|
2
10
|
- SELECT values can be prepended as well as the existing append support.
|
3
11
|
- New settings for Sphinx 2.2.1.
|
@@ -3,7 +3,6 @@ module Riddle
|
|
3
3
|
class Searchd
|
4
4
|
def valid?
|
5
5
|
set_listen
|
6
|
-
clear_deprecated
|
7
6
|
|
8
7
|
!( @listen.nil? || @listen.empty? || @pid_file.nil? )
|
9
8
|
end
|
@@ -23,11 +22,8 @@ module Riddle
|
|
23
22
|
@listen.each { |l| l.insert(0, "#{@address}:") } if @address
|
24
23
|
end
|
25
24
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
@address = nil
|
30
|
-
@port = nil
|
25
|
+
def settings
|
26
|
+
@listen.nil? ? super : super - [:address, :port]
|
31
27
|
end
|
32
28
|
end
|
33
29
|
end
|
data/lib/riddle/auto_version.rb
CHANGED
data/lib/riddle/configuration.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'riddle/configuration/section'
|
2
2
|
require 'riddle/configuration/index_settings'
|
3
3
|
|
4
|
+
require 'riddle/configuration/common'
|
4
5
|
require 'riddle/configuration/distributed_index'
|
5
6
|
require 'riddle/configuration/index'
|
6
7
|
require 'riddle/configuration/indexer'
|
@@ -20,7 +21,7 @@ module Riddle
|
|
20
21
|
class ConfigurationError < StandardError #:nodoc:
|
21
22
|
end
|
22
23
|
|
23
|
-
attr_reader :indices, :searchd, :sources
|
24
|
+
attr_reader :common, :indices, :searchd, :sources
|
24
25
|
attr_accessor :indexer
|
25
26
|
|
26
27
|
def self.parse!(input)
|
@@ -28,6 +29,7 @@ module Riddle
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def initialize
|
32
|
+
@common = Riddle::Configuration::Common.new
|
31
33
|
@indexer = Riddle::Configuration::Indexer.new
|
32
34
|
@searchd = Riddle::Configuration::Searchd.new
|
33
35
|
@indices = []
|
@@ -36,7 +38,7 @@ module Riddle
|
|
36
38
|
|
37
39
|
def render
|
38
40
|
(
|
39
|
-
[@indexer.render, @searchd.render] +
|
41
|
+
[@common.render, @indexer.render, @searchd.render] +
|
40
42
|
@sources.collect { |source| source.render } +
|
41
43
|
@indices.collect { |index| index.render }
|
42
44
|
).join("\n")
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Riddle
|
2
|
+
class Configuration
|
3
|
+
class Common < Riddle::Configuration::Section
|
4
|
+
def self.settings
|
5
|
+
[
|
6
|
+
:lemmatizer_base, :json_autoconv_numbers, :json_autoconv_keynames,
|
7
|
+
:on_json_attr_error, :rlp_root, :rlp_environment, :rlp_max_batch_size,
|
8
|
+
:rlp_max_batch_docs
|
9
|
+
]
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_accessor :common_sphinx_configuration, *settings
|
13
|
+
|
14
|
+
def render
|
15
|
+
return unless common_sphinx_configuration
|
16
|
+
raise ConfigurationError unless valid?
|
17
|
+
|
18
|
+
(
|
19
|
+
["common", "{"] +
|
20
|
+
settings_body +
|
21
|
+
["}", ""]
|
22
|
+
).join("\n")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -5,13 +5,19 @@ module Riddle
|
|
5
5
|
[
|
6
6
|
:mem_limit, :max_iops, :max_iosize, :max_xmlpipe2_field,
|
7
7
|
:write_buffer, :max_file_field_buffer, :on_file_field_error,
|
8
|
-
:
|
9
|
-
|
10
|
-
|
8
|
+
:lemmatizer_cache
|
9
|
+
] + shared_settings
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.shared_settings
|
13
|
+
[
|
14
|
+
:lemmatizer_base, :json_autoconv_numbers, :json_autoconv_keynames,
|
15
|
+
:on_json_attr_error, :rlp_root, :rlp_environment, :rlp_max_batch_size,
|
16
|
+
:rlp_max_batch_docs
|
11
17
|
]
|
12
18
|
end
|
13
19
|
|
14
|
-
attr_accessor *
|
20
|
+
attr_accessor :common_sphinx_configuration, *settings
|
15
21
|
|
16
22
|
def render
|
17
23
|
raise ConfigurationError unless valid?
|
@@ -22,6 +28,15 @@ module Riddle
|
|
22
28
|
["}", ""]
|
23
29
|
).join("\n")
|
24
30
|
end
|
31
|
+
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def settings
|
36
|
+
settings = self.class.settings
|
37
|
+
settings -= self.class.shared_settings if common_sphinx_configuration
|
38
|
+
settings
|
39
|
+
end
|
25
40
|
end
|
26
41
|
end
|
27
42
|
end
|
@@ -24,6 +24,7 @@ class Riddle::Configuration::Parser
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def parse!
|
27
|
+
set_common
|
27
28
|
set_indexer
|
28
29
|
set_searchd
|
29
30
|
set_sources
|
@@ -65,12 +66,16 @@ class Riddle::Configuration::Parser
|
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
69
|
+
def set_common
|
70
|
+
set_settings configuration.common, inner['common'] || {}
|
71
|
+
end
|
72
|
+
|
68
73
|
def set_indexer
|
69
|
-
set_settings configuration.indexer, inner['indexer']
|
74
|
+
set_settings configuration.indexer, inner['indexer'] || {}
|
70
75
|
end
|
71
76
|
|
72
77
|
def set_searchd
|
73
|
-
set_settings configuration.searchd, inner['searchd']
|
78
|
+
set_settings configuration.searchd, inner['searchd'] || {}
|
74
79
|
end
|
75
80
|
|
76
81
|
def set_sources
|
@@ -12,7 +12,7 @@ module Riddle
|
|
12
12
|
private
|
13
13
|
|
14
14
|
def settings_body
|
15
|
-
|
15
|
+
settings.select { |setting|
|
16
16
|
!send(setting).nil?
|
17
17
|
}.collect { |setting|
|
18
18
|
if send(setting) == ""
|
@@ -50,6 +50,10 @@ module Riddle
|
|
50
50
|
|
51
51
|
output
|
52
52
|
end
|
53
|
+
|
54
|
+
def settings
|
55
|
+
self.class.settings
|
56
|
+
end
|
53
57
|
end
|
54
58
|
end
|
55
59
|
end
|
data/lib/riddle/query.rb
CHANGED
data/lib/riddle/query/select.rb
CHANGED
@@ -100,7 +100,7 @@ class Riddle::Query::Select
|
|
100
100
|
def to_sql
|
101
101
|
sql = "SELECT #{ extended_values } FROM #{ @indices.join(', ') }"
|
102
102
|
sql << " WHERE #{ combined_wheres }" if wheres?
|
103
|
-
sql << " #{group_prefix} #{
|
103
|
+
sql << " #{group_prefix} #{escape_columns(@group_by)}" if !@group_by.nil?
|
104
104
|
unless @order_within_group_by.nil?
|
105
105
|
sql << " WITHIN GROUP ORDER BY #{escape_columns(@order_within_group_by)}"
|
106
106
|
end
|
data/riddle.gemspec
CHANGED
@@ -78,6 +78,13 @@ describe Riddle::AutoVersion do
|
|
78
78
|
Riddle::AutoVersion.configure
|
79
79
|
end
|
80
80
|
|
81
|
+
it "should require 2.1.0 if 2.2.1 is being used" do
|
82
|
+
Riddle::AutoVersion.should_receive(:require).with('riddle/2.1.0')
|
83
|
+
|
84
|
+
@controller.stub!(:sphinx_version => '2.2.1-beta')
|
85
|
+
Riddle::AutoVersion.configure
|
86
|
+
end
|
87
|
+
|
81
88
|
it "should require 2.1.0 if that is the known version" do
|
82
89
|
Riddle::AutoVersion.should_receive(:require).with('riddle/2.1.0')
|
83
90
|
|
data/spec/riddle/query_spec.rb
CHANGED
data/spec/support/sphinx.rb
CHANGED
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Riddle::Configuration::Common do
|
4
|
+
it "should always be valid" do
|
5
|
+
common = Riddle::Configuration::Common.new
|
6
|
+
common.should be_valid
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should support Sphinx's common settings" do
|
10
|
+
settings = %w( lemmatizer_base on_json_attr_error json_autoconv_numbers
|
11
|
+
json_autoconv_keynames rlp_root rlp_environment rlp_max_batch_size
|
12
|
+
rlp_max_batch_docs )
|
13
|
+
common = Riddle::Configuration::Common.new
|
14
|
+
|
15
|
+
settings.each do |setting|
|
16
|
+
common.should respond_to(setting.to_sym)
|
17
|
+
common.should respond_to("#{setting}=".to_sym)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should render a correct configuration" do
|
22
|
+
common = Riddle::Configuration::Common.new
|
23
|
+
common.common_sphinx_configuration = true
|
24
|
+
|
25
|
+
common.render.should == <<-COMMON
|
26
|
+
common
|
27
|
+
{
|
28
|
+
}
|
29
|
+
COMMON
|
30
|
+
|
31
|
+
common.lemmatizer_base = "/tmp"
|
32
|
+
common.render.should == <<-COMMON
|
33
|
+
common
|
34
|
+
{
|
35
|
+
lemmatizer_base = /tmp
|
36
|
+
}
|
37
|
+
COMMON
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should not be present when common_sphinx_configuration is not set" do
|
41
|
+
common = Riddle::Configuration::Common.new
|
42
|
+
common.render.should be_nil
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should not be present when common_sphinx_configuration is false" do
|
46
|
+
common = Riddle::Configuration::Common.new
|
47
|
+
common.common_sphinx_configuration = false
|
48
|
+
common.render.should be_nil
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should render when common_sphinx_configuration is true" do
|
52
|
+
common = Riddle::Configuration::Common.new
|
53
|
+
common.common_sphinx_configuration = true
|
54
|
+
common.render.should == <<-COMMON
|
55
|
+
common
|
56
|
+
{
|
57
|
+
}
|
58
|
+
COMMON
|
59
|
+
end
|
60
|
+
end
|
@@ -33,4 +33,41 @@ indexer
|
|
33
33
|
}
|
34
34
|
INDEXER
|
35
35
|
end
|
36
|
+
|
37
|
+
it "should render shared settings when common_sphinx_configuration is not set" do
|
38
|
+
indexer = Riddle::Configuration::Indexer.new
|
39
|
+
indexer.rlp_root = '/tmp'
|
40
|
+
|
41
|
+
indexer.render.should == <<-INDEXER
|
42
|
+
indexer
|
43
|
+
{
|
44
|
+
rlp_root = /tmp
|
45
|
+
}
|
46
|
+
INDEXER
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should render shared settings when common_sphinx_configuration is false" do
|
50
|
+
indexer = Riddle::Configuration::Indexer.new
|
51
|
+
indexer.common_sphinx_configuration = false
|
52
|
+
indexer.rlp_root = '/tmp'
|
53
|
+
|
54
|
+
indexer.render.should == <<-INDEXER
|
55
|
+
indexer
|
56
|
+
{
|
57
|
+
rlp_root = /tmp
|
58
|
+
}
|
59
|
+
INDEXER
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should not render shared settings when common_sphinx_configuration is true" do
|
63
|
+
indexer = Riddle::Configuration::Indexer.new
|
64
|
+
indexer.common_sphinx_configuration = true
|
65
|
+
indexer.rlp_root = '/tmp'
|
66
|
+
|
67
|
+
indexer.render.should == <<-INDEXER
|
68
|
+
indexer
|
69
|
+
{
|
70
|
+
}
|
71
|
+
INDEXER
|
72
|
+
end
|
36
73
|
end
|
@@ -5,17 +5,17 @@ describe Riddle::Configuration::Searchd do
|
|
5
5
|
it "should be invalid without a listen or pid_file" do
|
6
6
|
searchd = Riddle::Configuration::Searchd.new
|
7
7
|
searchd.should_not be_valid
|
8
|
-
|
8
|
+
|
9
9
|
searchd.port = 3312
|
10
10
|
searchd.should_not be_valid
|
11
|
-
|
11
|
+
|
12
12
|
searchd.pid_file = "file.pid"
|
13
13
|
searchd.should be_valid
|
14
|
-
|
14
|
+
|
15
15
|
searchd.port = nil
|
16
16
|
searchd.listen = nil
|
17
17
|
searchd.should_not be_valid
|
18
|
-
|
18
|
+
|
19
19
|
searchd.listen = "localhost:3312"
|
20
20
|
searchd.should be_valid
|
21
21
|
end
|
@@ -34,13 +34,13 @@ describe Riddle::Configuration::Searchd do
|
|
34
34
|
searchd.should_not be_valid
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
it "should raise a ConfigurationError if rendering but not valid" do
|
39
39
|
searchd = Riddle::Configuration::Searchd.new
|
40
40
|
searchd.should_not be_valid
|
41
41
|
lambda { searchd.render }.should raise_error(Riddle::Configuration::ConfigurationError)
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
it "should support Sphinx's searchd settings" do
|
45
45
|
settings = %w( listen address port log query_log read_timeout
|
46
46
|
client_timeout max_children pid_file max_matches seamless_rotate
|
@@ -48,7 +48,7 @@ describe Riddle::Configuration::Searchd do
|
|
48
48
|
max_packet_size mva_updates_pool crash_log_path max_filters
|
49
49
|
max_filter_values )
|
50
50
|
searchd = Riddle::Configuration::Searchd.new
|
51
|
-
|
51
|
+
|
52
52
|
settings.each do |setting|
|
53
53
|
searchd.should respond_to(setting.to_sym)
|
54
54
|
searchd.should respond_to("#{setting}=".to_sym)
|
@@ -109,7 +109,7 @@ searchd
|
|
109
109
|
searchd.port = 3312
|
110
110
|
searchd.pid_file = 'file.pid'
|
111
111
|
searchd.client_key = 'secret'
|
112
|
-
|
112
|
+
|
113
113
|
if Riddle.loaded_version.to_f >= 0.9
|
114
114
|
searchd.render.should == <<-SEARCHD
|
115
115
|
searchd
|
@@ -130,13 +130,13 @@ searchd
|
|
130
130
|
SEARCHD
|
131
131
|
end
|
132
132
|
end
|
133
|
-
|
133
|
+
|
134
134
|
if Riddle.loaded_version.to_f >= 0.9
|
135
135
|
it "should render with mysql41 on the default port if true" do
|
136
136
|
searchd = Riddle::Configuration::Searchd.new
|
137
137
|
searchd.mysql41 = true
|
138
138
|
searchd.pid_file = 'file.pid'
|
139
|
-
|
139
|
+
|
140
140
|
searchd.render.should == <<-SEARCHD
|
141
141
|
searchd
|
142
142
|
{
|
@@ -145,12 +145,12 @@ searchd
|
|
145
145
|
}
|
146
146
|
SEARCHD
|
147
147
|
end
|
148
|
-
|
148
|
+
|
149
149
|
it "should render with mysql41 on a given port" do
|
150
150
|
searchd = Riddle::Configuration::Searchd.new
|
151
151
|
searchd.mysql41 = 9307
|
152
152
|
searchd.pid_file = 'file.pid'
|
153
|
-
|
153
|
+
|
154
154
|
searchd.render.should == <<-SEARCHD
|
155
155
|
searchd
|
156
156
|
{
|
@@ -159,13 +159,13 @@ searchd
|
|
159
159
|
}
|
160
160
|
SEARCHD
|
161
161
|
end
|
162
|
-
|
162
|
+
|
163
163
|
it "allows for both normal and mysql41 connections" do
|
164
164
|
searchd = Riddle::Configuration::Searchd.new
|
165
165
|
searchd.mysql41 = true
|
166
166
|
searchd.port = 9312
|
167
167
|
searchd.pid_file = 'file.pid'
|
168
|
-
|
168
|
+
|
169
169
|
searchd.render.should == <<-SEARCHD
|
170
170
|
searchd
|
171
171
|
{
|
@@ -175,13 +175,13 @@ searchd
|
|
175
175
|
}
|
176
176
|
SEARCHD
|
177
177
|
end
|
178
|
-
|
178
|
+
|
179
179
|
it "uses given address for mysql41 connections" do
|
180
180
|
searchd = Riddle::Configuration::Searchd.new
|
181
181
|
searchd.mysql41 = true
|
182
182
|
searchd.address = '127.0.0.1'
|
183
183
|
searchd.pid_file = 'file.pid'
|
184
|
-
|
184
|
+
|
185
185
|
searchd.render.should == <<-SEARCHD
|
186
186
|
searchd
|
187
187
|
{
|
@@ -190,14 +190,14 @@ searchd
|
|
190
190
|
}
|
191
191
|
SEARCHD
|
192
192
|
end
|
193
|
-
|
193
|
+
|
194
194
|
it "applies the given address to both normal and mysql41 connections" do
|
195
195
|
searchd = Riddle::Configuration::Searchd.new
|
196
196
|
searchd.mysql41 = true
|
197
197
|
searchd.port = 9312
|
198
198
|
searchd.address = 'sphinx.server.local'
|
199
199
|
searchd.pid_file = 'file.pid'
|
200
|
-
|
200
|
+
|
201
201
|
searchd.render.should == <<-SEARCHD
|
202
202
|
searchd
|
203
203
|
{
|
@@ -207,5 +207,22 @@ searchd
|
|
207
207
|
}
|
208
208
|
SEARCHD
|
209
209
|
end
|
210
|
+
|
211
|
+
it 'maintains the address and port settings without rendering them' do
|
212
|
+
searchd = Riddle::Configuration::Searchd.new
|
213
|
+
searchd.port = 9312
|
214
|
+
searchd.address = 'sphinx.server.local'
|
215
|
+
searchd.pid_file = 'file.pid'
|
216
|
+
|
217
|
+
searchd.render.should == <<-SEARCHD
|
218
|
+
searchd
|
219
|
+
{
|
220
|
+
listen = sphinx.server.local:9312
|
221
|
+
pid_file = file.pid
|
222
|
+
}
|
223
|
+
SEARCHD
|
224
|
+
searchd.address.should == 'sphinx.server.local'
|
225
|
+
searchd.port.should == 9312
|
226
|
+
end
|
210
227
|
end
|
211
228
|
end
|
data/spec/unit/message_spec.rb
CHANGED
@@ -1,24 +1,25 @@
|
|
1
|
+
# encoding: BINARY
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Riddle::Client::Message do
|
4
5
|
it "should start with an empty string" do
|
5
6
|
Riddle::Client::Message.new.to_s.should == ""
|
6
7
|
end
|
7
|
-
|
8
|
+
|
8
9
|
it "should append raw data correctly" do
|
9
10
|
data = [1, 2, 3].pack('NNN')
|
10
11
|
message = Riddle::Client::Message.new
|
11
12
|
message.append data
|
12
13
|
message.to_s.should == data
|
13
14
|
end
|
14
|
-
|
15
|
+
|
15
16
|
it "should append strings correctly - with length first" do
|
16
17
|
str = "something to test with"
|
17
18
|
message = Riddle::Client::Message.new
|
18
19
|
message.append_string str
|
19
20
|
message.to_s.should == [str.length].pack('N') + str
|
20
21
|
end
|
21
|
-
|
22
|
+
|
22
23
|
it "should append integers correctly - packed with N" do
|
23
24
|
message = Riddle::Client::Message.new
|
24
25
|
message.append_int 234
|
@@ -54,25 +55,25 @@ describe Riddle::Client::Message do
|
|
54
55
|
message.append_64bit_int "234"
|
55
56
|
message.to_s.should == "\x00\x00\x00\x00\x00\x00\x00\xEA"
|
56
57
|
end
|
57
|
-
|
58
|
+
|
58
59
|
it "should append floats correctly - packed with f" do
|
59
60
|
message = Riddle::Client::Message.new
|
60
61
|
message.append_float 1.4
|
61
62
|
message.to_s.should == [1.4].pack('f').unpack('L*').pack('N')
|
62
63
|
end
|
63
|
-
|
64
|
+
|
64
65
|
it "should append a collection of integers correctly" do
|
65
66
|
message = Riddle::Client::Message.new
|
66
67
|
message.append_ints 1, 2, 3, 4
|
67
68
|
message.to_s.should == [1, 2, 3, 4].pack('NNNN')
|
68
69
|
end
|
69
|
-
|
70
|
+
|
70
71
|
it "should append a collection of floats correctly" do
|
71
72
|
message = Riddle::Client::Message.new
|
72
73
|
message.append_floats 1.0, 1.1, 1.2, 1.3
|
73
74
|
message.to_s.should == [1.0, 1.1, 1.2, 1.3].pack('ffff').unpack('L*L*L*L*').pack('NNNN')
|
74
75
|
end
|
75
|
-
|
76
|
+
|
76
77
|
it "should append an array of strings correctly" do
|
77
78
|
arr = ["a", "bb", "ccc"]
|
78
79
|
message = Riddle::Client::Message.new
|
@@ -80,7 +81,7 @@ describe Riddle::Client::Message do
|
|
80
81
|
message.to_s.should == [3, 1].pack('NN') + "a" + [2].pack('N') + "bb" +
|
81
82
|
[3].pack('N') + "ccc"
|
82
83
|
end
|
83
|
-
|
84
|
+
|
84
85
|
it "should append a variety of objects correctly" do
|
85
86
|
message = Riddle::Client::Message.new
|
86
87
|
message.append_int 4
|
metadata
CHANGED
@@ -1,58 +1,66 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: riddle
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.5.11
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Pat Allan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
requirement:
|
16
|
-
requirements:
|
11
|
+
date: 2014-04-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
17
|
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
18
|
+
- !ruby/object:Gem::Version
|
19
19
|
version: 0.9.2
|
20
|
-
version_requirements: *id001
|
21
20
|
type: :development
|
22
21
|
prerelease: false
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.9.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
27
31
|
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
32
|
+
- !ruby/object:Gem::Version
|
29
33
|
version: 2.5.0
|
30
|
-
version_requirements: *id002
|
31
34
|
type: :development
|
32
35
|
prerelease: false
|
33
|
-
|
34
|
-
|
35
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
37
38
|
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.5.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: yard
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
39
47
|
version: 0.7.2
|
40
|
-
version_requirements: *id003
|
41
48
|
type: :development
|
42
49
|
prerelease: false
|
43
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.7.2
|
44
55
|
description: A Ruby API and configuration helper for the Sphinx search service.
|
45
|
-
email:
|
56
|
+
email:
|
46
57
|
- pat@freelancing-gods.com
|
47
58
|
executables: []
|
48
|
-
|
49
59
|
extensions: []
|
50
|
-
|
51
60
|
extra_rdoc_files: []
|
52
|
-
|
53
|
-
|
54
|
-
- .
|
55
|
-
- .travis.yml
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
56
64
|
- Gemfile
|
57
65
|
- HISTORY
|
58
66
|
- LICENCE
|
@@ -75,6 +83,7 @@ files:
|
|
75
83
|
- lib/riddle/client/message.rb
|
76
84
|
- lib/riddle/client/response.rb
|
77
85
|
- lib/riddle/configuration.rb
|
86
|
+
- lib/riddle/configuration/common.rb
|
78
87
|
- lib/riddle/configuration/distributed_index.rb
|
79
88
|
- lib/riddle/configuration/index.rb
|
80
89
|
- lib/riddle/configuration/index_settings.rb
|
@@ -241,6 +250,7 @@ files:
|
|
241
250
|
- spec/support/binary_fixtures.rb
|
242
251
|
- spec/support/sphinx.rb
|
243
252
|
- spec/unit/client_spec.rb
|
253
|
+
- spec/unit/configuration/common_spec.rb
|
244
254
|
- spec/unit/configuration/distributed_index_spec.rb
|
245
255
|
- spec/unit/configuration/index_spec.rb
|
246
256
|
- spec/unit/configuration/indexer_spec.rb
|
@@ -257,32 +267,30 @@ files:
|
|
257
267
|
- spec/unit/response_spec.rb
|
258
268
|
- spec/unit/riddle_spec.rb
|
259
269
|
homepage: http://pat.github.io/riddle/
|
260
|
-
licenses:
|
270
|
+
licenses:
|
261
271
|
- MIT
|
262
272
|
metadata: {}
|
263
|
-
|
264
273
|
post_install_message:
|
265
274
|
rdoc_options: []
|
266
|
-
|
267
|
-
require_paths:
|
275
|
+
require_paths:
|
268
276
|
- lib
|
269
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
270
|
-
requirements:
|
271
|
-
-
|
272
|
-
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
277
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
278
|
+
requirements:
|
279
|
+
- - ">="
|
280
|
+
- !ruby/object:Gem::Version
|
281
|
+
version: '0'
|
282
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
283
|
+
requirements:
|
284
|
+
- - ">="
|
285
|
+
- !ruby/object:Gem::Version
|
286
|
+
version: '0'
|
278
287
|
requirements: []
|
279
|
-
|
280
288
|
rubyforge_project: riddle
|
281
|
-
rubygems_version: 2.
|
289
|
+
rubygems_version: 2.2.2
|
282
290
|
signing_key:
|
283
291
|
specification_version: 4
|
284
292
|
summary: An API for Sphinx, written in and for Ruby.
|
285
|
-
test_files:
|
293
|
+
test_files:
|
286
294
|
- spec/fixtures/.gitignore
|
287
295
|
- spec/fixtures/data/0.9.9/anchor.bin
|
288
296
|
- spec/fixtures/data/0.9.9/any.bin
|
@@ -429,6 +437,7 @@ test_files:
|
|
429
437
|
- spec/support/binary_fixtures.rb
|
430
438
|
- spec/support/sphinx.rb
|
431
439
|
- spec/unit/client_spec.rb
|
440
|
+
- spec/unit/configuration/common_spec.rb
|
432
441
|
- spec/unit/configuration/distributed_index_spec.rb
|
433
442
|
- spec/unit/configuration/index_spec.rb
|
434
443
|
- spec/unit/configuration/indexer_spec.rb
|