thinking-sphinx 4.3.0 → 4.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30fe9d6940dc5f385310346374829bc1ff941332583060ad549ea8675a6a34ce
4
- data.tar.gz: 4b5a25fe1120cba82bf9bd6b9f80be7e1d5175dce887d8acaffc3ba1da78e458
3
+ metadata.gz: 03cdbbdc5e88bbe791ca53d26ec0408fcc0ac0baa9ab03de58d2e8fb821c7cdd
4
+ data.tar.gz: b6ed1c04b02e2db70606334d7cc5ea715b6540d92d21d9415b47ed0ef02d8a65
5
5
  SHA512:
6
- metadata.gz: f8f25c99b61c6bf80f9a81eb71ab1c1a6af005009099cd18c7ef1a13e694f4e65b7ddc3d654167033ecf0fac072c91d88864d6ab5cf44c5f00fea69447195ce2
7
- data.tar.gz: b78abfa34ebcfb24ed65e99b07dfb04dc545cc2be74c994a9b786a507b8b69bfa46afce05c74830dfde5bebc6b823e0d44b3073637967090b35ffe85c9629b41
6
+ metadata.gz: 2731b4341a0eb74f3c0312d4535a1cbc1c8b50e4694ce1a61c5c7fc54981b02b3336467779a9beb437013eea812ee6e1eb9c81e9905247f35b094575e6a7de6d
7
+ data.tar.gz: 0f3b3eb6a3437100e8337465610cf1eca9c6ae7d5159838cfe0011748e87f59bace8e6cd5c4a199f3dd87dd63ce8048bae5aa0ddd88a72e9d95973e18d88204d
@@ -2,13 +2,21 @@
2
2
 
3
3
  All notable changes to this project (at least, from v3.0.0 onwards) are documented in this file.
4
4
 
