ts-delayed-delta 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e3c39830b3c7c1b99120c3b5e194166de5aa3170
4
+ data.tar.gz: e46cb87b4ea21830a05e97f69555ae66a168e6b2
5
+ SHA512:
6
+ metadata.gz: 12980e2228f8c7b78e1157f288126cf28100b2c092381f5a79bb01c7c3ae12d7582fef3bd9d77de46885a9d3675f7d85e756250f3949139d762fe4f63883eccf
7
+ data.tar.gz: 7674ba0bc569432a17be263d46b3ae88486f1d779a44e12a7a08e67f4528465f11d1bf41045e288371291ec7b6a36b9b9e36d7f38d66ef775406e34e792fa8ed
data/.travis.yml CHANGED
@@ -1,18 +1,15 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.2
4
3
  - 1.9.3
5
4
  before_install:
6
5
  - gem update --system
7
6
  - gem install bundler --no-ri --no-rdoc
8
- - curl -O http://fs-packages.s3.amazonaws.com/fs-sphinx-2.0.6_x86_64_12.04.deb
9
- - sudo dpkg -i fs-sphinx-2.0.6_x86_64_12.04.deb
10
7
  - bundle install
11
8
  before_script:
12
9
  - "mysql -e 'create database thinking_sphinx;' > /dev/null"
13
10
  - "psql -c 'create database thinking_sphinx;' -U postgres > /dev/null"
14
11
  - "bundle exec rake appraisal:install"
15
12
  env:
16
- - SPHINX_BIN=/usr/local/sphinx-2.0.6/bin/ SPHINX_VERSION=2.0.6 DATABASE=mysql2
17
- - SPHINX_BIN=/usr/local/sphinx-2.0.6/bin/ SPHINX_VERSION=2.0.6 DATABASE=postgresql
13
+ - SPHINX_BIN=/usr/local/sphinx-2.0.9/bin/ SPHINX_VERSION=2.0.9 DATABASE=mysql2
14
+ - SPHINX_BIN=/usr/local/sphinx-2.0.9/bin/ SPHINX_VERSION=2.0.9 DATABASE=postgresql
18
15
  script: "bundle exec rake appraisal spec"
data/README.textile CHANGED
@@ -6,13 +6,13 @@ This version requires Thinking Sphinx 3.x (currently the edge branch) and Delaye
6
6
 
7
7
  In your @Gemfile@, it'll likely look something like this:
8
8
 
9
- <pre><code>gem 'ts-delayed-delta', '~> 2.0.0'</code></pre>
9
+ <pre><code>gem 'ts-delayed-delta', '~> 2.0.1'</code></pre>
10
10
 
11
11
  Or, if you're referring directly to the git repository:
12
12
 
13
13
  <pre><code>gem 'ts-delayed-delta',
14
14
  :git => 'git://github.com/pat/ts-delayed-delta.git',
15
- :branch => 'edge',
15
+ :branch => 'master',
16
16
  :ref => 'use-latest-commit-here'</code></pre>
17
17
 
18
18
  And given this gem's built for Delayed Job, we're presuming you've got that set up (with the database table), and you know how to run it. This gem no longer provides a custom task for that purpose - there's no need.
@@ -59,7 +59,8 @@ h2. Contributors
59
59
  * "Jonathan Viney":https://github.com/jviney and "James Healy":http://yob.id.au/ (Rails 3.2 deprecation fixes)
60
60
  * "Georg Ledermann":http://www.georg-ledermann.de (DJ 2.0.x backwards compatibility)
61
61
  * "Jonathan Lim":http://snowblink.co.uk (Cleaning up version references)
62
+ * "Manjunath Manohar":https://github.com/manjunath-nm89 (Allow setting of job queue, smarter cleaning up of jobs)
62
63
 
63
64
  h2. Copyright
64
65
 
