sunspot_rails 0.11.4 → 0.11.5
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.
- data/dev_tasks/gemspec.rake +27 -47
- data/lib/sunspot/rails/session_proxy.rb +17 -3
- data/lib/sunspot/rails/util.rb +12 -2
- data/lib/sunspot/rails/version.rb +5 -0
- data/spec/mock_app/app/models/photo_post_with_auto.rb +2 -0
- data/spec/util_spec.rb +6 -0
- metadata +43 -67
- data/VERSION.yml +0 -4
data/dev_tasks/gemspec.rake
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', 'sunspot', 'lib', 'sunspot', 'gem_tasks')
|
2
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'sunspot', 'rails', 'version')
|
3
|
+
|
4
|
+
Sunspot::GemTasks.new do |s|
|
5
|
+
s.name = 'sunspot_rails'
|
6
|
+
s.version = Sunspot::Rails::VERSION
|
7
|
+
s.summary = 'Rails integration for the Sunspot Solr search library'
|
8
|
+
s.email = 'mat@patch.com'
|
9
|
+
s.homepage = 'http://github.com/outoftime/sunspot_rails'
|
10
|
+
s.description = <<TEXT
|
10
11
|
Sunspot::Rails is an extension to the Sunspot library for Solr search.
|
11
12
|
Sunspot::Rails adds integration between Sunspot and ActiveRecord, including
|
12
13
|
defining search and indexing related methods on ActiveRecord models themselves,
|
@@ -14,42 +15,21 @@ running a Sunspot-compatible Solr instance for development and test
|
|
14
15
|
environments, and automatically commit Solr index changes at the end of each
|
15
16
|
Rails request.
|
16
17
|
TEXT
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
Jeweler::RubyforgeTasks.new
|
37
|
-
Jeweler::GemcutterTasks.new
|
38
|
-
end
|
39
|
-
|
40
|
-
namespace :release do
|
41
|
-
task :tag do
|
42
|
-
version = Jeweler::VersionHelper.new(File.join(File.dirname(__FILE__), '..')).to_s
|
43
|
-
`git tag -a -m "Version #{version}" v#{version}`
|
44
|
-
`git push origin v#{version}:v#{version}`
|
45
|
-
end
|
46
|
-
|
47
|
-
task :commit_gemspec do
|
48
|
-
version = Jeweler::VersionHelper.new(File.join(File.dirname(__FILE__), '..')).to_s
|
49
|
-
`git add sunspot_rails.gemspec`
|
50
|
-
`git commit -m "Generate gemspec for v#{version}"`
|
51
|
-
end
|
52
|
-
|
53
|
-
desc "Release gem to RubyForge and GitHub"
|
54
|
-
task :all => [:gemspec, :commit_gemspec, :tag, :"rubyforge:release:gem", :"gemcutter:release"]
|
18
|
+
s.authors = ['Mat Brown', 'Peer Allan', 'Michael Moen', 'Benjamin Krause']
|
19
|
+
s.rubyforge_project = 'sunspot'
|
20
|
+
s.files = FileList['[A-Z]*',
|
21
|
+
'{lib,tasks,dev_tasks}/**/*',
|
22
|
+
'generators/**/*',
|
23
|
+
'install.rb',
|
24
|
+
'MIT-LICENSE',
|
25
|
+
'rails/*',
|
26
|
+
'spec/*.rb',
|
27
|
+
'spec/mock_app/{app,lib,db,vendor,config}/**/*',
|
28
|
+
'spec/mock_app/{tmp,log,solr}']
|
29
|
+
s.add_dependency 'escape', '>= 0.0.4'
|
30
|
+
s.add_dependency 'sunspot', '>= 0.10.6', '<= 0.10.8'
|
31
|
+
s.add_development_dependency 'rspec', '~> 1.2'
|
32
|
+
s.add_development_dependency 'rspec-rails', '~> 1.2'
|
33
|
+
s.add_development_dependency 'ruby-debug', '~> 0.10'
|
34
|
+
s.add_development_dependency 'technicalpickles-jeweler', '~> 1.0'
|
55
35
|
end
|
@@ -6,7 +6,21 @@ module Sunspot
|
|
6
6
|
class <<self
|
7
7
|
def instance
|
8
8
|
synchronize do
|
9
|
-
@instance ||=
|
9
|
+
@instance ||=
|
10
|
+
begin
|
11
|
+
configuration = Sunspot::Rails::Configuration.new
|
12
|
+
if configuration.has_master?
|
13
|
+
new(configuration)
|
14
|
+
else
|
15
|
+
session = Sunspot::Session.new
|
16
|
+
session.config.solr.url = URI::HTTP.build(
|
17
|
+
:host => configuration.hostname,
|
18
|
+
:port => configuration.port,
|
19
|
+
:path => configuration.path
|
20
|
+
).to_s
|
21
|
+
session
|
22
|
+
end
|
23
|
+
end
|
10
24
|
end
|
11
25
|
end
|
12
26
|
|
@@ -24,8 +38,8 @@ module Sunspot
|
|
24
38
|
:remove_by_id!, :remove_all, :remove_all!, :dirty?, :commit_if_dirty, :batch,
|
25
39
|
:to => :write_session
|
26
40
|
|
27
|
-
def initialize
|
28
|
-
@configuration =
|
41
|
+
def initialize(configuration)
|
42
|
+
@configuration = configuration
|
29
43
|
end
|
30
44
|
|
31
45
|
private
|
data/lib/sunspot/rails/util.rb
CHANGED
@@ -10,10 +10,20 @@ module Sunspot #:nodoc:
|
|
10
10
|
|
11
11
|
def index_relevant_attribute_changed?( object )
|
12
12
|
class_key = object.class.to_s.underscore.to_sym
|
13
|
-
ignore_attributes = (
|
13
|
+
ignore_attributes = sunspot_options_for(object.class)[:ignore_attribute_changes_of] || []
|
14
14
|
!(object.changes.symbolize_keys.keys - ignore_attributes).blank?
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def sunspot_options_for(clazz)
|
20
|
+
class_key = clazz.to_s.underscore.to_sym
|
21
|
+
if options = sunspot_options[class_key]
|
22
|
+
options
|
23
|
+
elsif superclass = clazz.superclass
|
24
|
+
sunspot_options_for(superclass)
|
25
|
+
end
|
26
|
+
end
|
17
27
|
end
|
18
28
|
end
|
19
29
|
end
|
data/spec/util_spec.rb
CHANGED
@@ -12,4 +12,10 @@ describe 'ActiveRecord mixin and instance methods' do
|
|
12
12
|
@post.should_receive(:changes).and_return(:updated_at => Date.tomorrow)
|
13
13
|
Sunspot::Rails::Util.index_relevant_attribute_changed?(@post).should == false
|
14
14
|
end
|
15
|
+
|
16
|
+
it "should know about relevant index attributes with subclasses" do
|
17
|
+
@post = PhotoPostWithAuto.new
|
18
|
+
@post.should_receive(:changes).and_return(:title => 'new_title')
|
19
|
+
Sunspot::Rails::Util.index_relevant_attribute_changed?(@post).should == true
|
20
|
+
end
|
15
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunspot_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mat Brown
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2009-
|
15
|
+
date: 2009-12-22 00:00:00 -05:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -91,70 +91,70 @@ executables: []
|
|
91
91
|
|
92
92
|
extensions: []
|
93
93
|
|
94
|
-
extra_rdoc_files:
|
95
|
-
|
96
|
-
- README.rdoc
|
94
|
+
extra_rdoc_files: []
|
95
|
+
|
97
96
|
files:
|
98
|
-
- History.txt
|
99
|
-
- LICENSE
|
100
97
|
- MIT-LICENSE
|
101
|
-
- README.rdoc
|
102
98
|
- Rakefile
|
99
|
+
- README.rdoc
|
103
100
|
- TODO
|
104
|
-
-
|
101
|
+
- History.txt
|
102
|
+
- LICENSE
|
103
|
+
- lib/sunspot/spec/extension.rb
|
104
|
+
- lib/sunspot/rails/searchable.rb
|
105
|
+
- lib/sunspot/rails/version.rb
|
106
|
+
- lib/sunspot/rails/adapters.rb
|
107
|
+
- lib/sunspot/rails/configuration.rb
|
108
|
+
- lib/sunspot/rails/server.rb
|
109
|
+
- lib/sunspot/rails/tasks.rb
|
110
|
+
- lib/sunspot/rails/request_lifecycle.rb
|
111
|
+
- lib/sunspot/rails/util.rb
|
112
|
+
- lib/sunspot/rails/session_proxy.rb
|
113
|
+
- lib/sunspot/rails.rb
|
105
114
|
- dev_tasks/gemspec.rake
|
115
|
+
- dev_tasks/todo.rake
|
106
116
|
- dev_tasks/rdoc.rake
|
107
117
|
- dev_tasks/release.rake
|
108
|
-
- dev_tasks/todo.rake
|
109
118
|
- generators/sunspot/sunspot_generator.rb
|
110
119
|
- generators/sunspot/templates/sunspot.yml
|
111
120
|
- install.rb
|
112
|
-
- lib/sunspot/rails.rb
|
113
|
-
- lib/sunspot/rails/adapters.rb
|
114
|
-
- lib/sunspot/rails/configuration.rb
|
115
|
-
- lib/sunspot/rails/request_lifecycle.rb
|
116
|
-
- lib/sunspot/rails/searchable.rb
|
117
|
-
- lib/sunspot/rails/server.rb
|
118
|
-
- lib/sunspot/rails/session_proxy.rb
|
119
|
-
- lib/sunspot/rails/tasks.rb
|
120
|
-
- lib/sunspot/rails/util.rb
|
121
|
-
- lib/sunspot/spec/extension.rb
|
122
121
|
- rails/init.rb
|
122
|
+
- spec/spec_helper.rb
|
123
|
+
- spec/session_spec.rb
|
124
|
+
- spec/server_spec.rb
|
123
125
|
- spec/configuration_spec.rb
|
124
|
-
- spec/
|
125
|
-
- spec/
|
126
|
+
- spec/model_lifecycle_spec.rb
|
127
|
+
- spec/schema.rb
|
128
|
+
- spec/model_spec.rb
|
129
|
+
- spec/sunspot_mocking_spec.rb
|
130
|
+
- spec/util_spec.rb
|
131
|
+
- spec/request_lifecycle_spec.rb
|
126
132
|
- spec/mock_app/app/controllers/posts_controller.rb
|
127
|
-
- spec/mock_app/app/
|
133
|
+
- spec/mock_app/app/controllers/application_controller.rb
|
134
|
+
- spec/mock_app/app/controllers/application.rb
|
128
135
|
- spec/mock_app/app/models/blog.rb
|
129
|
-
- spec/mock_app/app/models/
|
136
|
+
- spec/mock_app/app/models/photo_post_with_auto.rb
|
130
137
|
- spec/mock_app/app/models/post_with_auto.rb
|
131
|
-
- spec/mock_app/
|
138
|
+
- spec/mock_app/app/models/author.rb
|
139
|
+
- spec/mock_app/app/models/post.rb
|
140
|
+
- spec/mock_app/db/schema.rb
|
141
|
+
- spec/mock_app/db/test.db
|
132
142
|
- spec/mock_app/config/database.yml
|
133
143
|
- spec/mock_app/config/environment.rb
|
144
|
+
- spec/mock_app/config/initializers/session_store.rb
|
145
|
+
- spec/mock_app/config/initializers/new_rails_defaults.rb
|
146
|
+
- spec/mock_app/config/sunspot.yml
|
134
147
|
- spec/mock_app/config/environments/development.rb
|
135
148
|
- spec/mock_app/config/environments/test.rb
|
136
|
-
- spec/mock_app/config/initializers/new_rails_defaults.rb
|
137
|
-
- spec/mock_app/config/initializers/session_store.rb
|
138
149
|
- spec/mock_app/config/routes.rb
|
139
|
-
- spec/mock_app/config/
|
140
|
-
- spec/mock_app/db/schema.rb
|
141
|
-
- spec/mock_app/db/test.db
|
142
|
-
- spec/model_lifecycle_spec.rb
|
143
|
-
- spec/model_spec.rb
|
144
|
-
- spec/request_lifecycle_spec.rb
|
145
|
-
- spec/schema.rb
|
146
|
-
- spec/server_spec.rb
|
147
|
-
- spec/session_spec.rb
|
148
|
-
- spec/spec_helper.rb
|
149
|
-
- spec/sunspot_mocking_spec.rb
|
150
|
-
- spec/util_spec.rb
|
150
|
+
- spec/mock_app/config/boot.rb
|
151
151
|
has_rdoc: true
|
152
152
|
homepage: http://github.com/outoftime/sunspot_rails
|
153
153
|
licenses: []
|
154
154
|
|
155
155
|
post_install_message:
|
156
|
-
rdoc_options:
|
157
|
-
|
156
|
+
rdoc_options: []
|
157
|
+
|
158
158
|
require_paths:
|
159
159
|
- lib
|
160
160
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -176,29 +176,5 @@ rubygems_version: 1.3.5
|
|
176
176
|
signing_key:
|
177
177
|
specification_version: 3
|
178
178
|
summary: Rails integration for the Sunspot Solr search library
|
179
|
-
test_files:
|
180
|
-
|
181
|
-
- spec/session_spec.rb
|
182
|
-
- spec/server_spec.rb
|
183
|
-
- spec/configuration_spec.rb
|
184
|
-
- spec/model_lifecycle_spec.rb
|
185
|
-
- spec/schema.rb
|
186
|
-
- spec/model_spec.rb
|
187
|
-
- spec/sunspot_mocking_spec.rb
|
188
|
-
- spec/util_spec.rb
|
189
|
-
- spec/mock_app/app/controllers/posts_controller.rb
|
190
|
-
- spec/mock_app/app/controllers/application_controller.rb
|
191
|
-
- spec/mock_app/app/controllers/application.rb
|
192
|
-
- spec/mock_app/app/models/blog.rb
|
193
|
-
- spec/mock_app/app/models/post_with_auto.rb
|
194
|
-
- spec/mock_app/app/models/author.rb
|
195
|
-
- spec/mock_app/app/models/post.rb
|
196
|
-
- spec/mock_app/db/schema.rb
|
197
|
-
- spec/mock_app/config/environment.rb
|
198
|
-
- spec/mock_app/config/initializers/session_store.rb
|
199
|
-
- spec/mock_app/config/initializers/new_rails_defaults.rb
|
200
|
-
- spec/mock_app/config/environments/development.rb
|
201
|
-
- spec/mock_app/config/environments/test.rb
|
202
|
-
- spec/mock_app/config/routes.rb
|
203
|
-
- spec/mock_app/config/boot.rb
|
204
|
-
- spec/request_lifecycle_spec.rb
|
179
|
+
test_files: []
|
180
|
+
|
data/VERSION.yml
DELETED