sunspot_rails 2.0.0.pre.130115 → 2.0.0

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.
@@ -226,7 +226,7 @@ Then, in your spec, use the #disconnect_sunspot method:
226
226
  describe Post do
227
227
  disconnect_sunspot
228
228
 
229
- it 'should have some behavior'
229
+ it 'should have some behavior' do
230
230
  # ...
231
231
  end
232
232
  end
@@ -262,4 +262,4 @@ Please submit bug reports to https://github.com/sunspot/sunspot/issues
262
262
 
263
263
  == License
264
264
 
265
- Sunspot::Rails is distributed under the MIT License, copyright (c) 2009 Mat Brown
265
+ Sunspot::Rails is distributed under the MIT License, copyright (c) 2013 Mat Brown
@@ -1,13 +1,13 @@
1
1
  source :rubygems
2
2
 
3
- gem 'rails', '2.3.14'
4
- gem 'sqlite3-ruby', '~> 1.3.1'
3
+ gem 'rails', '2.3.16'
4
+ gem 'sqlite3', '~> 1.3.7'
5
5
 
6
6
  gem 'sunspot', :path => File.expand_path('../../../sunspot', __FILE__)
7
7
  gem 'sunspot_solr', :path => File.expand_path('../../../sunspot_solr', __FILE__)
8
8
  gem 'sunspot_rails', :path => File.expand_path('../..', __FILE__)
9
9
 
10
10
  group :test do
11
- gem 'rspec-rails', '~> 1.3.4'
11
+ gem 'rspec-rails', '~> 1.3.4'
12
12
  gem 'test-unit', '~> 1.2.3', :platform => :mri_19
13
13
  end
@@ -1,7 +1,7 @@
1
1
  source :rubygems
2
2
 
3
- gem 'rails', '3.2.9'
4
- gem 'sqlite3', '~> 1.3.3'
3
+ gem 'rails', '3.0.20'
4
+ gem 'sqlite3', '~> 1.3.7'
5
5
 
6
6
  gem 'sunspot', :path => File.expand_path('../../../sunspot', __FILE__)
7
7
  gem 'sunspot_solr', :path => File.expand_path('../../../sunspot_solr', __FILE__)
@@ -1,7 +1,7 @@
1
1
  source :rubygems
2
2
 
3
- gem 'rails', '3.1.8'
4
- gem 'sqlite3-ruby', '~> 1.3.1'
3
+ gem 'rails', '3.1.10'
4
+ gem 'sqlite3', '~> 1.3.7'
5
5
 
6
6
  gem 'sunspot', :path => File.expand_path('../../../sunspot', __FILE__)
7
7
  gem 'sunspot_solr', :path => File.expand_path('../../../sunspot_solr', __FILE__)
@@ -1,7 +1,7 @@
1
1
  source :rubygems
2
2
 
3
- gem 'rails', '3.0.17'
4
- gem 'sqlite3-ruby', '~> 1.3.1'
3
+ gem 'rails', '3.2.11'
4
+ gem 'sqlite3', '~> 1.3.7'
5
5
 
6
6
  gem 'sunspot', :path => File.expand_path('../../../sunspot', __FILE__)
7
7
  gem 'sunspot_solr', :path => File.expand_path('../../../sunspot_solr', __FILE__)
@@ -47,6 +47,10 @@ module Sunspot #:nodoc:
47
47
  # configured under <code>solr</code> for all read operations.
48
48
  #
49
49
  class Configuration
50
+ # ActiveSupport log levels are integers; this array maps them to the
51
+ # appropriate java.util.logging.Level constant
52
+ LOG_LEVELS = %w(FINE INFO WARNING SEVERE SEVERE INFO)
53
+
50
54
  attr_writer :user_configuration
51
55
  #
52
56
  # The host name at which to connect to Solr. Default 'localhost'.
@@ -146,17 +150,21 @@ module Sunspot #:nodoc:
146
150
  @has_master = !!user_configuration_from_key('master_solr')
147
151
  end
148
152
 
149
- #
153
+ #
150
154
  # The default log_level that should be passed to solr. You can
151
155
  # change the individual log_levels in the solr admin interface.
152
- # Default 'INFO'.
156
+ # If no level is specified in the sunspot configuration file,
157
+ # use a level similar to Rails own logging level.
153
158
  #
154
159
  # ==== Returns
155
160
  #
156
161
  # String:: log_level
157
162
  #
158
163
  def log_level
159
- @log_level ||= (user_configuration_from_key('solr', 'log_level') || 'INFO')
164
+ @log_level ||= (
165
+ user_configuration_from_key('solr', 'log_level') ||
166
+ LOG_LEVELS[::Rails.logger.level]
167
+ )
160
168
  end
161
169
 
162
170
  #
@@ -1,9 +1,6 @@
1
1
  module Sunspot
2
2
  module Rails
3
3
  class Server < Sunspot::Solr::Server