65
- Copyright (c) 2009-2012, Thinking Sphinx Delayed Deltas (ts-delayed-delta) is developed and maintained by Pat Allan, and is released under the open MIT Licence. Many thanks to "all who have contributed patches":https://github.com/pat/ts-delayed-delta/contributors.
66
+ Copyright (c) 2009-2014, Thinking Sphinx Delayed Deltas (ts-delayed-delta) is developed and maintained by Pat Allan, and is released under the open MIT Licence. Many thanks to "all who have contributed patches":https://github.com/pat/ts-delayed-delta/contributors.
@@ -14,10 +14,15 @@ require 'thinking_sphinx'
14
14
  class ThinkingSphinx::Deltas::DelayedDelta <
15
15
  ThinkingSphinx::Deltas::DefaultDelta
16
16
 
17
+ CONFIGURATIONS_MAP = {
18
+ :priority => :delayed_job_priority,
19
+ :queue => :delayed_job_queue
20
+ }
21
+
17
22
  def self.cancel_jobs
18
- Delayed::Job.delete_all(
19
- "handler LIKE '--- !ruby/object:ThinkingSphinx::Deltas::%'"
20
- )
23
+ Delayed::Job.delete_all([
24
+ "handler LIKE (?) AND locked_at IS NULL AND locked_by IS NULL AND failed_at IS NULL", "--- !ruby/object:ThinkingSphinx::Deltas::%"
25
+ ])
21
26
  end
22
27
 
23
28
  def self.enqueue_unless_duplicates(object)
@@ -31,24 +36,29 @@ class ThinkingSphinx::Deltas::DelayedDelta <
31
36
  ) > 0
32
37
  end
33
38
 
34
- Delayed::Job.enqueue object, priority_option
39
+ Delayed::Job.enqueue object, job_options
35
40
  end
36
41
 
37
- def self.priority_option
42
+ def self.job_options
38
43
  if Gem.loaded_specs['delayed_job'].version.to_s.match(/^2\.0\./)
39
44
  # Fallback for compatibility with old release 2.0.x of DJ
40
- priority
45
+ # Only priority option is supported for these versions
46
+ set_job_options(:delayed_job_priority)
41
47
  else
42
- {:priority => priority}
48
+ CONFIGURATIONS_MAP.inject({}) do |job_mapper, configuration_entity|
49
+ job_mapper.merge(configuration_entity[0] => set_job_options(configuration_entity[1]))
50
+ end
43
51
  end
44
52
  end
45
53
 
46
- def self.priority
54
+ def self.set_job_options(setting)
47
55
  configuration = ThinkingSphinx::Configuration.instance
48
- if configuration.respond_to? :delayed_job_priority
49
- configuration.delayed_job_priority
56
+ if configuration.respond_to? setting
57
+ configuration.send(setting)
58
+ elsif configuration.respond_to? :settings
59
+ configuration.settings[setting.to_s]
50
60
  else
51
- configuration.settings['delayed_job_priority'] || 0
61
+ nil
52
62
  end
53
63
  end
54
64
 
@@ -79,7 +89,7 @@ class ThinkingSphinx::Deltas::DelayedDelta <
79
89
  Delayed::Job.enqueue(
80
90
  ThinkingSphinx::Deltas::DelayedDelta::FlagAsDeletedJob.new(
81
91
  model.core_index_names, instance.sphinx_document_id
82
- ), self.class.priority_option
92
+ ), self.class.job_options
83
93
  ) if instance
84
94
 
85
95
  true
@@ -105,7 +115,7 @@ class ThinkingSphinx::Deltas::DelayedDelta <
105
115
  Delayed::Job.enqueue(
106
116
  ThinkingSphinx::Deltas::DelayedDelta::FlagAsDeletedJob.new(
107
117
  index.name, index.document_id_for_key(instance.id)
108
- ), self.class.priority_option
118
+ ), self.class.job_options
109
119
  )
110
120
  end
111
121
 
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'ts-delayed-delta'
6
- s.version = '2.0.0'
6
+ s.version = '2.0.1'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ['Pat Allan']
9
9
  s.email = ['pat@freelancing-gods.com']
metadata CHANGED
@@ -1,13 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ts-delayed-delta
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease:
6
- segments:
7
- - 2
8
- - 0
9
- - 0
10
- version: 2.0.0
4
+ version: 2.0.1
11
5
  platform: ruby
12
6
  authors:
13
7
  - Pat Allan
@@ -15,167 +9,107 @@ autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
11
 
18
- date: 2013-05-07 00:00:00 -07:00
19
- default_executable:
12
+ date: 2014-04-10 00:00:00 Z
20
13
  dependencies:
21
14
  - !ruby/object:Gem::Dependency
22
15
  requirement: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
16
  requirements:
25
- - - ">="
17
+ - &id002
18
+ - ">="
26
19
  - !ruby/object:Gem::Version
27
- hash: 3
28
- segments:
29
- - 0
30
20
  version: "0"
31
21
  version_requirements: *id001
32
- name: thinking-sphinx
33
- prerelease: false
34
22
  type: :runtime
35
- - !ruby/object:Gem::Dependency
36
- requirement: &id002 !ruby/object:Gem::Requirement
37
- none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- hash: 3
42
- segments:
43
- - 0
44
- version: "0"
45
- version_requirements: *id002
46
- name: delayed_job
47
23
  prerelease: false
48
- type: :runtime
24
+ name: thinking-sphinx
49
25
  - !ruby/object:Gem::Dependency
50
26
  requirement: &id003 !ruby/object:Gem::Requirement
51
- none: false
52
27
  requirements:
53
- - - ~>
54
- - !ruby/object:Gem::Version
55
- hash: 15
56
- segments:
57
- - 0
58
- - 5
59
- - 2
60
- version: 0.5.2
28
+ - *id002
61
29
  version_requirements: *id003
62
- name: appraisal
30
+ type: :runtime
63
31
  prerelease: false
64
- type: :development
32
+ name: delayed_job
65
33
  - !ruby/object:Gem::Dependency
66
34
  requirement: &id004 !ruby/object:Gem::Requirement
67
- none: false
68
35
  requirements:
69
36
  - - ~>
70
37
  - !ruby/object:Gem::Version
71
- hash: 15
72
- segments:
73
- - 0
74
- - 4
75
- - 0
76
- version: 0.4.0
38
+ version: 0.5.2
77
39
  version_requirements: *id004
78
- name: combustion
79
- prerelease: false
80
40
  type: :development
41
+ prerelease: false
42
+ name: appraisal
81
43
  - !ruby/object:Gem::Dependency
82
44
  requirement: &id005 !ruby/object:Gem::Requirement
83
- none: false
84
45
  requirements:
85
46
  - - ~>
86
47
  - !ruby/object:Gem::Version
87
- hash: 1
88
- segments:
89
- - 0
90
- - 7
91
- - 1
92
- version: 0.7.1
48
+ version: 0.4.0
93
49
  version_requirements: *id005
94
- name: database_cleaner
95
- prerelease: false
96
50
  type: :development
51
+ prerelease: false
52
+ name: combustion
97
53
  - !ruby/object:Gem::Dependency
98
54
  requirement: &id006 !ruby/object:Gem::Requirement
99
- none: false
100
55
  requirements:
101
56
  - - ~>
102
57
  - !ruby/object:Gem::Version
103
- hash: 7
104
- segments:
105
- - 0
106
- - 4
107
- - 4
108
- version: 0.4.4
58
+ version: 0.7.1
109
59
  version_requirements: *id006
110
- name: delayed_job_active_record
111
- prerelease: false
112
60
  type: :development
61
+ prerelease: false
62
+ name: database_cleaner
113
63
  - !ruby/object:Gem::Dependency
114
64
  requirement: &id007 !ruby/object:Gem::Requirement
115
- none: false
116
65
  requirements:
117
66
  - - ~>
118
67
  - !ruby/object:Gem::Version
