ts-resque-delta 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2584321ee1b15d855877ef9fb3dc0b4d0719c21e
4
- data.tar.gz: fc74627b7a3265a8cafe125ab59585c8de2e2a0c
2
+ SHA256:
3
+ metadata.gz: c2fc9168de9bac099a5bacaaa4b1b8da790abea571158e5ed8a31a8148b17193
4
+ data.tar.gz: 0e995d85eeda921523fb01cedbd2cacece23f94577967fab7ea71d724a708870
5
5
  SHA512:
6
- metadata.gz: 7380a6e12204a7e6ea243c6c2f6726f637e7125b37b1d09fb88ab93169e78820127b1d28dc07bcff23e0b4199f117a1ef0a147664c2fc64188c026884d1c0dff
7
- data.tar.gz: a00d91e7bddb444c493fc4fb7ae74167b0b7af598e9d78f5a8790aafd53cfcc730439b81e99520658c1f657eccd015acce30bb6e0ce7b931b793f529f170ef33
6
+ metadata.gz: 52177488504d0596050803df383fdde379dbb53b0722f4a8c981fa62c9a48332edec0ba0e97907b8cf521260f459b96cb45cec681fe334fdda9c1950a6b73f31
7
+ data.tar.gz: d2f8246a0cecf69db0ed889bddf330f21dfcc9660c893cf58083310d29611e87b3de0b8bebcda6403f4d5150a43d9b0bec628cedce45d9cca34532eb961272c3
data/.travis.yml CHANGED
@@ -8,8 +8,6 @@ before_install:
8
8
  before_script:
9
9
  - "mysql -e 'create database thinking_sphinx;' > /dev/null"
10
10
  - "psql -c 'create database thinking_sphinx;' -U postgres > /dev/null"
11
- services:
12
- - redis-server
13
11
  env:
14
12
  - SPHINX_BIN=/usr/local/sphinx-2.0.9/bin/ SPHINX_VERSION=2.0.9 DATABASE=mysql2
15
13
  - SPHINX_BIN=/usr/local/sphinx-2.0.9/bin/ SPHINX_VERSION=2.0.9 DATABASE=postgresql
data/README.markdown CHANGED
@@ -7,56 +7,56 @@ Delayed Deltas for Thinking Sphinx (with Resque)
7
7
 
8
8
  Installation
9
9
  ------------
10
+ This gem depends on the following gems: _thinking-sphinx_, _resque_, and
11
+ _resque-lock-timeout_.
10
12
 
11
- This gem depends on the following gems: `thinking-sphinx` and `resque`.
13
+ gem install ts-resque-delta
12
14
 
13
- Currently, you'll need Thinking Sphinx v1.5.0 (for Rails 2), v2.1.0
14
- (for Rails 3), or - ideally - v3.0.3 or newer (for Rails 3.1 onwards). If you're
15
- on a version of Thinking Sphinx that's too old, you better go upgrade - but
16
- otherwise, add `ts-resque-delta` to your `Gemfile` file with the rest of your
17
- gem dependencies:
15
+ Add _ts-resque-delta_ to your **Gemfile** file, with the rest of your gem
16
+ dependencies:
18
17
 
19
- gem 'ts-resque-delta', '~> 2.0.0'
18
+ gem 'ts-resque-delta', '~> 2.1'
20
19
 
21
- Add the delta property to index definition. If you're using Thinking Sphinx v3,
22
- then it'll look something like this:
20
+ If you're using Rails 3, the rake tasks will automatically be loaded by Rails.
21
+ If you're using Rails 2, add the following line to your **Rakefile**:
23
22
 
24
- ThinkingSphinx::Index.define(:article,
25
- :with => :active_record,
26
- :delta => ThinkingSphinx::Deltas::ResqueDelta
27
- ) do
28
- # fields and attributes and so on...
29
- end
23
+ require 'thinking_sphinx/deltas/resque_delta/tasks'
30
24
 