4
- # ActiveSupport log levels are integers; this array maps them to the
5
- # appropriate java.util.logging.Level constant
6
- LOG_LEVELS = %w(FINE INFO WARNING SEVERE SEVERE INFO)
7
4
 
8
5
  #
9
6
  # Directory in which to store PID files
@@ -58,12 +55,8 @@ module Sunspot
58
55
  configuration.port
59
56
  end
60
57
 
61
- #
62
- # Severity level for logging. This is based on the severity level for the
63
- # Rails logger.
64
- #
65
58
  def log_level
66
- LOG_LEVELS[::Rails.logger.level]
59
+ configuration.log_level
67
60
  end
68
61
 
69
62
  #
@@ -1,12 +1,12 @@
1
1
  namespace :sunspot do
2
2
 
3
- desc "Reindex all solr models that are located in your application's models directory."
3
+ desc "Drop and then reindex all solr models that are located in your application's models directory."
4
4
  # This task depends on the standard Rails file naming \
5
5
  # conventions, in that the file name matches the defined class name. \
6
6
  # By default the indexing system works in batches of 50 records, you can \
7
7
  # set your own value for this by using the batch_size argument. You can \
8
8
  # also optionally define a list of models to separated by a forward slash '/'
9
- #
9
+ #
10
10
  # $ rake sunspot:reindex # reindex all models
11
11
  # $ rake sunspot:reindex[1000] # reindex in batches of 1000
12
12
  # $ rake sunspot:reindex[false] # reindex without batching
@@ -15,17 +15,23 @@ namespace :sunspot do
15
15
  # # batchs of 1000
16
16
  # $ rake sunspot:reindex[,Post+Author] # reindex Post and Author model
17
17
  task :reindex, [:batch_size, :models] => [:environment] do |t, args|
18
+ puts "*Note: the reindex task will remove your current indexes and start from scratch."
19
+ puts "If you have a large dataset, reindexing can take a very long time, possibly weeks."
20
+ puts "This is not encouraged if you have anywhere near or over 1 million rows."
21
+ puts "Are you sure you want to drop your indexes and completely reindex? (y/n)"
22
+ answer = STDIN.gets.chomp
23
+ return false if answer == "n"
18
24
 
19
25
  # Retry once or gracefully fail for a 5xx error so we don't break reindexing
20
26
  Sunspot.session = Sunspot::SessionProxy::Retry5xxSessionProxy.new(Sunspot.session)
21
27
 
22
28
  # Set up general options for reindexing
23
29
  reindex_options = { :batch_commit => false }
24
-
30
+
25
31
  case args[:batch_size]
26
32
  when 'false'
27
33
  reindex_options[:batch_size] = nil
28
- when /^\d+$/
34
+ when /^\d+$/
29
35
  reindex_options[:batch_size] = args[:batch_size].to_i if args[:batch_size].to_i > 0
30
36
  end
31
37
 
@@ -41,7 +47,7 @@ namespace :sunspot do
41
47
  model_names = args[:models].split('+')
42
48
  sunspot_models = model_names.map{ |m| m.constantize }
43
49
  end
44
-
50
+
45
51
  # Set up progress_bar to, ah, report progress
46
52
  begin
47
53
  require 'progress_bar'
@@ -45,8 +45,9 @@ describe Sunspot::Rails::Configuration, "default values without a sunspot.yml" d
45
45
  @config.open_timeout == nil
46
46
  end
47
47
 
48
- it "should handle the 'log_level' property when not set" do
49
- @config.log_level.should == 'INFO'
48
+ it "should set 'log_level' property using Rails log level when not set" do
49
+ ::Rails.logger.stub(:level){ 3 }
50
+ @config.log_level.should == 'SEVERE'
50
51
  end
51
52
 
52
53
  it "should handle the 'log_file' property" do
@@ -4,6 +4,7 @@ describe Sunspot::Rails::Server do
4
4
  before :each do
5
5
  @server = Sunspot::Rails::Server.new
6
6
  @config = Sunspot::Rails::Configuration.new
7
+ @server.stub(:configuration){ @config }
7
8
  @solr_home = File.join(@config.solr_home)
8
9
  end
9
10
 
@@ -23,8 +24,9 @@ describe Sunspot::Rails::Server do
23
24
  @server.port.should == 8983
24
25
  end
25
26
 
26
- it "sets the correct log level" do
27
- @server.log_level.should == "FINE"
27
+ it "sets the log level using configuration" do
28
+ @config.stub(:log_level){ 'WARNING' }
29
+ @server.log_level.should == "WARNING"
28
30
  end
29
31
 
30
32
  it "sets the correct log file" do
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.email = ["mat@patch.com"]
16
16
  s.homepage = 'http://github.com/outoftime/sunspot/tree/master/sunspot_rails'
17
17
  s.summary = 'Rails integration for the Sunspot Solr search library'
18
+ s.license = 'MIT'
18
19
  s.description = <<-TEXT
