meilisearch-rails 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +23 -16
- data/README.md +40 -33
- data/Rakefile +4 -3
- data/lib/meilisearch/configuration.rb +9 -3
- data/lib/meilisearch/errors.rb +12 -0
- data/lib/meilisearch/pagination/kaminari.rb +13 -7
- data/lib/meilisearch/pagination/will_paginate.rb +3 -2
- data/lib/meilisearch/pagination.rb +5 -6
- data/lib/meilisearch/railtie.rb +2 -1
- data/lib/meilisearch/tasks/meilisearch.rake +8 -10
- data/lib/meilisearch/utilities.rb +11 -15
- data/lib/meilisearch/version.rb +3 -1
- data/lib/meilisearch-rails.rb +197 -180
- data/meilisearch-rails.gemspec +25 -35
- metadata +6 -7
- data/spec/spec_helper.rb +0 -52
- data/spec/utilities_spec.rb +0 -30
data/meilisearch-rails.gemspec
CHANGED
@@ -1,46 +1,36 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
1
|
require File.join(File.dirname(__FILE__), 'lib', 'meilisearch', 'version')
|
4
2
|
|
5
3
|
require 'date'
|
6
4
|
|
7
5
|
Gem::Specification.new do |s|
|
8
|
-
s.name =
|
6
|
+
s.name = 'meilisearch-rails'
|
9
7
|
s.version = MeiliSearch::VERSION
|
10
8
|
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(
|
12
|
-
s.authors = [
|
13
|
-
s.
|
14
|
-
s.
|
15
|
-
s.
|
9
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
10
|
+
s.authors = ['Meili']
|
11
|
+
s.description = 'MeiliSearch integration for Ruby on Rails. See https://github.com/meilisearch/MeiliSearch'
|
12
|
+
s.email = 'bonjour@meilisearch.com'
|
13
|
+
s.homepage = 'http://github.com/meilisearch/meilisearch-rails'
|
14
|
+
s.licenses = ['MIT']
|
15
|
+
s.require_paths = ['lib']
|
16
|
+
s.summary = 'MeiliSearch integration for Ruby on Rails.'
|
17
|
+
|
16
18
|
s.extra_rdoc_files = [
|
17
|
-
|
18
|
-
|
19
|
+
'LICENSE',
|
20
|
+
'README.md'
|
19
21
|
]
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
"lib/meilisearch/configuration.rb",
|
30
|
-
"lib/meilisearch/pagination.rb",
|
31
|
-
"lib/meilisearch/pagination/kaminari.rb",
|
32
|
-
"lib/meilisearch/pagination/will_paginate.rb",
|
33
|
-
"lib/meilisearch/railtie.rb",
|
34
|
-
"lib/meilisearch/tasks/meilisearch.rake",
|
35
|
-
"lib/meilisearch/utilities.rb",
|
36
|
-
"lib/meilisearch/version.rb",
|
37
|
-
"spec/spec_helper.rb",
|
38
|
-
"spec/utilities_spec.rb"
|
22
|
+
|
23
|
+
s.files = Dir[
|
24
|
+
'lib/**/*',
|
25
|
+
'.rspec',
|
26
|
+
'meilisearch-rails.gemspec',
|
27
|
+
'Gemfile',
|
28
|
+
'LICENSE',
|
29
|
+
'README.md',
|
30
|
+
'Rakefile'
|
39
31
|
]
|
40
|
-
|
41
|
-
s.
|
42
|
-
s.
|
43
|
-
s.
|
44
|
-
s.add_dependency(%q<json>, [">= 1.5.1"])
|
45
|
-
s.add_dependency(%q<meilisearch>, [">= 0.15.3"])
|
32
|
+
|
33
|
+
s.required_ruby_version = '>= 2.6.0'
|
34
|
+
s.add_dependency('json', ['>= 1.5.1'])
|
35
|
+
s.add_dependency('meilisearch', ['>= 0.15.4'])
|
46
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meilisearch-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Meili
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.15.
|
33
|
+
version: 0.15.4
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.15.
|
40
|
+
version: 0.15.4
|
41
41
|
description: MeiliSearch integration for Ruby on Rails. See https://github.com/meilisearch/MeiliSearch
|
42
42
|
email: bonjour@meilisearch.com
|
43
43
|
executables: []
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- Rakefile
|
54
54
|
- lib/meilisearch-rails.rb
|
55
55
|
- lib/meilisearch/configuration.rb
|
56
|
+
- lib/meilisearch/errors.rb
|
56
57
|
- lib/meilisearch/ms_job.rb
|
57
58
|
- lib/meilisearch/pagination.rb
|
58
59
|
- lib/meilisearch/pagination/kaminari.rb
|
@@ -62,8 +63,6 @@ files:
|
|
62
63
|
- lib/meilisearch/utilities.rb
|
63
64
|
- lib/meilisearch/version.rb
|
64
65
|
- meilisearch-rails.gemspec
|
65
|
-
- spec/spec_helper.rb
|
66
|
-
- spec/utilities_spec.rb
|
67
66
|
homepage: http://github.com/meilisearch/meilisearch-rails
|
68
67
|
licenses:
|
69
68
|
- MIT
|
@@ -76,7 +75,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
75
|
requirements:
|
77
76
|
- - ">="
|
78
77
|
- !ruby/object:Gem::Version
|
79
|
-
version:
|
78
|
+
version: 2.6.0
|
80
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
80
|
requirements:
|
82
81
|
- - ">="
|
data/spec/spec_helper.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
require 'timeout'
|
4
|
-
require 'dotenv/load'
|
5
|
-
require 'faker'
|
6
|
-
Bundler.setup :test
|
7
|
-
|
8
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
9
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
10
|
-
|
11
|
-
require 'meilisearch-rails'
|
12
|
-
require 'rspec'
|
13
|
-
require 'rails/all'
|
14
|
-
|
15
|
-
raise "missing MEILISEARCH_HOST or MEILISEARCH_API_KEY environment variables" if ENV['MEILISEARCH_HOST'].nil? || ENV['MEILISEARCH_API_KEY'].nil?
|
16
|
-
|
17
|
-
Thread.current[:meilisearch_hosts] = nil
|
18
|
-
|
19
|
-
RSpec.configure do |c|
|
20
|
-
c.mock_with :rspec
|
21
|
-
c.filter_run focus: true
|
22
|
-
c.run_all_when_everything_filtered = true
|
23
|
-
c.formatter = 'documentation'
|
24
|
-
|
25
|
-
c.around(:each) do |example|
|
26
|
-
Timeout::timeout(120) {
|
27
|
-
example.run
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
# Remove all indexes setup in this run in local or CI
|
32
|
-
c.after(:suite) do
|
33
|
-
safe_index_list.each do |index|
|
34
|
-
MeiliSearch.client.delete_index(index['name'])
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# A unique prefix for your test run in local or CI
|
40
|
-
SAFE_INDEX_PREFIX = "rails_#{SecureRandom.hex(8)}".freeze
|
41
|
-
|
42
|
-
# avoid concurrent access to the same index in local or CI
|
43
|
-
def safe_index_uid(name)
|
44
|
-
"#{SAFE_INDEX_PREFIX}_#{name}"
|
45
|
-
end
|
46
|
-
|
47
|
-
# get a list of safe indexes in local or CI
|
48
|
-
def safe_index_list
|
49
|
-
list = MeiliSearch.client.indexes()
|
50
|
-
list = list.select { |index| index["name"].include?(SAFE_INDEX_PREFIX) }
|
51
|
-
list.sort_by { |index| index["primary"] || "" }
|
52
|
-
end
|
data/spec/utilities_spec.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
2
|
-
|
3
|
-
MeiliSearch.configuration = { meilisearch_host: ENV['MEILISEARCH_HOST'], meilisearch_api_key: ENV['MEILISEARCH_API_KEY'] }
|
4
|
-
|
5
|
-
describe MeiliSearch::Utilities do
|
6
|
-
|
7
|
-
before(:each) do
|
8
|
-
@included_in = MeiliSearch.instance_variable_get :@included_in
|
9
|
-
MeiliSearch.instance_variable_set :@included_in, []
|
10
|
-
|
11
|
-
class Dummy
|
12
|
-
include MeiliSearch
|
13
|
-
|
14
|
-
def self.model_name
|
15
|
-
"Dummy"
|
16
|
-
end
|
17
|
-
|
18
|
-
meilisearch
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
after(:each) do
|
23
|
-
MeiliSearch.instance_variable_set :@included_in, @included_in
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should get the models where MeiliSearch module was included" do
|
27
|
-
(MeiliSearch::Utilities.get_model_classes - [Dummy]).should == []
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|