websolr-sunspot_rails 1.1.0.5 → 1.2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,54 +1,15 @@
1
- require 'rubygems'
2
- require 'rake'
1
+ VERSION = File.read(File.join(File.dirname(__FILE__), "VERSION"))
3
2
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "websolr-sunspot_rails"
8
- gem.summary = %Q{websolr to sunspot_rails shim}
9
- gem.description = %Q{websolr to sunspot_rails shim}
10
- gem.email = "kyle@kylemaxwell.com"
11
- gem.homepage = "http://github.com/fizx/websolr-sunspot_rails"
12
- gem.authors = ["Kyle Maxwell", "John Barnette", "Mat Brown", "Nick Zadrozny"]
13
- gem.add_dependency "sunspot_rails", "1.1.0"
14
- gem.add_dependency "json"
15
- gem.add_development_dependency "rspec"
16
- end
17
- Jeweler::GemcutterTasks.new
18
- rescue LoadError
19
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
3
+ desc "Build the websolr-sunspot_rails gem for local testing"
4
+ task :build do
5
+ system "gem build websolr-sunspot_rails.gemspec"
20
6
  end
21
7
 
22
- require 'rake/testtask'
23
- Rake::TestTask.new(:test) do |test|
24
- test.libs << 'lib' << 'test'
25
- test.pattern = 'test/**/test_*.rb'
26
- test.verbose = true
27
- end
28
-
29
- begin
30
- require 'rcov/rcovtask'
31
- Rcov::RcovTask.new do |test|
32
- test.libs << 'test'
33
- test.pattern = 'test/**/test_*.rb'
34
- test.verbose = true
35
- end
36
- rescue LoadError
37
- task :rcov do
38
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
39
- end
40
- end
41
-
42
- task :test => :check_dependencies
43
-
44
- task :default => :test
45
-
46
- require 'rake/rdoctask'
47
- Rake::RDocTask.new do |rdoc|
48
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
-
50
- rdoc.rdoc_dir = 'rdoc'
51
- rdoc.title = "websolr-sunspot_rails #{version}"
52
- rdoc.rdoc_files.include('README*')
53
- rdoc.rdoc_files.include('lib/**/*.rb')
54
- end
8
+ desc "Release the websolr-sunspot_rails gem"
9
+ task :release => :build do
10
+ version_tag = "v#{VERSION}"
11
+ system "git tag -am 'Release version #{VERSION}' '#{version_tag}'"
12
+ system "git push -f origin #{version_tag}:#{version_tag}"
13
+ system "gem push websolr-sunspot_rails-#{VERSION}.gem"
14
+ FileUtils.rm("websolr-sunspot_rails-#{VERSION}.gem")
15
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0.5
1
+ 1.2.1.0
@@ -1,136 +1,2 @@
1
- require "sunspot/rails"
2
- require "sunspot/rails/configuration"
3
- require "sunspot/rails/searchable"
4
- require "sunspot/rails/request_lifecycle"
5
-
6
- if ENV["WEBSOLR_URL"]
7
- require "json"
8
- require "net/http"
9
- require "uri"
10
-
11
- Sunspot.config.solr.url = ENV["WEBSOLR_URL"]
12
-
13
- api_key = ENV["WEBSOLR_URL"][/[0-9a-f]{11}/] or raise "Invalid WEBSOLR_URL: bad or no api key"
14
- ENV["WEBSOLR_CONFIG_HOST"] ||= "www.websolr.com"
15
-
16
- @pending = true
17
- puts "Checking index availability..."
18
-
19
- begin
20
- schema_url = URI.parse("http://#{ENV["WEBSOLR_CONFIG_HOST"]}/schema/#{api_key}.json")
21
- response = Net::HTTP.post_form(schema_url, "client" => "sunspot-1.0")
22
- json = JSON.parse(response.body.to_s)
23
-
24
- case json["status"]
25
- when "ok"
26
- puts "Index is available!"
27
- @pending = false
28
- when "pending"
29
- puts "Provisioning index, things may not be working for a few seconds ..."
30
- sleep 5
31
- when "error"
32
- STDERR.puts json["message"]
33
- @pending = false
34
- else
35
- STDERR.puts "wtf: #{json.inspect}"
36
- end
37
- rescue Exception => e
38
- STDERR.puts "Error checking index status. It may or may not be available.\n" +
39
- "Please email support@onemorecloud.com if this problem persists.\n" +
40
- "Exception: #{e.message}"
41
- end
42
-
43
- module Sunspot #:nodoc:
44
- module Rails #:nodoc:
45
- class Configuration
46
- def hostname
47
- URI.parse(ENV["WEBSOLR_URL"]).host
48
- end
49
- def port
50
- URI.parse(ENV["WEBSOLR_URL"]).port
51
- end
52
- def path
53
- URI.parse(ENV["WEBSOLR_URL"]).path
54
- end
55
- end
56
- end
57
- end
58
-
59
- module Sunspot #:nodoc:
60
- module Rails #:nodoc:
61
- #
62
- # This module adds an after_filter to ActionController::Base that commits
63
- # the Sunspot session if any documents have been added, changed, or removed
64
- # in the course of the request.
65
- #
66
- module RequestLifecycle
67
- class <<self
68
- def included(base) #:nodoc:
69
- base.after_filter do
70
- begin
71
- # Sunspot moved the location of the commit_if_dirty method around.
72
- # Let's support multiple versions for now.
73
- session = Sunspot::Rails.respond_to?(:master_session) ?
74
- Sunspot::Rails.master_session :
75
- Sunspot
76
-
77
- if Sunspot::Rails.configuration.auto_commit_after_request?
78
- session.commit_if_dirty
79
- elsif Sunspot::Rails.configuration.auto_commit_after_delete_request?
80
- session.commit_if_delete_dirty
81
- end
82
- rescue Exception => e
83
- ActionController::Base.logger.error e.message
84
- ActionController::Base.logger.error e.backtrace.join("\n")
85
- false
86
- end
87
- end
88
- end
89
- end
90
- end
91
- end
92
- end
93
-
94
- #
95
- # Silently fail instead of raising an exception when an error occurs while writing to Solr.
96
- # NOTE: does not fail for reads; you should catch those exceptions, for example in a rescue_from statement.
97
- #
98
- require 'sunspot/session_proxy/abstract_session_proxy'
99
- class WebsolrSilentFailSessionProxy < Sunspot::SessionProxy::AbstractSessionProxy
100
- attr_reader :search_session
101
-
102
- delegate :new_search, :search, :config,
103
- :new_more_like_this, :more_like_this,
104
- :delete_dirty, :delete_dirty?,
105
- :to => :search_session
106
-
107
- def initialize(search_session = Sunspot.session)
108
- @search_session = search_session
109
- end
110
-
111
- def rescued_exception(method, e)
112
- $stderr.puts("Exception in #{method}: #{e.message}")
113
- end
114
-
115
- SUPPORTED_METHODS = [
116
- :batch, :commit, :commit_if_dirty, :commit_if_delete_dirty, :dirty?,
117
- :index!, :index, :remove!, :remove, :remove_all!, :remove_all,
118
- :remove_by_id!, :remove_by_id
119
- ]
120
-
121
- SUPPORTED_METHODS.each do |method|
122
- module_eval(<<-RUBY)
123
- def #{method}(*args, &block)
124
- begin
125
- search_session.#{method}(*args, &block)
126
- rescue => e
127
- self.rescued_exception(:#{method}, e)
128
- end
129
- end
130
- RUBY
131
- end
132
- end
133
-
134
- Sunspot.session = WebsolrSilentFailSessionProxy.new(Sunspot.session)
135
-
136
- end
1
+ require "sunspot_rails"
2
+ Sunspot.session = Sunspot::SessionProxy::SilentFailSessionProxy.new(Sunspot.session)
@@ -1,17 +1,15 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
2
+ VERSION = File.read(File.join(File.dirname(__FILE__), "VERSION"))
5
3
 
6
4
  Gem::Specification.new do |s|
7
5
  s.name = %q{websolr-sunspot_rails}
8
- s.version = "1.1.0.5"
6
+ s.version = VERSION
9
7
 
10
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
9
  s.authors = ["Kyle Maxwell", "John Barnette", "Mat Brown", "Nick Zadrozny"]
12
- s.date = %q{2010-07-20}
10
+ s.date = %q{2010-08-30}
13
11
  s.description = %q{websolr to sunspot_rails shim}
14
- s.email = %q{kyle@kylemaxwell.com}
12
+ s.email = %q{info@onemorecloud.com}
15
13
  s.extra_rdoc_files = [
16
14
  "LICENSE",
17
15
  "README.rdoc"
@@ -26,28 +24,25 @@ Gem::Specification.new do |s|
26
24
  "lib/websolr-sunspot_rails.rb",
27
25
  "websolr-sunspot_rails.gemspec"
28
26
  ]
29
- s.homepage = %q{http://github.com/fizx/websolr-sunspot_rails}
27
+ s.homepage = %q{http://github.com/onemorecloud/websolr-sunspot_rails}
30
28
  s.rdoc_options = ["--charset=UTF-8"]
31
29
  s.require_paths = ["lib"]
32
- s.rubygems_version = %q{1.3.7}
30
+ s.rubygems_version = %q{1.3.6}
33
31
  s.summary = %q{websolr to sunspot_rails shim}
34
32
 
35
33
  if s.respond_to? :specification_version then
36
34
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
37
35
  s.specification_version = 3
38
36
 
39
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
40
- s.add_runtime_dependency(%q<sunspot_rails>, ["= 1.1.0"])
41
- s.add_runtime_dependency(%q<json>, [">= 0"])
37
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
38
+ s.add_runtime_dependency(%q<sunspot_rails>, ["= 1.2.1"])
42
39
  s.add_development_dependency(%q<rspec>, [">= 0"])
43
40
  else
44
- s.add_dependency(%q<sunspot_rails>, ["= 1.1.0"])
45
- s.add_dependency(%q<json>, [">= 0"])
41
+ s.add_dependency(%q<sunspot_rails>, ["= 1.2.1"])
46
42
  s.add_dependency(%q<rspec>, [">= 0"])
47
43
  end
48
44
  else
49
- s.add_dependency(%q<sunspot_rails>, ["= 1.1.0"])
50
- s.add_dependency(%q<json>, [">= 0"])
45
+ s.add_dependency(%q<sunspot_rails>, ["= 1.2.1"])
51
46
  s.add_dependency(%q<rspec>, [">= 0"])
52
47
  end
53
48
  end
metadata CHANGED
@@ -4,10 +4,10 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
+ - 2
7
8
  - 1
8
9
  - 0
9
- - 5
10
- version: 1.1.0.5
10
+ version: 1.2.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kyle Maxwell
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-07-20 00:00:00 -07:00
21
+ date: 2010-08-30 00:00:00 -07:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -31,28 +31,15 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  segments:
33
33
  - 1
34
+ - 2
34
35
  - 1
35
- - 0
36
- version: 1.1.0
36
+ version: 1.2.1
37
37
  type: :runtime
38
38
  version_requirements: *id001
39
- - !ruby/object:Gem::Dependency
40
- name: json
41
- prerelease: false
42
- requirement: &id002 !ruby/object:Gem::Requirement
43
- none: false
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- segments:
48
- - 0
49
- version: "0"
50
- type: :runtime
51
- version_requirements: *id002
52
39
  - !ruby/object:Gem::Dependency
53
40
  name: rspec
54
41
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
42
+ requirement: &id002 !ruby/object:Gem::Requirement
56
43
  none: false
57
44
  requirements:
58
45
  - - ">="
@@ -61,9 +48,9 @@ dependencies:
61
48
  - 0
62
49
  version: "0"
63
50
  type: :development
64
- version_requirements: *id003
51
+ version_requirements: *id002
65
52
  description: websolr to sunspot_rails shim
66
- email: kyle@kylemaxwell.com
53
+ email: info@onemorecloud.com
67
54
  executables: []
68
55
 
69
56
  extensions: []
@@ -81,7 +68,7 @@ files:
81
68
  - lib/websolr-sunspot_rails.rb
82
69
  - websolr-sunspot_rails.gemspec
83
70
  has_rdoc: true
84
- homepage: http://github.com/fizx/websolr-sunspot_rails
71
+ homepage: http://github.com/onemorecloud/websolr-sunspot_rails
85
72
  licenses: []
86
73
 
87
74
  post_install_message: