sunspot_index_queue 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,94 @@
1
+ require 'rubygems'
2
+ require File.expand_path('../../lib/sunspot_index_queue', __FILE__)
3
+
4
+ module Sunspot
5
+ class IndexQueue
6
+ module Test
7
+ # Test class for searching against.
8
+ class Searchable
9
+ class << self
10
+ # Create a mock database in a block that will reload copies of saved objects.
11
+ def mock_db
12
+ save = Thread.current[:mock_db]
13
+ Thread.current[:mock_db] = {}
14
+ begin
15
+ yield
16
+ ensure
17
+ Thread.current[:mock_db] = save
18
+ end
19
+ end
20
+
21
+ def db
22
+ Thread.current[:mock_db]
23
+ end
24
+
25
+ def save (*objects)
26
+ objects.each do |obj|
27
+ db[obj.id] = obj.dup
28
+ end
29
+ end
30
+ end
31
+
32
+ attr_reader :id
33
+ attr_accessor :value
34
+ def initialize (id, value=nil)
35
+ @id = id
36
+ @value = value
37
+ end
38
+
39
+ def == (value)
40
+ value.is_a?(self.class) && @id == value.id
41
+ end
42
+
43
+ class DataAccessor < Sunspot::Adapters::DataAccessor
44
+ def load (id)
45
+ Searchable.db ? Searchable.db[id] : Searchable.new(id)
46
+ end
47
+ end
48
+
49
+ class InstanceAdapter < Sunspot::Adapters::InstanceAdapter
50
+ def id
51
+ @instance.id
52
+ end
53
+ end
54
+
55
+ class Subclass < Searchable
56
+ end
57
+ end
58
+
59
+ Sunspot::Adapters::InstanceAdapter.register(Searchable::InstanceAdapter, Searchable)
60
+ Sunspot::Adapters::DataAccessor.register(Searchable::DataAccessor, Searchable)
61
+ Sunspot.setup(Searchable) do
62
+ string :value
63
+ end
64
+ end
65
+
66
+ module Entry
67
+ class MockImpl
68
+ include Entry
69
+
70
+ attr_reader :record_class_name, :record_id, :error, :attempts
71
+
72
+ def initialize (options = {})
73
+ if options[:record]
74
+ @record_class_name = options[:record].class.name
75
+ @record_id = options[:record].id.to_s
76
+ else
77
+ @record_class_name = options[:record_class_name]
78
+ @record_id = options[:record_id].to_s
79
+ end
80
+ @is_delete = !!options[:delete]
81
+ end
82
+
83
+ def is_delete?
84
+ @is_delete
85
+ end
86
+
87
+ def id
88
+ object_id
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+
@@ -0,0 +1,99 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{sunspot_index_queue}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Brian Durand"]
12
+ s.date = %q{2010-06-22}
13
+ s.description = %q{This gem provides asynchronous indexing to Solr for the sunspot gem. It uses a pluggable model for the backing queue and provides support for ActiveRecord and MongoDB out of the box.}
14
+ s.email = %q{brian@embellishedvisions.com}
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "MIT_LICENSE",
21
+ "README.rdoc",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "lib/sunspot/index_queue.rb",
25
+ "lib/sunspot/index_queue/batch.rb",
26
+ "lib/sunspot/index_queue/entry.rb",
27
+ "lib/sunspot/index_queue/entry/active_record_impl.rb",
28
+ "lib/sunspot/index_queue/entry/data_mapper_impl.rb",
29
+ "lib/sunspot/index_queue/entry/mongo_impl.rb",
30
+ "lib/sunspot/index_queue/session_proxy.rb",
31
+ "lib/sunspot_index_queue.rb",
32
+ "spec/active_record_impl_spec.rb",
33
+ "spec/batch_spec.rb",
34
+ "spec/data_mapper_impl_spec.rb",
35
+ "spec/entry_impl_examples.rb",
36
+ "spec/entry_spec.rb",
37
+ "spec/index_queue_spec.rb",
38
+ "spec/integration_spec.rb",
39
+ "spec/mongo_impl_spec.rb",
40
+ "spec/session_proxy_spec.rb",
41
+ "spec/spec_helper.rb",
42
+ "sunspot_index_queue.gemspec"
43
+ ]
44
+ s.homepage = %q{http://github.com/bdurand/sunspot_index_queue}
45
+ s.rdoc_options = ["--charset=UTF-8", "--main", "README.rdoc"]
46
+ s.require_paths = ["lib"]
47
+ s.rubygems_version = %q{1.3.7}
48
+ s.summary = %q{Asynchronous Solr indexing support for the sunspot gem with an emphasis on reliablity and throughput.}
49
+ s.test_files = [
50
+ "spec/active_record_impl_spec.rb",
51
+ "spec/batch_spec.rb",
52
+ "spec/data_mapper_impl_spec.rb",
53
+ "spec/entry_impl_examples.rb",
54
+ "spec/entry_spec.rb",
55
+ "spec/index_queue_spec.rb",
56
+ "spec/integration_spec.rb",
57
+ "spec/mongo_impl_spec.rb",
58
+ "spec/session_proxy_spec.rb",
59
+ "spec/spec_helper.rb"
60
+ ]
61
+
62
+ if s.respond_to? :specification_version then
63
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
64
+ s.specification_version = 3
65
+
66
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
67
+ s.add_runtime_dependency(%q<sunspot>, [">= 1.1.0"])
68
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
69
+ s.add_development_dependency(%q<activerecord>, [">= 2.2"])
70
+ s.add_development_dependency(%q<dm-core>, [">= 1.0.0"])
71
+ s.add_development_dependency(%q<dm-aggregates>, [">= 1.0.0"])
72
+ s.add_development_dependency(%q<dm-migrations>, [">= 1.0.0"])
73
+ s.add_development_dependency(%q<mongo>, [">= 0"])
74
+ s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
75
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
76
+ else
77
+ s.add_dependency(%q<sunspot>, [">= 1.1.0"])
78
+ s.add_dependency(%q<sqlite3>, [">= 0"])
79
+ s.add_dependency(%q<activerecord>, [">= 2.2"])
80
+ s.add_dependency(%q<dm-core>, [">= 1.0.0"])
81
+ s.add_dependency(%q<dm-aggregates>, [">= 1.0.0"])
82
+ s.add_dependency(%q<dm-migrations>, [">= 1.0.0"])
83
+ s.add_dependency(%q<mongo>, [">= 0"])
84
+ s.add_dependency(%q<rspec>, [">= 1.3.0"])
85
+ s.add_dependency(%q<jeweler>, [">= 0"])
86
+ end
87
+ else
88
+ s.add_dependency(%q<sunspot>, [">= 1.1.0"])
89
+ s.add_dependency(%q<sqlite3>, [">= 0"])
90
+ s.add_dependency(%q<activerecord>, [">= 2.2"])
91
+ s.add_dependency(%q<dm-core>, [">= 1.0.0"])
92
+ s.add_dependency(%q<dm-aggregates>, [">= 1.0.0"])
93
+ s.add_dependency(%q<dm-migrations>, [">= 1.0.0"])
94
+ s.add_dependency(%q<mongo>, [">= 0"])
95
+ s.add_dependency(%q<rspec>, [">= 1.3.0"])
96
+ s.add_dependency(%q<jeweler>, [">= 0"])
97
+ end
98
+ end
99
+
metadata ADDED
@@ -0,0 +1,237 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sunspot_index_queue
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Brian Durand
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-06-22 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: sunspot
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 19
30
+ segments:
31
+ - 1
32
+ - 1
33
+ - 0
34
+ version: 1.1.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: sqlite3
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :development
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: activerecord
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 7
60
+ segments:
61
+ - 2
62
+ - 2
63
+ version: "2.2"
64
+ type: :development
65
+ version_requirements: *id003
66
+ - !ruby/object:Gem::Dependency
67
+ name: dm-core
68
+ prerelease: false
69
+ requirement: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 23
75
+ segments:
76
+ - 1
77
+ - 0
78
+ - 0
79
+ version: 1.0.0
80
+ type: :development
81
+ version_requirements: *id004
82
+ - !ruby/object:Gem::Dependency
83
+ name: dm-aggregates
84
+ prerelease: false
85
+ requirement: &id005 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ hash: 23
91
+ segments:
92
+ - 1
93
+ - 0
94
+ - 0
95
+ version: 1.0.0
96
+ type: :development
97
+ version_requirements: *id005
98
+ - !ruby/object:Gem::Dependency
99
+ name: dm-migrations
100
+ prerelease: false
101
+ requirement: &id006 !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ hash: 23
107
+ segments:
108
+ - 1
109
+ - 0
110
+ - 0
111
+ version: 1.0.0
112
+ type: :development
113
+ version_requirements: *id006
114
+ - !ruby/object:Gem::Dependency
115
+ name: mongo
116
+ prerelease: false
117
+ requirement: &id007 !ruby/object:Gem::Requirement
118
+ none: false
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ hash: 3
123
+ segments:
124
+ - 0
125
+ version: "0"
126
+ type: :development
127
+ version_requirements: *id007
128
+ - !ruby/object:Gem::Dependency
129
+ name: rspec
130
+ prerelease: false
131
+ requirement: &id008 !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ hash: 27
137
+ segments:
138
+ - 1
139
+ - 3
140
+ - 0
141
+ version: 1.3.0
142
+ type: :development
143
+ version_requirements: *id008
144
+ - !ruby/object:Gem::Dependency
145
+ name: jeweler
146
+ prerelease: false
147
+ requirement: &id009 !ruby/object:Gem::Requirement
148
+ none: false
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ hash: 3
153
+ segments:
154
+ - 0
155
+ version: "0"
156
+ type: :development
157
+ version_requirements: *id009
158
+ description: This gem provides asynchronous indexing to Solr for the sunspot gem. It uses a pluggable model for the backing queue and provides support for ActiveRecord and MongoDB out of the box.
159
+ email: brian@embellishedvisions.com
160
+ executables: []
161
+
162
+ extensions: []
163
+
164
+ extra_rdoc_files:
165
+ - README.rdoc
166
+ files:
167
+ - .gitignore
168
+ - MIT_LICENSE
169
+ - README.rdoc
170
+ - Rakefile
171
+ - VERSION
172
+ - lib/sunspot/index_queue.rb
173
+ - lib/sunspot/index_queue/batch.rb
174
+ - lib/sunspot/index_queue/entry.rb
175
+ - lib/sunspot/index_queue/entry/active_record_impl.rb
176
+ - lib/sunspot/index_queue/entry/data_mapper_impl.rb
177
+ - lib/sunspot/index_queue/entry/mongo_impl.rb
178
+ - lib/sunspot/index_queue/session_proxy.rb
179
+ - lib/sunspot_index_queue.rb
180
+ - spec/active_record_impl_spec.rb
181
+ - spec/batch_spec.rb
182
+ - spec/data_mapper_impl_spec.rb
183
+ - spec/entry_impl_examples.rb
184
+ - spec/entry_spec.rb
185
+ - spec/index_queue_spec.rb
186
+ - spec/integration_spec.rb
187
+ - spec/mongo_impl_spec.rb
188
+ - spec/session_proxy_spec.rb
189
+ - spec/spec_helper.rb
190
+ - sunspot_index_queue.gemspec
191
+ has_rdoc: true
192
+ homepage: http://github.com/bdurand/sunspot_index_queue
193
+ licenses: []
194
+
195
+ post_install_message:
196
+ rdoc_options:
197
+ - --charset=UTF-8
198
+ - --main
199
+ - README.rdoc
200
+ require_paths:
201
+ - lib
202
+ required_ruby_version: !ruby/object:Gem::Requirement
203
+ none: false
204
+ requirements:
205
+ - - ">="
206
+ - !ruby/object:Gem::Version
207
+ hash: 3
208
+ segments:
209
+ - 0
210
+ version: "0"
211
+ required_rubygems_version: !ruby/object:Gem::Requirement
212
+ none: false
213
+ requirements:
214
+ - - ">="
215
+ - !ruby/object:Gem::Version
216
+ hash: 3
217
+ segments:
218
+ - 0
219
+ version: "0"
220
+ requirements: []
221
+
222
+ rubyforge_project:
223
+ rubygems_version: 1.3.7
224
+ signing_key:
225
+ specification_version: 3
226
+ summary: Asynchronous Solr indexing support for the sunspot gem with an emphasis on reliablity and throughput.
227
+ test_files:
228
+ - spec/active_record_impl_spec.rb
229
+ - spec/batch_spec.rb
230
+ - spec/data_mapper_impl_spec.rb
231
+ - spec/entry_impl_examples.rb
232
+ - spec/entry_spec.rb
233
+ - spec/index_queue_spec.rb
234
+ - spec/integration_spec.rb
235
+ - spec/mongo_impl_spec.rb
236
+ - spec/session_proxy_spec.rb
237
+ - spec/spec_helper.rb