sunspot_rails 2.5.0 → 2.7.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
2
  SHA256:
3
- metadata.gz: fe1c1255087428230f0395ace478a130cc085d17ff4928901d3c3b5d8c533346
4
- data.tar.gz: 59107a6f61bfe96c726969590ceda3842cee4f78c618e8d90e28eb1ce827cbb0
3
+ metadata.gz: a11d76b704b04ea9a9181464f3aa7608d3fdf0b279f6cfbe1aa0722253a3d6b6
4
+ data.tar.gz: 8fcaca341cc28674811eff16fb88919cd6f1ef3c25353e6b1fd1ba54179be2f6
5
5
  SHA512:
6
- metadata.gz: 9e2d165e6ab6da5acecb593607c1d709111f6b211ed60bcc024dea60d8674f265d3c473073154d9f227e47c88cf6a61b039f28530419d290441de8edd05631db
7
- data.tar.gz: e6e6ab5dd5d2abb029f240f256483f8710f67a689284630b9d42fcb0be690fb6a11789a9d522cab83ff6e59b446689a3b7bd0d0a6eac1b6d46e4c15b2a8acb85
6
+ metadata.gz: 385ea6146e9bce459ebff718391d0ad03ed2bf007d8ebcd1f456fe4cfc9287971342faf23f94b873f6042230d2d18a25e93424f9c30b85d358e770cda3e8b6b2
7
+ data.tar.gz: 94b98fe7eef52efd8169160dabb8015835f4e9f00924f6ff5541e6f5151c67b9a820c848a89c6972949e61cbf71048e832e94dea19554bf233e0eaaea1378120
data/Appraisals CHANGED
@@ -1,63 +1,31 @@
1
1
  ruby_version = Gem::Version.new(RUBY_VERSION)
2
2
 
3
- if ruby_version < Gem::Version.new('2.2.0')
4
- ['3.0.0', '3.1.0'].each do |rails_version|
5
- appraise "rails-#{rails_version}" do
6
- gem 'bundler', '>= 1.3.0', '< 2.0'
7
- gem 'sunspot', path: File.expand_path('sunspot', ENV['SUNSPOT_LIB_HOME'])
8
- gem 'sunspot_solr', path: File.expand_path('sunspot_solr', ENV['SUNSPOT_LIB_HOME'])
9
- gem 'rails', "~> #{rails_version}"
10
- gem 'progress_bar', '~> 1.0.5', require: false
11
- gem 'rspec', '~> 3.4.0'
12
- gem 'rspec-rails', '~> 3.4.0'
13
- end
14
- end
15
- end
16
-
17
- if ruby_version < Gem::Version.new('2.4.0')
18
- appraise 'rails-3.2.0' do
19
- gem 'bundler', '>= 1.3.0', '< 2.0'
20
- gem 'sunspot', path: File.expand_path('sunspot', ENV['SUNSPOT_LIB_HOME'])
21
- gem 'sunspot_solr', path: File.expand_path('sunspot_solr', ENV['SUNSPOT_LIB_HOME'])
22
- gem 'rails', '~> 3.2.0'
23
- gem 'progress_bar', '~> 1.0.5', require: false
24
- gem 'test-unit', '~> 3.2.0'
25
- gem 'rspec', '~> 3.4.0'
26
- gem 'rspec-rails', '~> 3.4.0'
27
- end
28
-
29
- ['4.0.0', '4.1.0'].each do |rails_version|
3
+ if ruby_version < Gem::Version.new('3.0.0')
4
+ ['5.0.0', '5.1.0', '5.2.0'].each do |rails_version|
30
5
  appraise "rails-#{rails_version}" do
31
- gem 'bundler', '>= 1.3.0', '< 2.0'
32
6
  gem 'sunspot', path: File.expand_path('sunspot', ENV['SUNSPOT_LIB_HOME'])
33
7
  gem 'sunspot_solr', path: File.expand_path('sunspot_solr', ENV['SUNSPOT_LIB_HOME'])
34
8
  gem 'rails', "~> #{rails_version}"
9
+ gem 'sprockets', '~> 3.0'
35
10
  gem 'progress_bar', '~> 1.0.5', require: false
36
- gem 'rspec', '~> 3.4.0'
37
- gem 'rspec-rails', '~> 3.4.0'
11
+ gem 'sqlite3', '~> 1.3.0'
12
+ gem 'rspec', '~> 3.7'
13
+ gem 'rspec-rails', '~> 3.7'
38
14
  end
