refinerycms-solr 1.0.4 → 1.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/.gitignore +18 -18
- data/.travis.yml +20 -17
- data/Gemfile +42 -42
- data/LICENSE.txt +22 -22
- data/README.md +27 -27
- data/Rakefile +21 -21
- data/app/decorators/models/refinery/image_decorator.rb +10 -10
- data/app/decorators/models/refinery/page_decorator.rb +14 -14
- data/app/decorators/models/refinery/resource_decorator.rb +10 -10
- data/app/decorators/models/refinery/user_decorator.rb +10 -10
- data/app/views/refinery/admin/_search.html.erb +1 -1
- data/app/views/refinery/admin/_search_header.html.erb +1 -1
- data/app/views/refinery/solr/admin/_search.html.erb +7 -7
- data/app/views/refinery/solr/admin/_search_header.html.erb +4 -4
- data/config/sunspot.yml +22 -22
- data/contributing.md +17 -17
- data/lib/refinery/solr.rb +12 -12
- data/lib/refinery/solr/active_record.rb +12 -12
- data/lib/refinery/solr/engine.rb +13 -13
- data/lib/refinery/solr/version.rb +18 -18
- data/lib/refinerycms-solr.rb +3 -3
- data/refinery-solr.gemspec +33 -33
- data/script/rails +5 -5
- data/spec/features/refinery/solr/admin/search_spec.rb +78 -78
- data/spec/spec_helper.rb +63 -63
- data/tasks/rspec.rake +4 -4
- data/tasks/solr.rake +17 -17
- metadata +27 -9
- checksums.yaml +0 -7
data/.gitignore
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
*.gem
|
|
2
|
-
*.rbc
|
|
3
|
-
.bundle
|
|
4
|
-
.config
|
|
5
|
-
.yardoc
|
|
6
|
-
Gemfile.lock
|
|
7
|
-
InstalledFiles
|
|
8
|
-
_yardoc
|
|
9
|
-
coverage
|
|
10
|
-
doc/
|
|
11
|
-
lib/bundler/man
|
|
12
|
-
pkg
|
|
13
|
-
rdoc
|
|
14
|
-
spec/reports
|
|
15
|
-
test/tmp
|
|
16
|
-
test/version_tmp
|
|
17
|
-
tmp
|
|
18
|
-
spec/dummy
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.yardoc
|
|
6
|
+
Gemfile.lock
|
|
7
|
+
InstalledFiles
|
|
8
|
+
_yardoc
|
|
9
|
+
coverage
|
|
10
|
+
doc/
|
|
11
|
+
lib/bundler/man
|
|
12
|
+
pkg
|
|
13
|
+
rdoc
|
|
14
|
+
spec/reports
|
|
15
|
+
test/tmp
|
|
16
|
+
test/version_tmp
|
|
17
|
+
tmp
|
|
18
|
+
spec/dummy
|
data/.travis.yml
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
bundler_args: --without development
|
|
3
|
-
before_script:
|
|
4
|
-
- "bundle exec rake refinery:solr:dummy_app"
|
|
5
|
-
|
|
6
|
-
rvm:
|
|
7
|
-
- 1.9.3
|
|
8
|
-
- 2.0.0
|
|
9
|
-
env:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
language: ruby
|
|
2
|
+
bundler_args: --without development
|
|
3
|
+
before_script:
|
|
4
|
+
- "bundle exec rake refinery:solr:dummy_app"
|
|
5
|
+
|
|
6
|
+
rvm:
|
|
7
|
+
- 1.9.3
|
|
8
|
+
- 2.0.0
|
|
9
|
+
env:
|
|
10
|
+
global:
|
|
11
|
+
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
|
12
|
+
- "RAILS_VERSION=4.0.0"
|
|
13
|
+
matrix:
|
|
14
|
+
- DB=sqlite3
|
|
15
|
+
- DB=mysql
|
|
16
|
+
- DB=postgresql
|
|
17
|
+
|
|
18
|
+
notifications:
|
|
19
|
+
email: true
|
|
20
|
+
|
|
18
21
|
script: "bundle exec rake spec"
|
data/Gemfile
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
gemspec
|
|
4
|
-
|
|
5
|
-
git 'git://github.com/refinery/refinerycms.git', :branch => 'master' do
|
|
6
|
-
gem 'refinerycms'
|
|
7
|
-
|
|
8
|
-
group :development, :test do
|
|
9
|
-
gem 'refinerycms-testing'
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
git 'git://github.com/refinery/refinerycms-i18n.git', :branch => 'master' do
|
|
14
|
-
gem 'refinerycms-i18n'
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
git 'git://github.com/sunspot/sunspot.git', :branch => 'master' do
|
|
18
|
-
gem 'sunspot'
|
|
19
|
-
gem 'sunspot_rails'
|
|
20
|
-
gem 'sunspot_solr'
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
gem 'globalize3', github: 'svenfuchs/globalize3', branch: 'rails4'
|
|
24
|
-
gem 'seo_meta', github: 'parndt/seo_meta', branch: 'master'
|
|
25
|
-
|
|
26
|
-
group :development, :test do
|
|
27
|
-
require 'rbconfig'
|
|
28
|
-
|
|
29
|
-
gem 'sqlite3', :platform => :ruby
|
|
30
|
-
gem 'mysql2', :platform => :ruby
|
|
31
|
-
gem 'pg', :platform => :ruby
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Refinery/rails should pull in the proper versions of these
|
|
35
|
-
group :assets do
|
|
36
|
-
gem 'sass-rails'
|
|
37
|
-
gem 'uglifier'
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
gem 'jquery-rails'
|
|
41
|
-
gem 'protected_attributes'
|
|
42
|
-
gem 'coveralls', require: false
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
gemspec
|
|
4
|
+
|
|
5
|
+
git 'git://github.com/refinery/refinerycms.git', :branch => 'master' do
|
|
6
|
+
gem 'refinerycms'
|
|
7
|
+
|
|
8
|
+
group :development, :test do
|
|
9
|
+
gem 'refinerycms-testing'
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
git 'git://github.com/refinery/refinerycms-i18n.git', :branch => 'master' do
|
|
14
|
+
gem 'refinerycms-i18n'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
git 'git://github.com/sunspot/sunspot.git', :branch => 'master' do
|
|
18
|
+
gem 'sunspot'
|
|
19
|
+
gem 'sunspot_rails'
|
|
20
|
+
gem 'sunspot_solr'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
gem 'globalize3', github: 'svenfuchs/globalize3', branch: 'rails4'
|
|
24
|
+
gem 'seo_meta', github: 'parndt/seo_meta', branch: 'master'
|
|
25
|
+
|
|
26
|
+
group :development, :test do
|
|
27
|
+
require 'rbconfig'
|
|
28
|
+
|
|
29
|
+
gem 'sqlite3', :platform => :ruby
|
|
30
|
+
gem 'mysql2', :platform => :ruby
|
|
31
|
+
gem 'pg', :platform => :ruby
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Refinery/rails should pull in the proper versions of these
|
|
35
|
+
group :assets do
|
|
36
|
+
gem 'sass-rails'
|
|
37
|
+
gem 'uglifier'
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
gem 'jquery-rails'
|
|
41
|
+
gem 'protected_attributes'
|
|
42
|
+
gem 'coveralls', require: false
|
data/LICENSE.txt
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
Copyright (c) 2013 Jeff Chaput
|
|
2
|
-
|
|
3
|
-
MIT License
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
a copy of this software and associated documentation files (the
|
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
-
the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
included in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
Copyright (c) 2013 Jeff Chaput
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
# Refinery::Solr
|
|
2
|
-
|
|
3
|
-
[](http://badge.fury.io/rb/refinerycms-solr)
|
|
4
|
-
[](https://travis-ci.org/ixmedia/refinerycms-solr)
|
|
5
|
-
[](https://gemnasium.com/ixmedia/refinerycms-solr)
|
|
6
|
-
[](https://codeclimate.com/github/ixmedia/refinerycms-solr)
|
|
7
|
-
[](https://coveralls.io/r/ixmedia/refinerycms-solr)
|
|
8
|
-
|
|
9
|
-
Refinery CMS and Solr plugin. Based on [https://github.com/refinery/refinerycms-acts-as-indexed
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
Add this line to your application's Gemfile:
|
|
14
|
-
|
|
15
|
-
gem 'refinery-solr', '~> 1.0.0'
|
|
16
|
-
|
|
17
|
-
And then execute:
|
|
18
|
-
|
|
19
|
-
$ bundle
|
|
20
|
-
|
|
21
|
-
Or install it yourself as:
|
|
22
|
-
|
|
23
|
-
$ gem install refinery-solr
|
|
24
|
-
|
|
25
|
-
## Contributing
|
|
26
|
-
|
|
27
|
-
See [contributing.md](contributing.md)
|
|
1
|
+
# Refinery::Solr
|
|
2
|
+
|
|
3
|
+
[](http://badge.fury.io/rb/refinerycms-solr)
|
|
4
|
+
[](https://travis-ci.org/ixmedia/refinerycms-solr)
|
|
5
|
+
[](https://gemnasium.com/ixmedia/refinerycms-solr)
|
|
6
|
+
[](https://codeclimate.com/github/ixmedia/refinerycms-solr)
|
|
7
|
+
[](https://coveralls.io/r/ixmedia/refinerycms-solr)
|
|
8
|
+
|
|
9
|
+
Refinery CMS and Solr plugin. Based on [Refinery CMS ActsAsIndexed integration plugin](https://github.com/refinery/refinerycms-acts-as-indexed).
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Add this line to your application's Gemfile:
|
|
14
|
+
|
|
15
|
+
gem 'refinery-solr', '~> 1.0.0'
|
|
16
|
+
|
|
17
|
+
And then execute:
|
|
18
|
+
|
|
19
|
+
$ bundle
|
|
20
|
+
|
|
21
|
+
Or install it yourself as:
|
|
22
|
+
|
|
23
|
+
$ gem install refinery-solr
|
|
24
|
+
|
|
25
|
+
## Contributing
|
|
26
|
+
|
|
27
|
+
See [contributing.md](contributing.md)
|
data/Rakefile
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
#!/usr/bin/env rake
|
|
2
|
-
begin
|
|
3
|
-
require 'bundler/setup'
|
|
4
|
-
rescue LoadError
|
|
5
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
ENGINE_PATH = File.dirname(__FILE__)
|
|
9
|
-
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
|
10
|
-
|
|
11
|
-
if File.exists?(APP_RAKEFILE)
|
|
12
|
-
load 'rails/tasks/engine.rake'
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
require "refinerycms-testing"
|
|
16
|
-
Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH)
|
|
17
|
-
|
|
18
|
-
load File.expand_path('../tasks/rspec.rake', __FILE__)
|
|
19
|
-
load File.expand_path('../tasks/solr.rake', __FILE__)
|
|
20
|
-
|
|
21
|
-
task :default => :spec
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
begin
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
rescue LoadError
|
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
ENGINE_PATH = File.dirname(__FILE__)
|
|
9
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
|
10
|
+
|
|
11
|
+
if File.exists?(APP_RAKEFILE)
|
|
12
|
+
load 'rails/tasks/engine.rake'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
require "refinerycms-testing"
|
|
16
|
+
Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH)
|
|
17
|
+
|
|
18
|
+
load File.expand_path('../tasks/rspec.rake', __FILE__)
|
|
19
|
+
load File.expand_path('../tasks/solr.rake', __FILE__)
|
|
20
|
+
|
|
21
|
+
task :default => :spec
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
require 'sunspot_rails'
|
|
2
|
-
|
|
3
|
-
begin
|
|
4
|
-
Refinery::Image.class_eval do
|
|
5
|
-
searchable do
|
|
6
|
-
text :title
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
rescue NameError
|
|
10
|
-
end
|
|
1
|
+
require 'sunspot_rails'
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
Refinery::Image.class_eval do
|
|
5
|
+
searchable do
|
|
6
|
+
text :title
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
rescue NameError
|
|
10
|
+
end
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
require 'sunspot_rails'
|
|
2
|
-
|
|
3
|
-
begin
|
|
4
|
-
Refinery::Page.class_eval do
|
|
5
|
-
searchable do
|
|
6
|
-
text :title, :meta_description, :menu_title, :browser_title
|
|
7
|
-
|
|
8
|
-
text :all_page_part_content do
|
|
9
|
-
parts.map { |part| part.body }
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
rescue NameError
|
|
14
|
-
end
|
|
1
|
+
require 'sunspot_rails'
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
Refinery::Page.class_eval do
|
|
5
|
+
searchable do
|
|
6
|
+
text :title, :meta_description, :menu_title, :browser_title
|
|
7
|
+
|
|
8
|
+
text :all_page_part_content do
|
|
9
|
+
parts.map { |part| part.body }
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
rescue NameError
|
|
14
|
+
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
require 'sunspot_rails'
|
|
2
|
-
|
|
3
|
-
begin
|
|
4
|
-
Refinery::Resource.class_eval do
|
|
5
|
-
searchable do
|
|
6
|
-
text :file_name, :title, :type_of_content
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
rescue NameError
|
|
10
|
-
end
|
|
1
|
+
require 'sunspot_rails'
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
Refinery::Resource.class_eval do
|
|
5
|
+
searchable do
|
|
6
|
+
text :file_name, :title, :type_of_content
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
rescue NameError
|
|
10
|
+
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
require 'acts_as_indexed'
|
|
2
|
-
|
|
3
|
-
begin
|
|
4
|
-
Refinery::User.class_eval do
|
|
5
|
-
searchable do
|
|
6
|
-
text :username, :email
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
rescue NameError
|
|
10
|
-
end
|
|
1
|
+
require 'acts_as_indexed'
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
Refinery::User.class_eval do
|
|
5
|
+
searchable do
|
|
6
|
+
text :username, :email
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
rescue NameError
|
|
10
|
+
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%= render 'refinery/solr/admin/search', local_assigns if defined?(Refinery::Solr::Engine) %>
|
|
1
|
+
<%= render 'refinery/solr/admin/search', local_assigns if defined?(Refinery::Solr::Engine) %>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%= render 'refinery/solr/admin/search_header', local_assigns if defined?(Refinery::Solr::Engine) %>
|
|
1
|
+
<%= render 'refinery/solr/admin/search_header', local_assigns if defined?(Refinery::Solr::Engine) %>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<form method='GET' action='<%= url %>' class='search_form'>
|
|
2
|
-
<%= text_field :search, nil, :id => 'search', :type => '
|
|
3
|
-
<%= hidden_field :wymeditor, nil, :name => 'wymeditor', :id => nil, :value => true if params[:wymeditor].presence %>
|
|
4
|
-
<%= hidden_field :dialog, nil, :name => 'dialog', :id => nil, :value => true if from_dialog? %>
|
|
5
|
-
<%= hidden_field :callback, nil, :name => 'callback', :id => nil, :value => @callback if @callback.presence %>
|
|
6
|
-
<%= submit_tag t('button_text', :scope => 'refinery.admin.search'), :name => nil %>
|
|
7
|
-
</form>
|
|
1
|
+
<form method='GET' action='<%= url %>' class='search_form'>
|
|
2
|
+
<%= text_field :search, nil, :id => 'search', :type => 'text', :name => 'search', :value => params[:search], :title => t('search_input_notice', :scope => 'refinery.admin.search') %>
|
|
3
|
+
<%= hidden_field :wymeditor, nil, :name => 'wymeditor', :id => nil, :value => true if params[:wymeditor].presence %>
|
|
4
|
+
<%= hidden_field :dialog, nil, :name => 'dialog', :id => nil, :value => true if from_dialog? %>
|
|
5
|
+
<%= hidden_field :callback, nil, :name => 'callback', :id => nil, :value => @callback if @callback.presence %>
|
|
6
|
+
<%= submit_tag t('button_text', :scope => 'refinery.admin.search'), :name => nil %>
|
|
7
|
+
</form>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<% if searching? %>
|
|
2
|
-
<%= link_to t('cancel_search', :scope => 'refinery.admin.search'), url, :class => "cancel-search" %>
|
|
3
|
-
<h2><%= t('results_for_html', :scope => 'refinery.admin.search', :query => h(params[:search])).html_safe %></h2>
|
|
4
|
-
<% end %>
|
|
1
|
+
<% if searching? %>
|
|
2
|
+
<%= link_to t('cancel_search', :scope => 'refinery.admin.search'), url, :class => "cancel-search" %>
|
|
3
|
+
<h2><%= t('results_for_html', :scope => 'refinery.admin.search', :query => h(params[:search])).html_safe %></h2>
|
|
4
|
+
<% end %>
|
data/config/sunspot.yml
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
production:
|
|
2
|
-
solr:
|
|
3
|
-
hostname: localhost
|
|
4
|
-
port: 8983
|
|
5
|
-
log_level: WARNING
|
|
6
|
-
path: /solr/production
|
|
7
|
-
# read_timeout: 2
|
|
8
|
-
# open_timeout: 0.5
|
|
9
|
-
|
|
10
|
-
development:
|
|
11
|
-
solr:
|
|
12
|
-
hostname: localhost
|
|
13
|
-
port: 8982
|
|
14
|
-
log_level: INFO
|
|
15
|
-
path: /solr/development
|
|
16
|
-
|
|
17
|
-
test:
|
|
18
|
-
solr:
|
|
19
|
-
hostname: localhost
|
|
20
|
-
port: 8981
|
|
21
|
-
log_level: WARNING
|
|
22
|
-
path: /solr/test
|
|
1
|
+
production:
|
|
2
|
+
solr:
|
|
3
|
+
hostname: localhost
|
|
4
|
+
port: 8983
|
|
5
|
+
log_level: WARNING
|
|
6
|
+
path: /solr/production
|
|
7
|
+
# read_timeout: 2
|
|
8
|
+
# open_timeout: 0.5
|
|
9
|
+
|
|
10
|
+
development:
|
|
11
|
+
solr:
|
|
12
|
+
hostname: localhost
|
|
13
|
+
port: 8982
|
|
14
|
+
log_level: INFO
|
|
15
|
+
path: /solr/development
|
|
16
|
+
|
|
17
|
+
test:
|
|
18
|
+
solr:
|
|
19
|
+
hostname: localhost
|
|
20
|
+
port: 8981
|
|
21
|
+
log_level: WARNING
|
|
22
|
+
path: /solr/test
|
data/contributing.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# Contribution Guidelines #
|
|
2
|
-
|
|
3
|
-
## Running tests ##
|
|
4
|
-
|
|
5
|
-
Always run tests first. Quick start for tests (requires a dummy application) :
|
|
6
|
-
|
|
7
|
-
bundle install
|
|
8
|
-
bundle exec rake refinery:solr:dummy_app
|
|
9
|
-
bundle exec rake spec
|
|
10
|
-
|
|
11
|
-
## Making a pull request ##
|
|
12
|
-
|
|
13
|
-
If you'd like to submit a pull request please adhere to the following:
|
|
14
|
-
|
|
15
|
-
1. Your code *must* be tested. Please TDD your code!
|
|
16
|
-
2. Two-spaces instead of tabs
|
|
17
|
-
3. General Rails/Ruby naming conventions for files and classes
|
|
1
|
+
# Contribution Guidelines #
|
|
2
|
+
|
|
3
|
+
## Running tests ##
|
|
4
|
+
|
|
5
|
+
Always run tests first. Quick start for tests (requires a dummy application) :
|
|
6
|
+
|
|
7
|
+
bundle install
|
|
8
|
+
bundle exec rake refinery:solr:dummy_app
|
|
9
|
+
bundle exec rake spec
|
|
10
|
+
|
|
11
|
+
## Making a pull request ##
|
|
12
|
+
|
|
13
|
+
If you'd like to submit a pull request please adhere to the following:
|
|
14
|
+
|
|
15
|
+
1. Your code *must* be tested. Please TDD your code!
|
|
16
|
+
2. Two-spaces instead of tabs
|
|
17
|
+
3. General Rails/Ruby naming conventions for files and classes
|
data/lib/refinery/solr.rb
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
module Refinery
|
|
2
|
-
module Solr
|
|
3
|
-
class << self
|
|
4
|
-
def root
|
|
5
|
-
@root ||= Pathname.new(File.expand_path('../../../', __FILE__))
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
require 'refinery/solr/engine'
|
|
12
|
-
require 'refinery/solr/active_record'
|
|
1
|
+
module Refinery
|
|
2
|
+
module Solr
|
|
3
|
+
class << self
|
|
4
|
+
def root
|
|
5
|
+
@root ||= Pathname.new(File.expand_path('../../../', __FILE__))
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
require 'refinery/solr/engine'
|
|
12
|
+
require 'refinery/solr/active_record'
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
require "active_record"
|
|
2
|
-
|
|
3
|
-
module ActiveRecord
|
|
4
|
-
module Solr
|
|
5
|
-
def with_query(query)
|
|
6
|
-
results = self.name.constantize.search { fulltext query }.results
|
|
7
|
-
ids = results.inject([]) {|ids, record| ids << record.id}
|
|
8
|
-
self.where(id: ids)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
1
|
+
require "active_record"
|
|
2
|
+
|
|
3
|
+
module ActiveRecord
|
|
4
|
+
module Solr
|
|
5
|
+
def with_query(query)
|
|
6
|
+
results = self.name.constantize.search { fulltext query }.results
|
|
7
|
+
ids = results.inject([]) {|ids, record| ids << record.id}
|
|
8
|
+
self.where(id: ids)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
13
|
ActiveRecord::Base.extend ActiveRecord::Solr
|
data/lib/refinery/solr/engine.rb
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
module Refinery
|
|
2
|
-
module Solr
|
|
3
|
-
class Engine < Rails::Engine
|
|
4
|
-
|
|
5
|
-
include Refinery::Engine
|
|
6
|
-
|
|
7
|
-
config.to_prepare do
|
|
8
|
-
Decorators.register! ::Refinery::Solr.root
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
1
|
+
module Refinery
|
|
2
|
+
module Solr
|
|
3
|
+
class Engine < Rails::Engine
|
|
4
|
+
|
|
5
|
+
include Refinery::Engine
|
|
6
|
+
|
|
7
|
+
config.to_prepare do
|
|
8
|
+
Decorators.register! ::Refinery::Solr.root
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
module Refinery
|
|
2
|
-
module Solr
|
|
3
|
-
class Version
|
|
4
|
-
@major = 1
|
|
5
|
-
@minor = 0
|
|
6
|
-
@tiny =
|
|
7
|
-
@build = nil
|
|
8
|
-
|
|
9
|
-
class << self
|
|
10
|
-
attr_reader :major, :minor, :tiny, :build
|
|
11
|
-
|
|
12
|
-
def to_s
|
|
13
|
-
[@major, @minor, @tiny, @build].compact.join('.')
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
1
|
+
module Refinery
|
|
2
|
+
module Solr
|
|
3
|
+
class Version
|
|
4
|
+
@major = 1
|
|
5
|
+
@minor = 0
|
|
6
|
+
@tiny = 5
|
|
7
|
+
@build = nil
|
|
8
|
+
|
|
9
|
+
class << self
|
|
10
|
+
attr_reader :major, :minor, :tiny, :build
|
|
11
|
+
|
|
12
|
+
def to_s
|
|
13
|
+
[@major, @minor, @tiny, @build].compact.join('.')
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
data/lib/refinerycms-solr.rb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
require 'sunspot_rails'
|
|
2
|
-
require 'refinerycms-core'
|
|
3
|
-
require 'refinery/solr'
|
|
1
|
+
require 'sunspot_rails'
|
|
2
|
+
require 'refinerycms-core'
|
|
3
|
+
require 'refinery/solr'
|
data/refinery-solr.gemspec
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'refinery/solr/version'
|
|
5
|
-
|
|
6
|
-
rails_version = ['>= 3.1.11', '< 4.1']
|
|
7
|
-
|
|
8
|
-
Gem::Specification.new do |spec|
|
|
9
|
-
spec.name = "refinerycms-solr"
|
|
10
|
-
spec.version = Refinery::Solr::Version.to_s
|
|
11
|
-
spec.authors = ["Jeff Chaput"]
|
|
12
|
-
spec.email = ["jfc@artkeep.net"]
|
|
13
|
-
spec.description = %q{An extension to handle the integration of Refinery CMS and Solr}
|
|
14
|
-
spec.summary = %q{Refinery CMS Solr plugin}
|
|
15
|
-
spec.homepage = "http://open.ixmedia.com"
|
|
16
|
-
spec.license = "MIT"
|
|
17
|
-
|
|
18
|
-
spec.files = `git ls-files`.split($/)
|
|
19
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
20
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
21
|
-
spec.require_paths = ["lib"]
|
|
22
|
-
|
|
23
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
|
24
|
-
spec.add_development_dependency "rake"
|
|
25
|
-
|
|
26
|
-
spec.add_dependency 'refinerycms-core', '~> 3.0.0.dev'
|
|
27
|
-
spec.add_dependency 'sunspot_rails', '~> 2.1.0'
|
|
28
|
-
spec.add_dependency 'sunspot_solr', '~> 2.1.0'
|
|
29
|
-
|
|
30
|
-
spec.add_dependency 'seo_meta', '~> 1.4.0'
|
|
31
|
-
spec.add_dependency 'friendly_id', '~> 5.0.0.rc1'
|
|
32
|
-
spec.add_dependency 'globalize3', '~> 0.3.0'
|
|
33
|
-
end
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'refinery/solr/version'
|
|
5
|
+
|
|
6
|
+
rails_version = ['>= 3.1.11', '< 4.1']
|
|
7
|
+
|
|
8
|
+
Gem::Specification.new do |spec|
|
|
9
|
+
spec.name = "refinerycms-solr"
|
|
10
|
+
spec.version = Refinery::Solr::Version.to_s
|
|
11
|
+
spec.authors = ["Jeff Chaput"]
|
|
12
|
+
spec.email = ["jfc@artkeep.net"]
|
|
13
|
+
spec.description = %q{An extension to handle the integration of Refinery CMS and Solr}
|
|
14
|
+
spec.summary = %q{Refinery CMS Solr plugin}
|
|
15
|
+
spec.homepage = "http://open.ixmedia.com"
|
|
16
|
+
spec.license = "MIT"
|
|
17
|
+
|
|
18
|
+
spec.files = `git ls-files`.split($/)
|
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
20
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
21
|
+
spec.require_paths = ["lib"]
|
|
22
|
+
|
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
|
24
|
+
spec.add_development_dependency "rake"
|
|
25
|
+
|
|
26
|
+
spec.add_dependency 'refinerycms-core', '~> 3.0.0.dev'
|
|
27
|
+
spec.add_dependency 'sunspot_rails', '~> 2.1.0'
|
|
28
|
+
spec.add_dependency 'sunspot_solr', '~> 2.1.0'
|
|
29
|
+
|
|
30
|
+
spec.add_dependency 'seo_meta', '~> 1.4.0'
|
|
31
|
+
spec.add_dependency 'friendly_id', '~> 5.0.0.rc1'
|
|
32
|
+
spec.add_dependency 'globalize3', '~> 0.3.0'
|
|
33
|
+
end
|
data/script/rails
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# This command will automatically be run when you run "rails" with Rails gems installed from the root of your application.
|
|
3
|
-
|
|
4
|
-
ENGINE_PATH = File.expand_path('../..', __FILE__)
|
|
5
|
-
load File.expand_path('../../spec/dummy/script/rails', __FILE__)
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# This command will automatically be run when you run "rails" with Rails gems installed from the root of your application.
|
|
3
|
+
|
|
4
|
+
ENGINE_PATH = File.expand_path('../..', __FILE__)
|
|
5
|
+
load File.expand_path('../../spec/dummy/script/rails', __FILE__)
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
module Refinery
|
|
4
|
-
describe "search" do
|
|
5
|
-
refinery_login_with :refinery_user
|
|
6
|
-
|
|
7
|
-
shared_examples "no result search" do
|
|
8
|
-
it "returns no results" do
|
|
9
|
-
fill_in "search", :with => "yada yada"
|
|
10
|
-
click_button "Search"
|
|
11
|
-
page.should have_content("Sorry, no results found")
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe "images extension" do
|
|
16
|
-
let!(:image) { FactoryGirl.create(:image) }
|
|
17
|
-
before do
|
|
18
|
-
visit refinery.admin_images_path
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it "returns found image" do
|
|
22
|
-
fill_in "search", :with => "beach"
|
|
23
|
-
click_button "Search"
|
|
24
|
-
|
|
25
|
-
within ".actions" do
|
|
26
|
-
page.should have_selector("a[href$='#{image.image_name}']")
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it_behaves_like "no result search"
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
describe "resources extension" do
|
|
34
|
-
before do
|
|
35
|
-
FactoryGirl.create(:resource)
|
|
36
|
-
visit refinery.admin_resources_path
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it "returns found resource" do
|
|
40
|
-
fill_in "search", :with => "refinery"
|
|
41
|
-
click_button "Search"
|
|
42
|
-
page.should have_content("Refinery Is Awesome.txt")
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
it_behaves_like "no result search"
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
describe "pages extension" do
|
|
49
|
-
before do
|
|
50
|
-
FactoryGirl.create(:page, :title => "Ugis Ozols")
|
|
51
|
-
visit refinery.admin_pages_path
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
it "returns found page" do
|
|
55
|
-
fill_in "search", :with => "ugis"
|
|
56
|
-
click_button "Search"
|
|
57
|
-
page.should have_content("Ugis Ozols")
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
it_behaves_like "no result search"
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
describe "users extension" do
|
|
64
|
-
before do
|
|
65
|
-
FactoryGirl.create(:user, :username => "ugis")
|
|
66
|
-
visit refinery.admin_users_path
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
it "returns found user" do
|
|
70
|
-
fill_in "search", :with => "ugis"
|
|
71
|
-
click_button "Search"
|
|
72
|
-
page.should have_content("ugis")
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
it_behaves_like "no result search"
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
end
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module Refinery
|
|
4
|
+
describe "search" do
|
|
5
|
+
refinery_login_with :refinery_user
|
|
6
|
+
|
|
7
|
+
shared_examples "no result search" do
|
|
8
|
+
it "returns no results" do
|
|
9
|
+
fill_in "search", :with => "yada yada"
|
|
10
|
+
click_button "Search"
|
|
11
|
+
page.should have_content("Sorry, no results found")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe "images extension" do
|
|
16
|
+
let!(:image) { FactoryGirl.create(:image) }
|
|
17
|
+
before do
|
|
18
|
+
visit refinery.admin_images_path
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "returns found image" do
|
|
22
|
+
fill_in "search", :with => "beach"
|
|
23
|
+
click_button "Search"
|
|
24
|
+
|
|
25
|
+
within ".actions" do
|
|
26
|
+
page.should have_selector("a[href$='#{image.image_name}']")
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it_behaves_like "no result search"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe "resources extension" do
|
|
34
|
+
before do
|
|
35
|
+
FactoryGirl.create(:resource)
|
|
36
|
+
visit refinery.admin_resources_path
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "returns found resource" do
|
|
40
|
+
fill_in "search", :with => "refinery"
|
|
41
|
+
click_button "Search"
|
|
42
|
+
page.should have_content("Refinery Is Awesome.txt")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it_behaves_like "no result search"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
describe "pages extension" do
|
|
49
|
+
before do
|
|
50
|
+
FactoryGirl.create(:page, :title => "Ugis Ozols")
|
|
51
|
+
visit refinery.admin_pages_path
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it "returns found page" do
|
|
55
|
+
fill_in "search", :with => "ugis"
|
|
56
|
+
click_button "Search"
|
|
57
|
+
page.should have_content("Ugis Ozols")
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it_behaves_like "no result search"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
describe "users extension" do
|
|
64
|
+
before do
|
|
65
|
+
FactoryGirl.create(:user, :username => "ugis")
|
|
66
|
+
visit refinery.admin_users_path
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "returns found user" do
|
|
70
|
+
fill_in "search", :with => "ugis"
|
|
71
|
+
click_button "Search"
|
|
72
|
+
page.should have_content("ugis")
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it_behaves_like "no result search"
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
|
|
3
|
-
require 'coveralls'
|
|
4
|
-
Coveralls.wear!
|
|
5
|
-
|
|
6
|
-
# Configure Rails Environment
|
|
7
|
-
ENV["RAILS_ENV"] ||= 'test'
|
|
8
|
-
|
|
9
|
-
require File.expand_path("../dummy/config/environment", __FILE__)
|
|
10
|
-
|
|
11
|
-
require 'rspec/rails'
|
|
12
|
-
require 'capybara/rspec'
|
|
13
|
-
|
|
14
|
-
require 'socket'
|
|
15
|
-
require 'timeout'
|
|
16
|
-
|
|
17
|
-
def is_port_open?(ip, port)
|
|
18
|
-
begin
|
|
19
|
-
Timeout::timeout(1) do
|
|
20
|
-
begin
|
|
21
|
-
s = TCPSocket.new(ip, port)
|
|
22
|
-
s.close
|
|
23
|
-
return true
|
|
24
|
-
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
|
|
25
|
-
return false
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
rescue Timeout::Error
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
return false
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
Rails.backtrace_cleaner.remove_silencers!
|
|
35
|
-
|
|
36
|
-
RSpec.configure do |config|
|
|
37
|
-
config.mock_with :rspec
|
|
38
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
|
39
|
-
config.filter_run :focus => true
|
|
40
|
-
config.run_all_when_everything_filtered = true
|
|
41
|
-
|
|
42
|
-
config.before(:suite) do
|
|
43
|
-
system "bundle exec rake -f #{File.expand_path("../dummy/Rakefile", __FILE__)} sunspot:solr:start"
|
|
44
|
-
while (!is_port_open?("localhost", 8982))
|
|
45
|
-
sleep(1)
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
config.after(:suite) do
|
|
50
|
-
system "bundle exec rake -f #{File.expand_path("../dummy/Rakefile", __FILE__)} sunspot:solr:stop"
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
# set javascript driver for capybara
|
|
55
|
-
Capybara.javascript_driver = :selenium
|
|
56
|
-
|
|
57
|
-
# Requires supporting files with custom matchers and macros, etc,
|
|
58
|
-
# in ./support/ and its subdirectories including factories.
|
|
59
|
-
([Rails.root.to_s] | ::Refinery::Plugins.registered.pathnames).map{|p|
|
|
60
|
-
Dir[File.join(p, 'spec', 'support', '**', '*.rb').to_s]
|
|
61
|
-
}.flatten.sort.each do |support_file|
|
|
62
|
-
require support_file
|
|
63
|
-
end
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
|
|
3
|
+
require 'coveralls'
|
|
4
|
+
Coveralls.wear!
|
|
5
|
+
|
|
6
|
+
# Configure Rails Environment
|
|
7
|
+
ENV["RAILS_ENV"] ||= 'test'
|
|
8
|
+
|
|
9
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
|
10
|
+
|
|
11
|
+
require 'rspec/rails'
|
|
12
|
+
require 'capybara/rspec'
|
|
13
|
+
|
|
14
|
+
require 'socket'
|
|
15
|
+
require 'timeout'
|
|
16
|
+
|
|
17
|
+
def is_port_open?(ip, port)
|
|
18
|
+
begin
|
|
19
|
+
Timeout::timeout(1) do
|
|
20
|
+
begin
|
|
21
|
+
s = TCPSocket.new(ip, port)
|
|
22
|
+
s.close
|
|
23
|
+
return true
|
|
24
|
+
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
|
|
25
|
+
return false
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
rescue Timeout::Error
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
return false
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
Rails.backtrace_cleaner.remove_silencers!
|
|
35
|
+
|
|
36
|
+
RSpec.configure do |config|
|
|
37
|
+
config.mock_with :rspec
|
|
38
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
|
39
|
+
config.filter_run :focus => true
|
|
40
|
+
config.run_all_when_everything_filtered = true
|
|
41
|
+
|
|
42
|
+
config.before(:suite) do
|
|
43
|
+
system "bundle exec rake -f #{File.expand_path("../dummy/Rakefile", __FILE__)} sunspot:solr:start"
|
|
44
|
+
while (!is_port_open?("localhost", 8982))
|
|
45
|
+
sleep(1)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
config.after(:suite) do
|
|
50
|
+
system "bundle exec rake -f #{File.expand_path("../dummy/Rakefile", __FILE__)} sunspot:solr:stop"
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# set javascript driver for capybara
|
|
55
|
+
Capybara.javascript_driver = :selenium
|
|
56
|
+
|
|
57
|
+
# Requires supporting files with custom matchers and macros, etc,
|
|
58
|
+
# in ./support/ and its subdirectories including factories.
|
|
59
|
+
([Rails.root.to_s] | ::Refinery::Plugins.registered.pathnames).map{|p|
|
|
60
|
+
Dir[File.join(p, 'spec', 'support', '**', '*.rb').to_s]
|
|
61
|
+
}.flatten.sort.each do |support_file|
|
|
62
|
+
require support_file
|
|
63
|
+
end
|
data/tasks/rspec.rake
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require 'rspec/core/rake_task'
|
|
2
|
-
|
|
3
|
-
desc "Run specs"
|
|
4
|
-
RSpec::Core::RakeTask.new
|
|
1
|
+
require 'rspec/core/rake_task'
|
|
2
|
+
|
|
3
|
+
desc "Run specs"
|
|
4
|
+
RSpec::Core::RakeTask.new
|
data/tasks/solr.rake
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
namespace :refinery do
|
|
2
|
-
namespace :solr do
|
|
3
|
-
desc 'Generates a dummy app for testing'
|
|
4
|
-
task :dummy_app do
|
|
5
|
-
system 'bundle exec rake refinery:testing:dummy_app'
|
|
6
|
-
system "cd #{dummy_app_path} && bundle exec rails generate sunspot_rails:install"
|
|
7
|
-
|
|
8
|
-
File.open(File.join(dummy_app_path, 'config', 'sunspot.yml'), 'w') do |config|
|
|
9
|
-
config.puts "development:\n solr:\n hostname: localhost\n port: 8982\n log_level: WARNING\n path: /solr/development\n\ntest:\n solr:\n hostname: localhost\n port: 8982\n log_level: WARNING\n path: /solr/test"
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def dummy_app_path
|
|
15
|
-
Refinery::Testing::Railtie.target_extension_path.join('spec', 'dummy')
|
|
16
|
-
end
|
|
17
|
-
end
|
|
1
|
+
namespace :refinery do
|
|
2
|
+
namespace :solr do
|
|
3
|
+
desc 'Generates a dummy app for testing'
|
|
4
|
+
task :dummy_app do
|
|
5
|
+
system 'bundle exec rake refinery:testing:dummy_app'
|
|
6
|
+
system "cd #{dummy_app_path} && bundle exec rails generate sunspot_rails:install"
|
|
7
|
+
|
|
8
|
+
File.open(File.join(dummy_app_path, 'config', 'sunspot.yml'), 'w') do |config|
|
|
9
|
+
config.puts "development:\n solr:\n hostname: localhost\n port: 8982\n log_level: WARNING\n path: /solr/development\n\ntest:\n solr:\n hostname: localhost\n port: 8982\n log_level: WARNING\n path: /solr/test"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def dummy_app_path
|
|
15
|
+
Refinery::Testing::Railtie.target_extension_path.join('spec', 'dummy')
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
18
|
end
|
metadata
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: refinerycms-solr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.5
|
|
5
|
+
prerelease:
|
|
5
6
|
platform: ruby
|
|
6
7
|
authors:
|
|
7
8
|
- Jeff Chaput
|
|
8
9
|
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
12
|
+
date: 2013-10-04 00:00:00.000000000 Z
|
|
12
13
|
dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
|
14
15
|
name: bundler
|
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
16
18
|
requirements:
|
|
17
19
|
- - ~>
|
|
18
20
|
- !ruby/object:Gem::Version
|
|
@@ -20,6 +22,7 @@ dependencies:
|
|
|
20
22
|
type: :development
|
|
21
23
|
prerelease: false
|
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
23
26
|
requirements:
|
|
24
27
|
- - ~>
|
|
25
28
|
- !ruby/object:Gem::Version
|
|
@@ -27,20 +30,23 @@ dependencies:
|
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
|
28
31
|
name: rake
|
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
30
34
|
requirements:
|
|
31
|
-
- - '>='
|
|
35
|
+
- - ! '>='
|
|
32
36
|
- !ruby/object:Gem::Version
|
|
33
37
|
version: '0'
|
|
34
38
|
type: :development
|
|
35
39
|
prerelease: false
|
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
37
42
|
requirements:
|
|
38
|
-
- - '>='
|
|
43
|
+
- - ! '>='
|
|
39
44
|
- !ruby/object:Gem::Version
|
|
40
45
|
version: '0'
|
|
41
46
|
- !ruby/object:Gem::Dependency
|
|
42
47
|
name: refinerycms-core
|
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
none: false
|
|
44
50
|
requirements:
|
|
45
51
|
- - ~>
|
|
46
52
|
- !ruby/object:Gem::Version
|
|
@@ -48,6 +54,7 @@ dependencies:
|
|
|
48
54
|
type: :runtime
|
|
49
55
|
prerelease: false
|
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
51
58
|
requirements:
|
|
52
59
|
- - ~>
|
|
53
60
|
- !ruby/object:Gem::Version
|
|
@@ -55,6 +62,7 @@ dependencies:
|
|
|
55
62
|
- !ruby/object:Gem::Dependency
|
|
56
63
|
name: sunspot_rails
|
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
|
65
|
+
none: false
|
|
58
66
|
requirements:
|
|
59
67
|
- - ~>
|
|
60
68
|
- !ruby/object:Gem::Version
|
|
@@ -62,6 +70,7 @@ dependencies:
|
|
|
62
70
|
type: :runtime
|
|
63
71
|
prerelease: false
|
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
+
none: false
|
|
65
74
|
requirements:
|
|
66
75
|
- - ~>
|
|
67
76
|
- !ruby/object:Gem::Version
|
|
@@ -69,6 +78,7 @@ dependencies:
|
|
|
69
78
|
- !ruby/object:Gem::Dependency
|
|
70
79
|
name: sunspot_solr
|
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
|
81
|
+
none: false
|
|
72
82
|
requirements:
|
|
73
83
|
- - ~>
|
|
74
84
|
- !ruby/object:Gem::Version
|
|
@@ -76,6 +86,7 @@ dependencies:
|
|
|
76
86
|
type: :runtime
|
|
77
87
|
prerelease: false
|
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
+
none: false
|
|
79
90
|
requirements:
|
|
80
91
|
- - ~>
|
|
81
92
|
- !ruby/object:Gem::Version
|
|
@@ -83,6 +94,7 @@ dependencies:
|
|
|
83
94
|
- !ruby/object:Gem::Dependency
|
|
84
95
|
name: seo_meta
|
|
85
96
|
requirement: !ruby/object:Gem::Requirement
|
|
97
|
+
none: false
|
|
86
98
|
requirements:
|
|
87
99
|
- - ~>
|
|
88
100
|
- !ruby/object:Gem::Version
|
|
@@ -90,6 +102,7 @@ dependencies:
|
|
|
90
102
|
type: :runtime
|
|
91
103
|
prerelease: false
|
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
|
+
none: false
|
|
93
106
|
requirements:
|
|
94
107
|
- - ~>
|
|
95
108
|
- !ruby/object:Gem::Version
|
|
@@ -97,6 +110,7 @@ dependencies:
|
|
|
97
110
|
- !ruby/object:Gem::Dependency
|
|
98
111
|
name: friendly_id
|
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
|
113
|
+
none: false
|
|
100
114
|
requirements:
|
|
101
115
|
- - ~>
|
|
102
116
|
- !ruby/object:Gem::Version
|
|
@@ -104,6 +118,7 @@ dependencies:
|
|
|
104
118
|
type: :runtime
|
|
105
119
|
prerelease: false
|
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
none: false
|
|
107
122
|
requirements:
|
|
108
123
|
- - ~>
|
|
109
124
|
- !ruby/object:Gem::Version
|
|
@@ -111,6 +126,7 @@ dependencies:
|
|
|
111
126
|
- !ruby/object:Gem::Dependency
|
|
112
127
|
name: globalize3
|
|
113
128
|
requirement: !ruby/object:Gem::Requirement
|
|
129
|
+
none: false
|
|
114
130
|
requirements:
|
|
115
131
|
- - ~>
|
|
116
132
|
- !ruby/object:Gem::Version
|
|
@@ -118,6 +134,7 @@ dependencies:
|
|
|
118
134
|
type: :runtime
|
|
119
135
|
prerelease: false
|
|
120
136
|
version_requirements: !ruby/object:Gem::Requirement
|
|
137
|
+
none: false
|
|
121
138
|
requirements:
|
|
122
139
|
- - ~>
|
|
123
140
|
- !ruby/object:Gem::Version
|
|
@@ -159,26 +176,27 @@ files:
|
|
|
159
176
|
homepage: http://open.ixmedia.com
|
|
160
177
|
licenses:
|
|
161
178
|
- MIT
|
|
162
|
-
metadata: {}
|
|
163
179
|
post_install_message:
|
|
164
180
|
rdoc_options: []
|
|
165
181
|
require_paths:
|
|
166
182
|
- lib
|
|
167
183
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
|
+
none: false
|
|
168
185
|
requirements:
|
|
169
|
-
- - '>='
|
|
186
|
+
- - ! '>='
|
|
170
187
|
- !ruby/object:Gem::Version
|
|
171
188
|
version: '0'
|
|
172
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
|
+
none: false
|
|
173
191
|
requirements:
|
|
174
|
-
- - '>='
|
|
192
|
+
- - ! '>='
|
|
175
193
|
- !ruby/object:Gem::Version
|
|
176
194
|
version: '0'
|
|
177
195
|
requirements: []
|
|
178
196
|
rubyforge_project:
|
|
179
|
-
rubygems_version:
|
|
197
|
+
rubygems_version: 1.8.24
|
|
180
198
|
signing_key:
|
|
181
|
-
specification_version:
|
|
199
|
+
specification_version: 3
|
|
182
200
|
summary: Refinery CMS Solr plugin
|
|
183
201
|
test_files:
|
|
184
202
|
- spec/features/refinery/solr/admin/search_spec.rb
|
checksums.yaml
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
SHA1:
|
|
3
|
-
metadata.gz: 0080efa9e519ba69dc04b8c5e46b507bc5887e03
|
|
4
|
-
data.tar.gz: 275d18a359c9ccca44c03738f3ffeec9b29fded5
|
|
5
|
-
SHA512:
|
|
6
|
-
metadata.gz: 348ccd3190ceee668ea258da9aafdf27321ae5509eec7b4692960182f4dcf07b32b05e2475db6ca397ee3cb4497cd5d201aa7add97aa4f772771d0a916edce3f
|
|
7
|
-
data.tar.gz: eafcd2c5fb33913faf27280054f3d55a110aa112c038ead6d2b31987fc829abae900154f1ce41405fd5a33fa07c3a371ca8465cdf60f8a967a003ed705c78ac9
|