flying-sphinx 2.1.4 → 2.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/.travis.yml +6 -5
- data/Appraisals +4 -0
- data/CHANGELOG.markdown +10 -0
- data/README.textile +1 -1
- data/flying-sphinx.gemspec +2 -2
- data/lib/flying_sphinx/configuration_options.rb +4 -6
- data/lib/flying_sphinx/setting_files.rb +20 -3
- data/lib/flying_sphinx/version.rb +1 -1
- data/spec/acceptance/configuring_spec.rb +1 -1
- data/spec/flying_sphinx/setting_files_spec.rb +36 -18
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f6ae3a86fa09f28adfe144f1e33ebc0cbd16e612146f77dd14634616a9de420
|
4
|
+
data.tar.gz: b7945e84452327eac48a975da634cb196d619c602a16233d7fe9f58f0aeb31a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4aa2d490c2d47ba961ad9c8cc5eb6b98c88df1ebbe12f20fcec691cfa02ebb2b87bdccfdee1121c2956b19c97239c3e1f228b1d90e6480db8d7ccdc5b09af18b
|
7
|
+
data.tar.gz: 91e86268a161e4d3fb1505132f982b09fa5114e567bfdfabed01f2a3f2b25b6364e975a601e8eb588e772ead7cdc3b9b29e398964a3f0ab211e446020121e995
|
data/.travis.yml
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.
|
4
|
-
- 2.
|
5
|
-
- 2.
|
6
|
-
- 2.
|
3
|
+
- 2.3.8
|
4
|
+
- 2.4.5
|
5
|
+
- 2.5.3
|
6
|
+
- 2.6.1
|
7
7
|
before_install:
|
8
|
-
- gem install bundler
|
9
8
|
- gem update --system
|
9
|
+
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
10
|
+
- gem install bundler -v '< 2'
|
10
11
|
before_script:
|
11
12
|
- bundle exec appraisal install
|
12
13
|
cache: bundler
|
data/Appraisals
CHANGED
data/CHANGELOG.markdown
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project (at least, from v0.4.0 onwards) are documented in this file.
|
4
4
|
|
5
|
+
## 2.2.0 - 2020-04-04
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
* The `lemmatizer_base` option is now respected and files in that specified directory are copied to the Flying Sphinx servers as part of the configure command.
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
* Official support for Ruby 2.2 has ended. The gem may continue to work, but there is no guarantee of ongoing compatibility.
|
14
|
+
|
5
15
|
## 2.1.4 - 2019-03-10
|
6
16
|
|
7
17
|
### Fixed
|
data/README.textile
CHANGED
@@ -12,7 +12,7 @@ This is all covered pretty well on "the Flying Sphinx site":http://flying-sphinx
|
|
12
12
|
|
13
13
|
h2. Compatibility and Limitations
|
14
14
|
|
15
|
-
The current (2.x) releases support Thinking Sphinx v4+, ActiveRecord/Rails 3.2+, and Ruby 2.2
|
15
|
+
The current (2.x) releases support Thinking Sphinx v4+, ActiveRecord/Rails 3.2+, and Ruby 2.3+. Ruby 2.2.x will probably work well too, but is not tested against, and thus not officially supported.
|
16
16
|
|
17
17
|
If you are using older versions of any of these, please use v1.3.1 (which supports Thinking Sphinx v1.5+, ActiveRecord/Rails 2.3.6+, and Ruby 1.9.3+).
|
18
18
|
|
data/flying-sphinx.gemspec
CHANGED
@@ -27,9 +27,9 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.add_development_dependency 'appraisal', '~> 2.2'
|
28
28
|
s.add_development_dependency 'dotenv', '~> 0.11.1'
|
29
29
|
s.add_development_dependency 'em-websocket', '~> 0.5.1'
|
30
|
-
s.add_development_dependency 'mysql2', '
|
30
|
+
s.add_development_dependency 'mysql2', '>= 0.3.15'
|
31
31
|
s.add_development_dependency 'rack'
|
32
32
|
s.add_development_dependency 'rspec', '~> 2.14'
|
33
33
|
s.add_development_dependency 'rspec-retry', '~> 0.4'
|
34
|
-
s.add_development_dependency 'webmock', '~>
|
34
|
+
s.add_development_dependency 'webmock', '~> 3.8'
|
35
35
|
end
|
@@ -8,7 +8,10 @@ class FlyingSphinx::ConfigurationOptions
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def settings
|
11
|
-
@settings ||=
|
11
|
+
@settings ||= begin
|
12
|
+
configuration.render
|
13
|
+
FlyingSphinx::SettingFiles.new(configuration).to_hash
|
14
|
+
end
|
12
15
|
end
|
13
16
|
|
14
17
|
def version
|
@@ -21,11 +24,6 @@ class FlyingSphinx::ConfigurationOptions
|
|
21
24
|
@configuration ||= ThinkingSphinx::Configuration.instance
|
22
25
|
end
|
23
26
|
|
24
|
-
def indices
|
25
|
-
configuration.render
|
26
|
-
configuration.indices
|
27
|
-
end
|
28
|
-
|
29
27
|
def version_defined?
|
30
28
|
configuration.version.present?
|
31
29
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
class FlyingSphinx::SettingFiles
|
2
2
|
INDEX_SETTINGS = [:stopwords, :wordforms, :exceptions]
|
3
3
|
SOURCE_SETTINGS = [:mysql_ssl_cert, :mysql_ssl_key, :mysql_ssl_ca]
|
4
|
+
COMMON_SETTINGS = [:lemmatizer_base]
|
4
5
|
|
5
|
-
def initialize(
|
6
|
-
@
|
6
|
+
def initialize(configuration)
|
7
|
+
@configuration = configuration
|
7
8
|
end
|
8
9
|
|
9
10
|
def to_hash
|
@@ -19,11 +20,27 @@ class FlyingSphinx::SettingFiles
|
|
19
20
|
|
20
21
|
private
|
21
22
|
|
22
|
-
attr_reader :
|
23
|
+
attr_reader :configuration
|
24
|
+
|
25
|
+
delegate :indices, :to => :configuration
|
26
|
+
|
27
|
+
def common_settings(&block)
|
28
|
+
return unless configuration.respond_to?(:common)
|
29
|
+
|
30
|
+
COMMON_SETTINGS.each do |setting|
|
31
|
+
path = configuration.common.public_send(setting)
|
32
|
+
next if path.nil?
|
33
|
+
|
34
|
+
Dir["#{path}/**/*"].each do |file|
|
35
|
+
block.call setting, file
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
23
39
|
|
24
40
|
def each_file_for_setting(&block)
|
25
41
|
index_settings &block
|
26
42
|
source_settings &block
|
43
|
+
common_settings &block
|
27
44
|
end
|
28
45
|
|
29
46
|
def index_settings(&block)
|
@@ -4,7 +4,7 @@ require 'cgi'
|
|
4
4
|
describe 'Configuring Sphinx' do
|
5
5
|
let(:interface) { ThinkingSphinx.rake_interface.new }
|
6
6
|
let(:configuration) { configuration_double :indices => [double('Index')],
|
7
|
-
:render => 'searchd { }', :version => '2.2.11' }
|
7
|
+
:render => 'searchd { }', :version => '2.2.11', :common => double('common', lemmatizer_base: nil) }
|
8
8
|
|
9
9
|
before :each do
|
10
10
|
allow(ThinkingSphinx::Configuration).to receive(:instance).
|
@@ -1,8 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe FlyingSphinx::SettingFiles do
|
4
|
-
let(:files) { FlyingSphinx::SettingFiles.new
|
4
|
+
let(:files) { FlyingSphinx::SettingFiles.new configuration }
|
5
|
+
let(:configuration) do
|
6
|
+
double(:configuration, :indices => indices, :common => common)
|
7
|
+
end
|
5
8
|
let(:indices) { [] }
|
9
|
+
let(:common) { double(:common, :lemmatizer_base => nil) }
|
6
10
|
|
7
11
|
def index_double(methods)
|
8
12
|
double 'Riddle::Configuration::Index', methods
|
@@ -14,38 +18,38 @@ describe FlyingSphinx::SettingFiles do
|
|
14
18
|
|
15
19
|
describe '#to_hash' do
|
16
20
|
before :each do
|
17
|
-
File.
|
21
|
+
allow(File).to receive(:read).and_return('blah')
|
18
22
|
end
|
19
23
|
|
20
24
|
[:stopwords, :wordforms, :exceptions].each do |setting|
|
21
25
|
it "collects #{setting} files from indices" do
|
22
26
|
indices << index_double(setting => '/my/file/foo.txt')
|
23
27
|
|
24
|
-
files.to_hash.
|
28
|
+
expect(files.to_hash).to eq(
|
25
29
|
"#{setting}/foo.txt" => 'blah',
|
26
30
|
'extra' => "#{setting}/foo.txt"
|
27
|
-
|
31
|
+
)
|
28
32
|
end
|
29
33
|
|
30
34
|
it "does not repeat same files for #{setting}" do
|
31
35
|
indices << index_double(setting => '/my/file/foo.txt')
|
32
36
|
indices << index_double(setting => '/my/file/foo.txt')
|
33
37
|
|
34
|
-
files.to_hash.
|
38
|
+
expect(files.to_hash).to eq(
|
35
39
|
"#{setting}/foo.txt" => 'blah',
|
36
40
|
'extra' => "#{setting}/foo.txt"
|
37
|
-
|
41
|
+
)
|
38
42
|
end
|
39
43
|
|
40
44
|
it "accepts multiples files for #{setting}" do
|
41
45
|
indices << index_double(
|
42
46
|
setting => '/my/file/foo.txt /my/file/bar.txt')
|
43
47
|
|
44
|
-
files.to_hash["#{setting}/foo.txt"].
|
45
|
-
files.to_hash["#{setting}/bar.txt"].
|
46
|
-
files.to_hash['extra'].split(';').
|
48
|
+
expect(files.to_hash["#{setting}/foo.txt"]).to eq('blah')
|
49
|
+
expect(files.to_hash["#{setting}/bar.txt"]).to eq('blah')
|
50
|
+
expect(files.to_hash['extra'].split(';')).to match_array([
|
47
51
|
"#{setting}/foo.txt", "#{setting}/bar.txt"
|
48
|
-
]
|
52
|
+
])
|
49
53
|
end
|
50
54
|
end
|
51
55
|
|
@@ -54,10 +58,10 @@ describe FlyingSphinx::SettingFiles do
|
|
54
58
|
indices << index_double(:sources => [
|
55
59
|
source_double(setting => '/my/file/foo.txt')])
|
56
60
|
|
57
|
-
files.to_hash.
|
61
|
+
expect(files.to_hash).to eq(
|
58
62
|
"#{setting}/foo.txt" => 'blah',
|
59
63
|
'extra' => "#{setting}/foo.txt"
|
60
|
-
|
64
|
+
)
|
61
65
|
end
|
62
66
|
|
63
67
|
it "does not repeat same files for #{setting}" do
|
@@ -66,21 +70,35 @@ describe FlyingSphinx::SettingFiles do
|
|
66
70
|
indices << index_double(:sources => [
|
67
71
|
source_double(setting => '/my/file/foo.txt')])
|
68
72
|
|
69
|
-
files.to_hash.
|
73
|
+
expect(files.to_hash).to eq(
|
70
74
|
"#{setting}/foo.txt" => 'blah',
|
71
75
|
'extra' => "#{setting}/foo.txt"
|
72
|
-
|
76
|
+
)
|
73
77
|
end
|
74
78
|
|
75
79
|
it "accepts multiples files for #{setting}" do
|
76
80
|
indices << index_double(:sources => [
|
77
81
|
source_double(setting => '/my/file/foo.txt /my/file/bar.txt')])
|
78
82
|
|
79
|
-
files.to_hash["#{setting}/foo.txt"].
|
80
|
-
files.to_hash["#{setting}/bar.txt"].
|
81
|
-
files.to_hash['extra'].split(';').
|
83
|
+
expect(files.to_hash["#{setting}/foo.txt"]).to eq('blah')
|
84
|
+
expect(files.to_hash["#{setting}/bar.txt"]).to eq('blah')
|
85
|
+
expect(files.to_hash['extra'].split(';')).to match_array([
|
82
86
|
"#{setting}/foo.txt", "#{setting}/bar.txt"
|
83
|
-
]
|
87
|
+
])
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
[:lemmatizer_base].each do |setting|
|
92
|
+
it "collects #{setting} files from sources" do
|
93
|
+
allow(common).to receive(setting).and_return("/my/path")
|
94
|
+
|
95
|
+
allow(Dir).to receive(:[]).with("/my/path/**/*").
|
96
|
+
and_return(["/my/path/foo.txt"])
|
97
|
+
|
98
|
+
expect(files.to_hash).to eq(
|
99
|
+
"#{setting}/foo.txt" => 'blah',
|
100
|
+
'extra' => "#{setting}/foo.txt"
|
101
|
+
)
|
84
102
|
end
|
85
103
|
end
|
86
104
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flying-sphinx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Allan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ey-hmac
|
@@ -140,14 +140,14 @@ dependencies:
|
|
140
140
|
name: mysql2
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: 0.3.15
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 0.3.15
|
153
153
|
- !ruby/object:Gem::Dependency
|
@@ -198,14 +198,14 @@ dependencies:
|
|
198
198
|
requirements:
|
199
199
|
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
201
|
+
version: '3.8'
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
208
|
+
version: '3.8'
|
209
209
|
description: Hooks Thinking Sphinx into the Flying Sphinx service
|
210
210
|
email: pat@freelancing-gods.com
|
211
211
|
executables:
|