39
15
  end
40
16
  end
41
17
 
42
- if ruby_version < Gem::Version.new('2.5.0')
43
- appraise 'rails-4.2.0' do
44
- gem 'bundler', '>= 1.3.0', '< 2.0'
45
- gem 'sunspot', path: File.expand_path('sunspot', ENV['SUNSPOT_LIB_HOME'])
46
- gem 'sunspot_solr', path: File.expand_path('sunspot_solr', ENV['SUNSPOT_LIB_HOME'])
47
- gem 'rails', '~> 4.2.0'
48
- gem 'progress_bar', '~> 1.0.5', require: false
49
- gem 'rspec', '~> 3.4.0'
50
- gem 'rspec-rails', '~> 3.4.0'
51
- end
52
- end
53
-
54
- if ruby_version >= Gem::Version.new('2.2.0')
55
- ['5.0.0', '5.1.0', '5.2.0'].each do |rails_version|
18
+ if Gem::Version.new('3.0.0') <= ruby_version && ruby_version < Gem::Version.new('3.4.0')
19
+ ['6.1.0', '7.0.0'].each do |rails_version|
56
20
  appraise "rails-#{rails_version}" do
57
21
  gem 'sunspot', path: File.expand_path('sunspot', ENV['SUNSPOT_LIB_HOME'])
58
22
  gem 'sunspot_solr', path: File.expand_path('sunspot_solr', ENV['SUNSPOT_LIB_HOME'])
59
23
  gem 'rails', "~> #{rails_version}"
24
+ gem 'sprockets', '~> 3.0'
60
25
  gem 'progress_bar', '~> 1.0.5', require: false
26
+ gem 'sqlite3', '~> 1.4.0'
27
+ gem 'rspec', '~> 3'
28
+ gem 'rspec-rails', '~> 6'
61
29
  end
62
30
  end
63
31
  end
@@ -377,7 +377,8 @@ module Sunspot #:nodoc:
377
377
  if File.exist?(path)
378
378
  File.open(path) do |file|
379
379
  processed = ERB.new(file.read).result
380
- YAML.load(processed)[::Rails.env]
380
+ user_configurations = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(processed) : YAML.load(processed)
381
+ user_configurations[::Rails.env]
381
382
  end
382
383
  else
383
384
  {}
@@ -33,15 +33,15 @@ module Sunspot
33
33
  name = '%s (%.1fms)' % ["SOLR Request", event.duration]
34
34
 
35
35
  # produces: path=select parameters={fq: ["type:Tag"], q: "rossi", fl: "* score", qf: "tag_name_text", defType: "edismax", start: 0, rows: 20}
36
- path = color(event.payload[:path], BOLD, true)
36
+ path = color(event.payload[:path], nil, bold: true)
37
37
  parameters = event.payload[:parameters].map { |k, v|
38
38
  v = "\"#{v}\"" if v.is_a? String
39
39
  v = v.to_s.gsub(/\\/,'') # unescape
40
- "#{k}: #{color(v, BOLD, true)}"
40
+ "#{k}: #{color(v, nil, bold: true)}"
41
41
  }.join(', ')
42
42
  request = "path=#{path} parameters={#{parameters}}"
43
43
 
44
- debug " #{color(name, GREEN, true)} [ #{request} ]"
44
+ debug " #{color(name, GREEN, bold: true)} [ #{request} ]"
45
45
  end
46
46
  end
47
47
  end
@@ -264,7 +264,7 @@ module Sunspot #:nodoc:
264
264
 
265
265
  if options[:batch_size].to_i > 0
266
266
  batch_counter = 0
267
- self.includes(options[:include]).find_in_batches(options.slice(:batch_size, :start)) do |records|
267
+ self.includes(options[:include]).find_in_batches(**options.slice(:batch_size, :start)) do |records|
268
268
 
269
269
  solr_benchmark(options[:batch_size], batch_counter += 1) do
270
270
  Sunspot.index(records.select(&:indexable?))
@@ -287,7 +287,7 @@ module Sunspot #:nodoc:
287
287
  #
288
288
  # ==== Updates (passed as a hash)
289
289
  #
290
- # updates should be specified as a hash, where key - is the object ID
290
+ # updates should be specified as a hash, where key - is the object or the object ID
291
291
  # and values is hash with property name/values to be updated.