31
- But if you're still using v1.5 or v2.1, you'll want the following:
25
+ Add the delta property to each `define_index` block:
32
26
 
33
27
  define_index do
34
- # fields and attributes and so on...
35
-
28
+ # ...
36
29
  set_property :delta => ThinkingSphinx::Deltas::ResqueDelta
37
30
  end
38
31
 
39
- If you've never used delta indexes before, you'll need to add the boolean
40
- column named `:delta` to each table for indexed models. A database index for
41
- that column is also recommended.
32
+ If you've never used delta indexes before, you'll want to add the boolean
33
+ column named `:delta` to each model's table (note, you must set the `:default`
34
+ value to `true`):
35
+
36
+ def self.up
37
+ add_column :foos, :delta, :boolean, :default => true, :null => false
38
+ end
39
+
40
+ Also, I highly recommend adding a MySQL index to the table of any model using
41
+ delta indexes. The Sphinx indexer uses `WHERE table.delta = 1` whenever the
42
+ delta indexer runs and `... = 0` whenever the normal indexer runs. Having the
43
+ MySQL index on the delta column will generally be a win:
42
44
 
43
- def change
44
- add_column :articles, :delta, :boolean, :default => true, :null => false
45
- add_index :articles, :delta
45
+ def self.up
46
+ # ...
47
+ add_index :foos, :delta
46
48
  end
47
49
 
48
50
  Usage
49
51
  -----
50
-
51
52
  Once you've got it all set up, all you need to do is make sure that the Resque
52
- worker is running. You can do this by specifying the `ts_delta` queue when
53
+ worker is running. You can do this by specifying the `:ts_delta` queue when
53
54
  running Resque:
54
55
 
55
56
  QUEUE=ts_delta,other_queues rake resque:work
56
57
 
57
58
  Contributors (for ts-resque-delta)
58
59
  -----------------------------------