19
20
  Sunspot::Rails is an extension to the Sunspot library for Solr search.
20
21
  Sunspot::Rails adds integration between Sunspot and ActiveRecord, including
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunspot_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.130115
5
- prerelease: 6
4
+ version: 2.0.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Mat Brown
@@ -27,72 +27,72 @@ authors:
27
27
  autorequire:
28
28
  bindir: bin
29
29
  cert_chain: []
30
- date: 2013-01-15 00:00:00.000000000 Z
30
+ date: 2013-02-26 00:00:00.000000000 Z
31
31
  dependencies:
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: sunspot
34
- prerelease: false
35
34
  requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
36
  requirements:
37
37
  - - '='
38
38
  - !ruby/object:Gem::Version
39
- version: 2.0.0.pre.130115
40
- none: false
39
+ version: 2.0.0
41
40
  type: :runtime
41
+ prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
43
44
  requirements:
44
45
  - - '='
45
46
  - !ruby/object:Gem::Version
46
- version: 2.0.0.pre.130115
47
- none: false
47
+ version: 2.0.0
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: nokogiri
50
- prerelease: false
51
50
  requirement: !ruby/object:Gem::Requirement
51
+ none: false
52
52
  requirements:
53
53
  - - ! '>='
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
- none: false
57
56
  type: :runtime
57
+ prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
59
60
  requirements:
60
61
  - - ! '>='
61
62
  - !ruby/object:Gem::Version
62
63
  version: '0'
63
- none: false
64
64
  - !ruby/object:Gem::Dependency
65
65
  name: rspec
66
- prerelease: false
67
66
  requirement: !ruby/object:Gem::Requirement
67
+ none: false
68
68
  requirements:
69
69
  - - ~>
70
70
  - !ruby/object:Gem::Version
71
71
  version: '1.2'
72
- none: false
73
72
  type: :development
73
+ prerelease: false
74
74
  version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
75
76
  requirements:
76
77
  - - ~>
77
78
  - !ruby/object:Gem::Version
78
79
  version: '1.2'
79
- none: false
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec-rails
82
- prerelease: false
83
82
  requirement: !ruby/object:Gem::Requirement
83
+ none: false
84
84
  requirements:
85
85
  - - ~>
86
86
  - !ruby/object:Gem::Version
87
87
  version: '1.2'
88
- none: false
89
88
  type: :development
89
+ prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
91
92
  requirements:
92
93
  - - ~>
93
94
  - !ruby/object:Gem::Version
94
95
  version: '1.2'
95
- none: false
96
96
  description: ! " Sunspot::Rails is an extension to the Sunspot library for Solr
97
97
  search.\n Sunspot::Rails adds integration between Sunspot and ActiveRecord, including\n
98
98
  \ defining search and indexing related methods on ActiveRecord models themselves,\n
@@ -116,10 +116,10 @@ files:
116
116
  - dev_tasks/release.rake
117
117
  - dev_tasks/spec.rake
118
118
  - dev_tasks/todo.rake
119
- - gemfiles/rails-2.3.14
120
- - gemfiles/rails-3.0.17
121
- - gemfiles/rails-3.1.8
122
- - gemfiles/rails-3.2.9
119
+ - gemfiles/rails-2.3.16
120
+ - gemfiles/rails-3.0.20
121
+ - gemfiles/rails-3.1.10
122
+ - gemfiles/rails-3.2.11
123
123
  - generators/sunspot/sunspot_generator.rb
124
124
  - generators/sunspot/templates/sunspot.yml
125
125
  - install.rb
@@ -172,7 +172,8 @@ files:
172
172
  - sunspot_rails.gemspec
173
173
  - tmp/.gitkeep
174
174
  homepage: http://github.com/outoftime/sunspot/tree/master/sunspot_rails
175
- licenses: []
175
+ licenses:
176
+ - MIT
176
177
  post_install_message:
177
178
  rdoc_options:
178
179
  - --webcvs=http://github.com/outoftime/sunspot/tree/master/%s
@@ -183,20 +184,20 @@ rdoc_options:
183
184
  require_paths:
184
185
  - lib
185
186
  required_ruby_version: !ruby/object:Gem::Requirement
187
+ none: false
186
188
  requirements:
187
189
  - - ! '>='
188
190
  - !ruby/object:Gem::Version
189
191
  version: '0'
190
- none: false
191
192
  required_rubygems_version: !ruby/object:Gem::Requirement
193
+ none: false
192
194
  requirements:
193
- - - ! '>'
195
+ - - ! '>='
194
196
  - !ruby/object:Gem::Version
195
- version: 1.3.1
196
- none: false
197
+ version: '0'
197
198
  requirements: []
198
199
  rubyforge_project: sunspot
199
- rubygems_version: 1.8.24
200
+ rubygems_version: 1.8.23
200
201
  signing_key:
201
202
  specification_version: 3
202
203
  summary: Rails integration for the Sunspot Solr search library