292
292
  #
293
293
  # ==== Examples
@@ -303,6 +303,8 @@ module Sunspot #:nodoc:
303
303
  #
304
304
  # # update single property
305
305
  # Post.atomic_update(post1.id => {description: 'New post description'})
306
+ # Or
307
+ # Post.atomic_update(post1 => {description: 'New post description'})
306
308
  #
307
309
  # ==== Notice
308
310
  # all non-stored properties in Solr index will be lost after update.
@@ -453,7 +455,7 @@ module Sunspot #:nodoc:
453
455
  # you only need to pass hash with property changes
454
456
  #
455
457
  def solr_atomic_update(updates = {})
456
- Sunspot.atomic_update(self.class, self.id => updates)
458
+ Sunspot.atomic_update(self.class, self => updates)
457
459
  end
458
460
 
459
461
  #
@@ -461,7 +463,7 @@ module Sunspot #:nodoc:
461
463
  # See #solr_atomic_update
462
464
  #
463
465
  def solr_atomic_update!(updates = {})
464
- Sunspot.atomic_update!(self.class, self.id => updates)
466
+ Sunspot.atomic_update!(self.class, self => updates)
465
467
  end
466
468
 
467
469
  #
@@ -108,7 +108,7 @@ module Sunspot
108
108
  []
109
109
  end
110
110
 
111
- def facet(name)
111
+ def facet(name, dynamic_name = nil)
112
112
  FacetStub.new
113
113
  end
114
114
 
@@ -127,6 +127,9 @@ module Sunspot
127
127
  def execute
128
128
  self
129
129
  end
130
+
131
+ def spellcheck_collation
132
+ end
130
133
  end
131
134
 
132
135
 
@@ -223,7 +226,7 @@ module Sunspot
223
226
  []
224
227
  end
225
228
 
226
- def facet(name)
229
+ def facet(name, dynamic_name = nil)
227
230
  FacetStub.new
228
231
  end
229
232
 
@@ -31,7 +31,6 @@ namespace :sunspot do
31
31
  # Load all the application's models. Models which invoke 'searchable' will register themselves
32
32
  # in Sunspot.searchable.
33
33
  Rails.application.eager_load!
34
- Rails::Engine.subclasses.each{|engine| engine.instance.eager_load!}
35
34
 
36
35
  if args[:models].present?
37
36
  # Choose a specific subset of models, if requested
@@ -15,7 +15,7 @@ describe 'searchable with lifecycle' do
15
15
  describe 'on update' do
16
16
  before :each do
17
17
  @post = PostWithAuto.create
18
- @post.update_attributes(:title => 'Test 1')
18
+ @post.update(:title => 'Test 1')
19
19
  Sunspot.commit
20
20
  end
21
21
 
@@ -4,6 +4,9 @@ require 'rails/all'
4
4
 
5
5
  Bundler.require(:default, Rails.env) if defined?(Bundler)
6
6
 
7
+ # Load the test engine
8
+ require File.expand_path('../../vendor/engines/test_engine/lib/test_engine', __FILE__)
9
+
7
10
  module RailsApp
8
11
  class Application < Rails::Application
9
12
  config.encoding = 'utf-8'
@@ -3,4 +3,4 @@ require 'rubygems'
3
3
  # Set up gems listed in the Gemfile.
4
4
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
5
 
6
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
6
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,3 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("storage") %>
@@ -0,0 +1,15 @@
1
+ # This model should not be used for any test other than the spec test that
2
+ # checks if all models are loaded. We don't want to pre-load this model in
3
+ # another test because we're checking to see if it will be auto-loaded by
4
+ # the reindex task
5
+ module TestEngine
6
+ class RakeTaskAutoLoadTestModel < ActiveRecord::Base
7
+ def self.table_name
8
+ 'posts'
9
+ end
10
+
11
+ searchable do
12
+ string :name
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ module TestEngine
2
+ class Engine < ::Rails::Engine
3
+ engine_name 'sunspot_rails_test_engine'
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ require_relative "test_engine/engine"
2
+
3
+ module TestEngine
4
+ end
@@ -11,8 +11,8 @@ describe 'sunspot namespace rake task' do
11
11
  it "should reindex all models if none are specified" do
12
12
  run_rake_task("sunspot:reindex", '', '', true)
13
13
 
