websolr-rails 2.0.4 → 2.0.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/VERSION +1 -1
- data/lib/websolr-rails.rb +30 -26
- data/websolr-rails.gemspec +1 -2
- metadata +1 -2
- data/lib/websolr-rails-adapter.rb +0 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.5
|
data/lib/websolr-rails.rb
CHANGED
@@ -3,44 +3,49 @@
|
|
3
3
|
|
4
4
|
if ENV["WEBSOLR_URL"] && !$websolr_already
|
5
5
|
$websolr_already = true
|
6
|
+
require "uri"
|
6
7
|
|
7
8
|
def websolr_install_sunspot
|
8
|
-
|
9
|
-
|
9
|
+
eval <<-RUBY
|
10
|
+
module Sunspot #:nodoc:
|
11
|
+
module Rails #:nodoc:
|
12
|
+
class Configuration
|
13
|
+
def hostname
|
14
|
+
URI.parse(ENV["WEBSOLR_URL"]).host
|
15
|
+
end
|
16
|
+
def port
|
17
|
+
URI.parse(ENV["WEBSOLR_URL"]).port
|
18
|
+
end
|
19
|
+
def path
|
20
|
+
URI.parse(ENV["WEBSOLR_URL"]).path
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
RUBY
|
10
26
|
end
|
11
|
-
|
27
|
+
|
12
28
|
def websolr_install_acts_as_solr
|
13
|
-
puts "Using websolr-rails for acts_as_solr at #{ENV["WEBSOLR_URL"]}"
|
14
29
|
eval <<-RUBY
|
15
|
-
module
|
30
|
+
module ActsAsSolr
|
16
31
|
class Post
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
32
|
+
def self.execute(request)
|
33
|
+
begin
|
34
|
+
connection = Solr::Connection.new(ENV["WEBSOLR_URL"])
|
35
|
+
return connection.send(request)
|
36
|
+
rescue
|
37
|
+
raise "Couldn't connect to the Solr server at \#{url}. \#{$!}"
|
38
|
+
false
|
25
39
|
end
|
26
40
|
end
|
27
41
|
end
|
28
42
|
end
|
29
43
|
RUBY
|
30
|
-
end
|
31
|
-
|
32
|
-
begin
|
33
|
-
ActsAsSolr
|
34
|
-
websolr_install_acts_as_solr
|
35
|
-
rescue NameError
|
36
|
-
end
|
37
|
-
|
38
|
-
begin
|
39
|
-
Sunspot
|
40
|
-
websolr_install_acts_as_solr
|
41
|
-
rescue NameError
|
42
44
|
end
|
43
45
|
|
46
|
+
websolr_install_sunspot
|
47
|
+
websolr_install_acts_as_solr
|
48
|
+
|
44
49
|
module Kernel #:nodoc: all
|
45
50
|
alias_method :require_without_solr_hooks, :require
|
46
51
|
def require(string)
|
@@ -53,5 +58,4 @@ if ENV["WEBSOLR_URL"] && !$websolr_already
|
|
53
58
|
end
|
54
59
|
end
|
55
60
|
end
|
56
|
-
|
57
61
|
end
|
data/websolr-rails.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{websolr-rails}
|
8
|
-
s.version = "2.0.
|
8
|
+
s.version = "2.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kyle Maxwell"]
|
@@ -23,7 +23,6 @@ Gem::Specification.new do |s|
|
|
23
23
|
"README.rdoc",
|
24
24
|
"Rakefile",
|
25
25
|
"VERSION",
|
26
|
-
"lib/websolr-rails-adapter.rb",
|
27
26
|
"lib/websolr-rails.rb",
|
28
27
|
"lib/websolr.rb",
|
29
28
|
"websolr-rails.gemspec"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: websolr-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Maxwell
|
@@ -29,7 +29,6 @@ files:
|
|
29
29
|
- README.rdoc
|
30
30
|
- Rakefile
|
31
31
|
- VERSION
|
32
|
-
- lib/websolr-rails-adapter.rb
|
33
32
|
- lib/websolr-rails.rb
|
34
33
|
- lib/websolr.rb
|
35
34
|
- websolr-rails.gemspec
|