websolr-sunspot_rails 0.9.0 → 0.10.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.
- data/README.rdoc +27 -6
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/websolr-sunspot_rails.rb +18 -2
- data/websolr-sunspot_rails.gemspec +5 -2
- metadata +12 -2
data/README.rdoc
CHANGED
@@ -1,18 +1,39 @@
|
|
1
|
-
== About
|
1
|
+
== About
|
2
2
|
|
3
3
|
This is the gem to install for the supported version of sunspot_rails on websolr.
|
4
4
|
|
5
|
-
== Installation
|
5
|
+
== Installation
|
6
6
|
|
7
7
|
cd your_rails_app
|
8
8
|
sudo gem install websolr-sunspot_rails
|
9
|
-
config.gem "websolr-sunspot_rails"
|
10
|
-
echo websolr-sunspot_rails >> .gems
|
11
|
-
./script/generate sunspot
|
12
|
-
require 'sunspot/rails/tasks' >> Rakefile # Installs local development tasks
|
9
|
+
config.gem "websolr-sunspot_rails" # into config.environment.rb
|
10
|
+
echo websolr-sunspot_rails >> .gems # if using Heroku
|
11
|
+
./script/generate sunspot # Installs config/sunspot.yml
|
12
|
+
echo "require 'sunspot/rails/tasks'" >> Rakefile # Installs local development tasks
|
13
13
|
|
14
14
|
== Usage
|
15
15
|
|
16
|
+
=== Starting a local development server
|
17
|
+
|
18
|
+
To start up a Solr instance for development, issue the following:
|
19
|
+
|
20
|
+
rake sunspot:solr:start
|
21
|
+
|
22
|
+
=== Using in production
|
23
|
+
|
24
|
+
You need to make sure that the WEBSOLR_URL environment variable is set correctly.
|
25
|
+
|
26
|
+
If you're using Heroku, this should happen automatically. You can verify by running <code>heroku config</code>.
|
27
|
+
|
28
|
+
If you're running in your own environment, set the environment variable as you normally would on a *nix system.
|
29
|
+
|
30
|
+
If you have to set the variable in Ruby, you should be able to put the following in an Rails initializer:
|
31
|
+
|
32
|
+
if RAILS_ENV == "production"
|
33
|
+
ENV["WEBSOLR_URL"] = "http://index.websolr.com/solr/[your-api-key]"
|
34
|
+
load "websolr-sunspot_rails.rb"
|
35
|
+
end
|
36
|
+
|
16
37
|
=== Setup
|
17
38
|
|
18
39
|
In order for an ActiveRecord model to be indexable and searchable, it must be
|
data/Rakefile
CHANGED
@@ -12,6 +12,7 @@ begin
|
|
12
12
|
gem.authors = ["Kyle Maxwell", "John Barnette", "Mat Brown"]
|
13
13
|
gem.add_dependency "sunspot_rails", "0.11.4"
|
14
14
|
gem.add_dependency "rest-client"
|
15
|
+
gem.add_dependency "json"
|
15
16
|
gem.add_development_dependency "rspec"
|
16
17
|
end
|
17
18
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.10.0
|
@@ -1,5 +1,5 @@
|
|
1
1
|
if ENV["WEBSOLR_URL"]
|
2
|
-
|
2
|
+
require "json"
|
3
3
|
require "rest_client"
|
4
4
|
require "uri"
|
5
5
|
require "sunspot/rails"
|
@@ -8,7 +8,23 @@ if ENV["WEBSOLR_URL"]
|
|
8
8
|
require "sunspot/rails/request_lifecycle"
|
9
9
|
|
10
10
|
api_key = ENV["WEBSOLR_URL"][/[0-9a-f]{11}/] or raise "Invalid WEBSOLR_URL: bad or no api key"
|
11
|
-
|
11
|
+
|
12
|
+
@pending = true
|
13
|
+
Rails.logger.info "Checking index availability"
|
14
|
+
until @pending
|
15
|
+
response = RestClient.post("http://www.websolr.com/schema/#{api_key}.json", :client => "sunspot-0.10")
|
16
|
+
json = JSON.parse(response)
|
17
|
+
case json["status"]
|
18
|
+
when "ok":
|
19
|
+
Rails.logger.info "Index is available!"
|
20
|
+
@pending = false
|
21
|
+
when "pending":
|
22
|
+
Rails.logger.info "Provisioning index, please wait ..."
|
23
|
+
when "error"
|
24
|
+
Rails.logger.error json["message"]
|
25
|
+
@pending = false
|
26
|
+
end
|
27
|
+
end
|
12
28
|
|
13
29
|
module Sunspot #:nodoc:
|
14
30
|
module Rails #:nodoc:
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{websolr-sunspot_rails}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.10.0"
|
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", "John Barnette", "Mat Brown"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-03-01}
|
13
13
|
s.description = %q{websolr to sunspot_rails shim}
|
14
14
|
s.email = %q{kyle@kylemaxwell.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -39,15 +39,18 @@ Gem::Specification.new do |s|
|
|
39
39
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
40
40
|
s.add_runtime_dependency(%q<sunspot_rails>, ["= 0.11.4"])
|
41
41
|
s.add_runtime_dependency(%q<rest-client>, [">= 0"])
|
42
|
+
s.add_runtime_dependency(%q<json>, [">= 0"])
|
42
43
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
43
44
|
else
|
44
45
|
s.add_dependency(%q<sunspot_rails>, ["= 0.11.4"])
|
45
46
|
s.add_dependency(%q<rest-client>, [">= 0"])
|
47
|
+
s.add_dependency(%q<json>, [">= 0"])
|
46
48
|
s.add_dependency(%q<rspec>, [">= 0"])
|
47
49
|
end
|
48
50
|
else
|
49
51
|
s.add_dependency(%q<sunspot_rails>, ["= 0.11.4"])
|
50
52
|
s.add_dependency(%q<rest-client>, [">= 0"])
|
53
|
+
s.add_dependency(%q<json>, [">= 0"])
|
51
54
|
s.add_dependency(%q<rspec>, [">= 0"])
|
52
55
|
end
|
53
56
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: websolr-sunspot_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Maxwell
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2010-
|
14
|
+
date: 2010-03-01 00:00:00 -08:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -34,6 +34,16 @@ dependencies:
|
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: "0"
|
36
36
|
version:
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: json
|
39
|
+
type: :runtime
|
40
|
+
version_requirement:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
version:
|
37
47
|
- !ruby/object:Gem::Dependency
|
38
48
|
name: rspec
|
39
49
|
type: :development
|