5
+ ## 4.3.1 - 2019-06-27
6
+
7
+ [Release Notes](https://github.com/pat/thinking-sphinx/releases/tag/v4.3.1)
8
+
9
+ ### Fixed
10
+
11
+ * Fixed loading of index files to work with Rails 6 and Zeitwerk ([#1137](https://github.com/pat/thinking-sphinx/issues/1137)).
12
+
5
13
  ## 4.3.0 - 2019-05-18
6
14
 
7
15
  [Release Notes](https://github.com/pat/thinking-sphinx/releases/tag/v4.3.0)
8
16
 
9
17
  ### Added
10
18
 
11
- * Allow overriding of Sphinx's running state, which is useful when Sphinx commands are interacting with a remote Sphinx daemon. As per discussions in [#1131](https://github.com/pat/thinking-sphinx/pull/1124).
19
+ * Allow overriding of Sphinx's running state, which is useful when Sphinx commands are interacting with a remote Sphinx daemon. As per discussions in [#1131](https://github.com/pat/thinking-sphinx/pull/1131).
12
20
  * Allow skipping of directory creation, as per discussions in [#1131](https://github.com/pat/thinking-sphinx/pull/1131).
13
21
 
14
22
  ### Fixed
@@ -1,6 +1,6 @@
1
1
  h1. Thinking Sphinx
2
2
 
3
- Thinking Sphinx is a library for connecting ActiveRecord to the Sphinx full-text search tool, and integrates closely with Rails (but also works with other Ruby web frameworks). The current release is v4.3.0.
3
+ Thinking Sphinx is a library for connecting ActiveRecord to the Sphinx full-text search tool, and integrates closely with Rails (but also works with other Ruby web frameworks). The current release is v4.3.1.
4
4
 
5
5
  h2. Upgrading
6
6
 
@@ -87,9 +87,7 @@ class ThinkingSphinx::Configuration < Riddle::Configuration
87
87
  return if @preloaded_indices
88
88
 
89
89
  index_paths.each do |path|
90
- Dir["#{path}/**/*.rb"].sort.each do |file|
91
- ActiveSupport::Dependencies.require_or_load file
92
- end
90
+ Dir["#{path}/**/*.rb"].sort.each { |file| preload_index file }
93
91
  end
94
92
 
95
93
  normalise
@@ -99,6 +97,14 @@ class ThinkingSphinx::Configuration < Riddle::Configuration
99
97
  end
100
98
  end
101
99
 
100
+ def preload_index(file)
101
+ if ActiveRecord::VERSION::MAJOR < 5
102
+ ActiveSupport::Dependencies.require_or_load file
103
+ else
104
+ load file
105
+ end
106
+ end
107
+
102
108
  def render
103
109
  preload_indices
104
110
 
@@ -4,11 +4,18 @@ require 'spec_helper'
4
4
 
5
5
  describe ThinkingSphinx::Configuration do
6
6
  let(:config) { ThinkingSphinx::Configuration.instance }
7
+ let(:use_load?) { ActiveRecord::VERSION::MAJOR >= 5 }
8
+ let(:loading_object) { use_load? ? config : ActiveSupport::Dependencies }
9
+ let(:loading_method) { use_load? ? :load : :require_or_load }
7
10
 
8
11
  after :each do
9
12
  ThinkingSphinx::Configuration.reset
10
13
  end
11
14
 
15
+ def expect_loading_of(file)
16
+ expect(loading_object).to receive(loading_method).with(file).once
17
+ end
18
+
12
19
  describe '.instance' do
13
20
  it "returns an instance of ThinkingSphinx::Configuration" do
14
21
  expect(ThinkingSphinx::Configuration.instance).
@@ -254,10 +261,8 @@ describe ThinkingSphinx::Configuration do
254
261
  '/path/to/indices/bar_index.rb'
255
262
  ]
256
263
 
257
- expect(ActiveSupport::Dependencies).to receive(:require_or_load).
258
- with('/path/to/indices/foo_index.rb').once
259
- expect(ActiveSupport::Dependencies).to receive(:require_or_load).
260
- with('/path/to/indices/bar_index.rb').once
264
+ expect_loading_of('/path/to/indices/foo_index.rb')
265
+ expect_loading_of('/path/to/indices/bar_index.rb')
261
266
 
262
267
  config.preload_indices
263
268
  end
@@ -269,10 +274,8 @@ describe ThinkingSphinx::Configuration do
269
274
  '/path/to/indices/bar_index.rb'
270
275
  ]
271
276
 
272
- expect(ActiveSupport::Dependencies).to receive(:require_or_load).
273
- with('/path/to/indices/foo_index.rb').once
274
- expect(ActiveSupport::Dependencies).to receive(:require_or_load).
275
- with('/path/to/indices/bar_index.rb').once
277
+ expect_loading_of('/path/to/indices/foo_index.rb')
278
+ expect_loading_of('/path/to/indices/bar_index.rb')
276
279
 
277
280
  config.preload_indices
278
281
  config.preload_indices
@@ -316,10 +319,8 @@ describe ThinkingSphinx::Configuration do
316
319
  '/path/to/indices/bar_index.rb'
317
320
  ]
318
321
 
319
- expect(ActiveSupport::Dependencies).to receive(:require_or_load).
320
- with('/path/to/indices/foo_index.rb').once
321
- expect(ActiveSupport::Dependencies).to receive(:require_or_load).
322
- with('/path/to/indices/bar_index.rb').once
322
+ expect_loading_of('/path/to/indices/foo_index.rb')
323
+ expect_loading_of('/path/to/indices/bar_index.rb')
323
324
 
324
325
  config.render
325
326
  end
@@ -331,10 +332,8 @@ describe ThinkingSphinx::Configuration do
331
332
  '/path/to/indices/bar_index.rb'
332
333
  ]
333
334
 
334
- expect(ActiveSupport::Dependencies).to receive(:require_or_load).
335
- with('/path/to/indices/foo_index.rb').once
336
- expect(ActiveSupport::Dependencies).to receive(:require_or_load).
337
- with('/path/to/indices/bar_index.rb').once
335
+ expect_loading_of('/path/to/indices/foo_index.rb')
336
+ expect_loading_of('/path/to/indices/bar_index.rb')
338
337
 
339
338
  config.preload_indices
340
339
  config.preload_indices
@@ -372,6 +371,8 @@ describe ThinkingSphinx::Configuration do
372
371
  end
373
372
 
374
373
  it "skips creating a directory when the binlog_path is blank" do
374
+ allow(loading_object).to receive(loading_method)
375
+
375
376
  allow(FileUtils).to receive_messages :mkdir_p => true
376
377
  allow(config).to receive_messages :searchd => double(:binlog_path => '')
377
378
 
@@ -5,7 +5,7 @@ $:.push File.expand_path('../lib', __FILE__)
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'thinking-sphinx'
8
- s.version = '4.3.0'
8
+ s.version = '4.3.1'
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.authors = ["Pat Allan"]
11
11
  s.email = ["pat@freelancing-gods.com"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thinking-sphinx
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Allan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-18 00:00:00.000000000 Z
11
+ date: 2019-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -521,8 +521,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
521
521
  - !ruby/object:Gem::Version
522
522
  version: '0'
523
523
  requirements: []
524
- rubyforge_project: thinking-sphinx
525
- rubygems_version: 2.7.6.2
524
+ rubygems_version: 3.0.3
526
525
  signing_key:
527
526
  specification_version: 4
528
527
  summary: A smart wrapper over Sphinx for ActiveRecord