119
- hash: 3357009125
120
- segments:
121
- - 0
122
- - 3
123
- - 12
124
- - b
125
- - 4
126
- version: 0.3.12b4
68
+ version: 0.4.4
127
69
  version_requirements: *id007
128
- name: mysql2
129
- prerelease: false
130
70
  type: :development
71
+ prerelease: false
72
+ name: delayed_job_active_record
131
73
  - !ruby/object:Gem::Dependency
132
74
  requirement: &id008 !ruby/object:Gem::Requirement
133
- none: false
134
75
  requirements:
135
76
  - - ~>
136
77
  - !ruby/object:Gem::Version
137
- hash: 51
138
- segments:
139
- - 0
140
- - 11
141
- - 0
142
- version: 0.11.0
78
+ version: 0.3.12b4
143
79
  version_requirements: *id008
144
- name: pg
145
- prerelease: false
146
80
  type: :development
81
+ prerelease: false
82
+ name: mysql2
147
83
  - !ruby/object:Gem::Dependency
148
84
  requirement: &id009 !ruby/object:Gem::Requirement
149
- none: false
150
85
  requirements:
151
- - - ">="
86
+ - - ~>
152
87
  - !ruby/object:Gem::Version
153
- hash: 63
154
- segments:
155
- - 0
156
- - 9
157
- - 2
158
- version: 0.9.2
88
+ version: 0.11.0
159
89
  version_requirements: *id009
160
- name: rake
161
- prerelease: false
162
90
  type: :development
91
+ prerelease: false
92
+ name: pg
163
93
  - !ruby/object:Gem::Dependency
164
94
  requirement: &id010 !ruby/object:Gem::Requirement
165
- none: false
166
95
  requirements:
167
- - - ~>
96
+ - - ">="
168
97
  - !ruby/object:Gem::Version
169
- hash: 35
170
- segments:
171
- - 2
172
- - 11
173
- - 0
174
- version: 2.11.0
98
+ version: 0.9.2
175
99
  version_requirements: *id010
176
- name: rspec
100
+ type: :development
177
101
  prerelease: false
102
+ name: rake
103
+ - !ruby/object:Gem::Dependency
104
+ requirement: &id011 !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ~>
107
+ - !ruby/object:Gem::Version
108
+ version: 2.11.0
109
+ version_requirements: *id011
178
110
  type: :development
111
+ prerelease: false
112
+ name: rspec
179
113
  description: Manage delta indexes via Delayed Job for Thinking Sphinx
180
114
  email:
181
115
  - pat@freelancing-gods.com
@@ -213,39 +147,28 @@ files:
213
147
  - spec/spec.opts
214
148
  - spec/spec_helper.rb
215
149
  - ts-delayed-delta.gemspec
216
- has_rdoc: true
217
150
  homepage: http://github.com/pat/ts-delayed-delta
218
151
  licenses: []
219
152
 
153
+ metadata: {}
154
+
220
155
  post_install_message:
221
156
  rdoc_options: []
222
157
 
223
158
  require_paths:
224
159
  - lib
225
160
  required_ruby_version: !ruby/object:Gem::Requirement
226
- none: false
227
161
  requirements:
228
- - - ">="
229
- - !ruby/object:Gem::Version
230
- hash: 3
231
- segments:
232
- - 0
233
- version: "0"
162
+ - *id002
234
163
  required_rubygems_version: !ruby/object:Gem::Requirement
235
- none: false
236
164
  requirements:
237
- - - ">="
238
- - !ruby/object:Gem::Version
239
- hash: 3
240
- segments:
241
- - 0
242
- version: "0"
165
+ - *id002
243
166
  requirements: []
244
167
 
245
168
  rubyforge_project: ts-delayed-delta
246
- rubygems_version: 1.6.2
169
+ rubygems_version: 2.1.0
247
170
  signing_key:
248
- specification_version: 3
171
+ specification_version: 4
249
172
  summary: Thinking Sphinx - Delayed Deltas
250
173
  test_files:
251
174
  - spec/acceptance/delayed_job_deltas_spec.rb