14
- # This model should not be used by any other test and therefore should only be loaded by this test
15
- expect(Sunspot.searchable.collect(&:name)).to include('RakeTaskAutoLoadTestModel')
14
+ # This models should not be used by any other test and therefore should only be loaded by this test
15
+ expect(Sunspot.searchable.collect(&:name)).to include('RakeTaskAutoLoadTestModel', 'TestEngine::RakeTaskAutoLoadTestModel')
16
16
  end
17
17
 
18
18
  it "should accept a space delimited list of models to reindex" do
@@ -25,28 +25,18 @@ Gem::Specification.new do |s|
25
25
  Rails request.
26
26
  TEXT
27
27
 
28
- s.rubyforge_project = "sunspot"
29
-
30
28
  s.files = `git ls-files`.split("\n")
31
29
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
32
30
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
33
31
  s.require_paths = ["lib"]
34
32
 
35
- if RUBY_VERSION < '2.2'
36
- s.add_dependency 'rails', '>= 3', '< 5'
37
- else
38
- s.add_dependency 'rails', '>= 3'
39
- end
40
-
33
+ s.add_dependency 'rails', '>= 5'
41
34
  s.add_dependency 'sunspot', Sunspot::VERSION
42
35
 
43
- s.add_development_dependency 'appraisal', '2.2.0'
36
+ s.add_development_dependency 'appraisal', '~> 2.5'
44
37
  s.add_development_dependency 'bundler', '>= 1.3.0', '< 2.0' if RUBY_VERSION <= '2.0.0'
45
38
  s.add_development_dependency 'nokogiri', '< 1.7' if RUBY_VERSION <= '2.0.0'
46
- s.add_development_dependency 'rake', '< 12.3'
47
- s.add_development_dependency 'rspec', '~> 3.7'
48
- s.add_development_dependency 'rspec-rails', '~> 3.7'
49
- s.add_development_dependency 'sqlite3', '~> 1.3.0'
39
+ s.add_development_dependency 'rake', '~> 13.2'
50
40
 
51
41
  s.rdoc_options << '--webcvs=http://github.com/outoftime/sunspot/tree/master/%s' <<
52
42
  '--title' << 'Sunspot-Rails - Rails integration for the Sunspot Solr search library - API Documentation' <<
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: 2.5.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mat Brown
@@ -23,10 +23,10 @@ authors:
23
23
  - Sam Granieri
24
24
  - Nick Zadrozny
25
25
  - Jason Ronallo
26
- autorequire:
26
+ autorequire:
27
27
  bindir: bin
28
28
  cert_chain: []
29
- date: 2019-07-12 00:00:00.000000000 Z
29
+ date: 2024-06-07 00:00:00.000000000 Z
30
30
  dependencies:
31
31
  - !ruby/object:Gem::Dependency
32
32
  name: rails
@@ -34,98 +34,56 @@ dependencies:
34
34
  requirements:
35
35
  - - ">="
36
36
  - !ruby/object:Gem::Version
37
- version: '3'
37
+ version: '5'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- version: '3'
44
+ version: '5'
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: sunspot
47
47
  requirement: !ruby/object:Gem::Requirement
48
48
  requirements:
49
49
  - - '='
50
50
  - !ruby/object:Gem::Version
51
- version: 2.5.0
51
+ version: 2.7.0
52
52
  type: :runtime
53
53
  prerelease: false
54
54
  version_requirements: !ruby/object:Gem::Requirement
55
55
  requirements:
56
56
  - - '='
57
57
  - !ruby/object:Gem::Version
58
- version: 2.5.0
58
+ version: 2.7.0
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: appraisal
61
- requirement: !ruby/object:Gem::Requirement
62
- requirements:
63
- - - '='
64
- - !ruby/object:Gem::Version
65
- version: 2.2.0
66
- type: :development
67
- prerelease: false
68
- version_requirements: !ruby/object:Gem::Requirement
69
- requirements:
70
- - - '='
71
- - !ruby/object:Gem::Version
72
- version: 2.2.0
73
- - !ruby/object:Gem::Dependency
74
- name: rake
75
- requirement: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - "<"
78
- - !ruby/object:Gem::Version
79
- version: '12.3'
80
- type: :development
81
- prerelease: false
82
- version_requirements: !ruby/object:Gem::Requirement
83
- requirements:
84
- - - "<"
85
- - !ruby/object:Gem::Version
86
- version: '12.3'
87
- - !ruby/object:Gem::Dependency
88
- name: rspec
89
- requirement: !ruby/object:Gem::Requirement
90
- requirements:
91
- - - "~>"
92
- - !ruby/object:Gem::Version
93
- version: '3.7'
94
- type: :development
95
- prerelease: false
96
- version_requirements: !ruby/object:Gem::Requirement
97
- requirements:
98
- - - "~>"
99
- - !ruby/object:Gem::Version
100
- version: '3.7'
101
- - !ruby/object:Gem::Dependency
102
- name: rspec-rails
103
61
  requirement: !ruby/object:Gem::Requirement