59
-
60
60
  * [Aaron Gibralter](https://github.com/agibralter)
61
61
  * [Ryan Schlesinger](https://github.com/ryansch) (Locking/`smart_index`)
62
62
  * [Pat Allan](https://github.com/freelancing-god) (FlyingSphinx support)
@@ -64,7 +64,6 @@ Contributors (for ts-resque-delta)
64
64
 
65
65
  Original Contributors (for ts-delayed-delta)
66
66
  --------------------------------------------
67
-
68
67
  * [Pat Allan](https://github.com/freelancing-god)
69
68
  * [Ryan Schlesinger](https://github.com/ryansch) (Allowing installs as a plugin)
70
69
  * [Maximilian Schulz](https://max.jungeelite.de) (Ensuring compatibility with Bundler)
@@ -73,6 +72,4 @@ Original Contributors (for ts-delayed-delta)
73
72
 
74
73
  Copyright
75
74
  ---------
76
-
77
- Copyright (c) 2011-2014 Aaron Gibralter and Pat Allan, and released under an MIT
78
- Licence.
75
+ Copyright (c) 2011 Aaron Gibralter, and released under an MIT Licence.
@@ -1,50 +1,46 @@
1
1
  require 'acceptance/spec_helper'
2
2
 
3
3
  describe 'SQL delta indexing', :live => true do
4
- def sleep_for_sphinx
5
- sleep ENV['CI'] ? 1.0 : 0.25
6
- end
7
-
8
4
  it "automatically indexes new records" do
9
5
  guards = Book.create(
10
6
  :title => 'Guards! Guards!', :author => 'Terry Pratchett'
11
7
  )
12
8
  index
13
9
 
14
- Book.search('Terry Pratchett').to_a.should == [guards]
10
+ expect(Book.search('Terry Pratchett').to_a).to eq([guards])
15
11
 
16
12
  men = Book.create(
17
13
  :title => 'Men At Arms', :author => 'Terry Pratchett'
18
14
  )
19
15
  work
20
- sleep_for_sphinx
16
+ sleep 0.25
21
17
 
22
- Book.search('Terry Pratchett').to_a.should == [guards, men]
18
+ expect(Book.search('Terry Pratchett').to_a).to eq([guards, men])
23
19
  end
24
20
 
25
21
  it "automatically indexes updated records" do
26
22
  book = Book.create :title => 'Night Watch', :author => 'Harry Pritchett'
27
23
  index
28
24
 
29
- Book.search('Harry').to_a.should == [book]
25
+ expect(Book.search('Harry').to_a).to eq([book])
30
26
 
31
- book.reload.update_attributes(:author => 'Terry Pratchett')
27
+ book.reload.update(:author => 'Terry Pratchett')
32
28
  work
33
- sleep_for_sphinx
29
+ sleep 0.25
34
30
 
35
- Book.search('Terry').to_a.should == [book]
31
+ expect(Book.search('Terry').to_a).to eq([book])
36
32
  end
37
33
 
38
34
  it "does not match on old values" do
39
35
  book = Book.create :title => 'Night Watch', :author => 'Harry Pritchett'
40
36
  index
41
37
 
42
- Book.search('Harry').to_a.should == [book]
38
+ expect(Book.search('Harry').to_a).to eq([book])
43
39
 
44
- book.reload.update_attributes(:author => 'Terry Pratchett')
40
+ book.reload.update(:author => 'Terry Pratchett')
45
41
  work
46
- sleep_for_sphinx
42
+ sleep 0.25
47
43
 
48
- Book.search('Harry').should be_empty
44
+ expect(Book.search('Harry')).to be_empty
49
45
  end
50
46
  end
@@ -3,7 +3,7 @@ RSpec.configure do |config|
3
3
  DatabaseCleaner.strategy = :truncation
4
4
  end
5
5
 
6
- config.after(:each) do
6
+ config.after(:each) do |example|
7
7
  if example.example_group_instance.class.metadata[:live]
8
8
  DatabaseCleaner.clean
9
9
  end
@@ -1,4 +1,8 @@
1
1
  class Book < ActiveRecord::Base
2
+ ThinkingSphinx::Callbacks.append(
3
+ self, :behaviours => [:sql, :deltas, :updates]
4
+ )
5
+
2
6
  define_index do
3
7
  indexes title, author
4
8
 
@@ -1,5 +1,27 @@
1
+ <%
2
+ socket = [
3
+ ENV["MYSQL_SOCKET"],
4
+ "/var/run/mysql5/mysqld.sock",
5
+ "/tmp/mysql.sock"
6
+ ].detect { |f| f && File.exist?(f) }
7
+ %>
8
+
1
9
  test:
2
10
  adapter: <%= ENV['DATABASE'] || 'mysql2' %>
3
11
  database: thinking_sphinx
4
- username: <%= ENV['DATABASE'] == 'postgresql' ? ENV['USER'] : 'root' %>
12
+ username: "<%= ENV['DATABASE'] == 'postgresql' ? ENV['USER'] : 'root' %>"
13
+ password: "<%= ENV['PASSWORD'] || 'root' %>"
5
14
  min_messages: warning
15
+ pool: 1000
16
+ encoding: utf8mb4
17
+ collation: utf8mb4_unicode_ci # rails 6 PR: https://github.com/rails/rails/pull/33608/files
18
+ <% if socket %>
19
+ host: <%= ENV["MYSQL_HOST"] || "0.0.0.0" %>
20
+ socket: <%= socket %>
21
+ <% else %>
22
+ host: <%= ENV["MYSQL_HOST"] || "0.0.0.0" %>
23
+ port: <%= ENV["MYSQL_PORT"] || "3306" %>
24
+ <% end %>
25
+ sql_mode: TRADITIONAL
26
+ variables:
27
+ sql_mode: TRADITIONAL
@@ -9,21 +9,20 @@ describe ThinkingSphinx::Deltas::ResqueDelta::DeltaJob do
9
9
  let(:job) { double 'Job', :perform => true }
10
10
 
11
11
  before :each do
12
- ThinkingSphinx::Deltas::ResqueDelta.stub :locked? => false
13
- ThinkingSphinx::Deltas::IndexJob.stub :new => job
12
+ allow(ThinkingSphinx::Deltas::ResqueDelta).to receive(:locked?).and_return(false)
13
+ allow(ThinkingSphinx::Deltas::IndexJob).to receive(:new).and_return(job)
14
14
  end
15
15
 
16
16
  it "sets up the internal Thinking Sphinx job with the provided index" do
17
- ThinkingSphinx::Deltas::IndexJob.should_receive(:new).with('foo_delta').
18
- and_return(job)
19
-
20
17
  subject.perform 'foo_delta'
18
+ expect(ThinkingSphinx::Deltas::IndexJob).to have_received(:new).with('foo_delta')
21
19
  end
22
20
 
23
- it "should execute the internal job" do
24
- job.should_receive :perform
21
+ it "executes the internal job" do
22
+ allow(job).to receive(:perform)
25
23
 
26
24
  subject.perform 'foo_delta'
25
+ expect(job).to have_received(:perform)
27
26
  end
28
27
  end
29
28
  end
@@ -20,9 +20,9 @@ describe ThinkingSphinx::Deltas::ResqueDelta do
20
20
  Resque.enqueue(RandomJob, '1234')
21
21
  end
22
22
 
23
- it 'should remove all jobs' do
23
+ it 'removes all jobs' do
24
24
  subject
25
- Resque.size('ts_delta').should eq(0)
25
+ expect(Resque.size('ts_delta')).to eq(0)
26
26
  end
27
27
  end
28
28
  end
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'ts-resque-delta'
4
- s.version = '2.0.0'
4
+ s.version = '2.1.0'
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = ['Aaron Gibralter', 'Pat Allan']
7
7
  s.email = ['aaron.gibralter@gmail.com']
@@ -17,16 +17,17 @@ Gem::Specification.new do |s|
17
17
  s.require_paths = ['lib']
18
18
 
19
19
  s.add_dependency 'thinking-sphinx', '>= 1.5.0'
20
- s.add_dependency 'resque', '~> 1.10'
20
+ s.add_dependency 'resque', '>= 1.10'
21
21
 
22
- s.add_development_dependency 'activerecord', '~> 3.2'
23
- s.add_development_dependency 'activesupport', '~> 3.2'
24
- s.add_development_dependency 'appraisal', '~> 0.4.1'
25
- s.add_development_dependency 'combustion', '~> 0.4.0'
26
- s.add_development_dependency 'database_cleaner', '~> 0.7.1'
27
- s.add_development_dependency 'mock_redis', '~> 0.12.1'
28
- s.add_development_dependency 'mysql2', '~> 0.3.12b4'
29
- s.add_development_dependency 'pg', '~> 0.11'
30
- s.add_development_dependency 'rake', '>= 0.9.2'
31
- s.add_development_dependency 'rspec', '~> 2.11.0'
22
+ s.add_development_dependency 'activerecord', '< 7'
23
+ s.add_development_dependency 'activesupport', '< 7'
24
+
25
+ s.add_development_dependency 'appraisal', '~> 2.4.1'
26
+ s.add_development_dependency 'combustion', '~> 1.3.7'
27
+ s.add_development_dependency 'database_cleaner', '~> 2.0.1'
28
+ s.add_development_dependency 'mock_redis', '~> 0.34.0'
29
+ s.add_development_dependency 'mysql2', '~> 0.5.4'
30
+ s.add_development_dependency 'pg', '~> 1.4.4'
31
+ s.add_development_dependency 'rake', '~> 13.0.6'
32
+ s.add_development_dependency 'rspec', '~> 3.12.0'
32
33
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ts-resque-delta
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Gibralter
8
8
  - Pat Allan
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-21 00:00:00.000000000 Z
12
+ date: 2023-01-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thinking-sphinx
@@ -29,156 +29,156 @@ dependencies:
29
29
  name: resque
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '1.10'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '1.10'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: activerecord
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - "<"
47
47
  - !ruby/object:Gem::Version
48
- version: '3.2'
48
+ version: '7'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - "<"
54
54
  - !ruby/object:Gem::Version
55
- version: '3.2'
55
+ version: '7'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: activesupport
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - "<"
61
61
  - !ruby/object:Gem::Version
62
- version: '3.2'
62
+ version: '7'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - "<"
68
68
  - !ruby/object:Gem::Version
69
- version: '3.2'
69
+ version: '7'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: appraisal
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: 0.4.1
76
+ version: 2.4.1
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: 0.4.1
83
+ version: 2.4.1
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: combustion
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 0.4.0
90
+ version: 1.3.7
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: 0.4.0
97
+ version: 1.3.7
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: database_cleaner
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: 0.7.1
104
+ version: 2.0.1
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: 0.7.1
111
+ version: 2.0.1
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: mock_redis
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: 0.12.1
118
+ version: 0.34.0
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: 0.12.1
125
+ version: 0.34.0
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: mysql2
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: 0.3.12b4
132
+ version: 0.5.4
133
133
  type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: 0.3.12b4
139
+ version: 0.5.4
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: pg
142
142
  requirement: !ruby/object:Gem::Requirement
143
143
  requirements:
144
144
  - - "~>"
145
145
  - !ruby/object:Gem::Version
146
- version: '0.11'
146
+ version: 1.4.4
147
147
  type: :development
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
151
  - - "~>"
152
152
  - !ruby/object:Gem::Version
153
- version: '0.11'
153
+ version: 1.4.4
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: rake
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - ">="
158
+ - - "~>"
159
159
  - !ruby/object:Gem::Version
160
- version: 0.9.2
160
+ version: 13.0.6
161
161
  type: :development
162
162
  prerelease: false
163
163
  version_requirements: !ruby/object:Gem::Requirement
164
164
  requirements:
165
- - - ">="
165
+ - - "~>"
166
166
  - !ruby/object:Gem::Version
167
- version: 0.9.2
167
+ version: 13.0.6
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: rspec
170
170
  requirement: !ruby/object:Gem::Requirement
171
171
  requirements:
172
172
  - - "~>"
173
173
  - !ruby/object:Gem::Version
174
- version: 2.11.0
174
+ version: 3.12.0
175
175
  type: :development
176
176
  prerelease: false
177
177
  version_requirements: !ruby/object:Gem::Requirement
178
178
  requirements:
179
179
  - - "~>"
180
180
  - !ruby/object:Gem::Version
181
- version: 2.11.0
181
+ version: 3.12.0
182
182
  description: Manage delta indexes via Resque for Thinking Sphinx
183
183
  email:
184
184
  - aaron.gibralter@gmail.com
@@ -217,12 +217,11 @@ files:
217
217
  - spec/spec_helper.rb
218
218
  - spec/thinking_sphinx/deltas/resque_delta/delta_job_spec.rb
219
219
  - spec/thinking_sphinx/deltas/resque_delta_spec.rb
220
- - tasks/rails.rake
221
220
  - ts-resque-delta.gemspec
222
221
  homepage: https://github.com/agibralter/ts-resque-delta
223
222
  licenses: []
224
223
  metadata: {}
225
- post_install_message:
224
+ post_install_message:
226
225
  rdoc_options: []
227
226
  require_paths:
228
227
  - lib
@@ -237,9 +236,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
236
  - !ruby/object:Gem::Version
238
237
  version: '0'
239
238
  requirements: []
240
- rubyforge_project: ts-resque-delta
241
- rubygems_version: 2.2.2
242
- signing_key:
239
+ rubygems_version: 3.2.32
240
+ signing_key:
243
241
  specification_version: 4
244
242
  summary: Thinking Sphinx - Resque Deltas
245
243
  test_files:
data/tasks/rails.rake DELETED
@@ -1 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '/../lib/thinking_sphinx/deltas/resque_delta/tasks')