104
62
  requirements:
105
63
  - - "~>"
106
64
  - !ruby/object:Gem::Version
107
- version: '3.7'
65
+ version: '2.5'
108
66
  type: :development
109
67
  prerelease: false
110
68
  version_requirements: !ruby/object:Gem::Requirement
111
69
  requirements:
112
70
  - - "~>"
113
71
  - !ruby/object:Gem::Version
114
- version: '3.7'
72
+ version: '2.5'
115
73
  - !ruby/object:Gem::Dependency
116
- name: sqlite3
74
+ name: rake
117
75
  requirement: !ruby/object:Gem::Requirement
118
76
  requirements:
119
77
  - - "~>"
120
78
  - !ruby/object:Gem::Version
121
- version: 1.3.0
79
+ version: '13.2'
122
80
  type: :development
123
81
  prerelease: false
124
82
  version_requirements: !ruby/object:Gem::Requirement
125
83
  requirements:
126
84
  - - "~>"
127
85
  - !ruby/object:Gem::Version
128
- version: 1.3.0
86
+ version: '13.2'
129
87
  description: |2
130
88
  Sunspot::Rails is an extension to the Sunspot library for Solr search.
131
89
  Sunspot::Rails adds integration between Sunspot and ActiveRecord, including
@@ -199,8 +157,12 @@ files:
199
157
  - spec/rails_app/config/initializers/secret_token.rb
200
158
  - spec/rails_app/config/initializers/session_store.rb
201
159
  - spec/rails_app/config/routes.rb
160
+ - spec/rails_app/config/storage.yml
202
161
  - spec/rails_app/config/sunspot.yml
203
162
  - spec/rails_app/db/schema.rb
163
+ - spec/rails_app/vendor/engines/test_engine/app/models/test_engine/rake_task_auto_load_test_model.rb
164
+ - spec/rails_app/vendor/engines/test_engine/lib/test_engine.rb
165
+ - spec/rails_app/vendor/engines/test_engine/lib/test_engine/engine.rb
204
166
  - spec/rake_task_spec.rb
205
167
  - spec/request_lifecycle_spec.rb
206
168
  - spec/schema.rb
@@ -216,7 +178,7 @@ homepage: http://github.com/sunspot/sunspot/tree/master/sunspot_rails
216
178
  licenses:
217
179
  - MIT
218
180
  metadata: {}
219
- post_install_message:
181
+ post_install_message:
220
182
  rdoc_options:
221
183
  - "--webcvs=http://github.com/outoftime/sunspot/tree/master/%s"
222
184
  - "--title"
@@ -236,8 +198,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
198
  - !ruby/object:Gem::Version
237
199
  version: '0'
238
200
  requirements: []
239
- rubygems_version: 3.0.2
240
- signing_key:
201
+ rubygems_version: 3.4.19
202
+ signing_key:
241
203
  specification_version: 4
242
204
  summary: Rails integration for the Sunspot Solr search library
243
205
  test_files:
@@ -265,8 +227,12 @@ test_files:
265
227
  - spec/rails_app/config/initializers/secret_token.rb
266
228
  - spec/rails_app/config/initializers/session_store.rb
267
229
  - spec/rails_app/config/routes.rb
230
+ - spec/rails_app/config/storage.yml
268
231
  - spec/rails_app/config/sunspot.yml
269
232
  - spec/rails_app/db/schema.rb
233
+ - spec/rails_app/vendor/engines/test_engine/app/models/test_engine/rake_task_auto_load_test_model.rb
234
+ - spec/rails_app/vendor/engines/test_engine/lib/test_engine.rb
235
+ - spec/rails_app/vendor/engines/test_engine/lib/test_engine/engine.rb
270
236
  - spec/rake_task_spec.rb
271
237
  - spec/request_lifecycle_spec.rb
272
238
  - spec/schema.rb