elastic_record 1.2.4 → 1.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 +2 -2
- data/elastic_record.gemspec +1 -1
- data/lib/elastic_record/config.rb +8 -0
- data/lib/elastic_record/connection.rb +2 -2
- data/lib/elastic_record/railtie.rb +13 -0
- data/test/elastic_record/config_test.rb +4 -0
- data/test/elastic_record/connection_test.rb +6 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35228738d6b8875529106acd57dee54d4492725b
|
4
|
+
data.tar.gz: 5290db2983590a68dbecad15428f8d5286087c6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4e7fb32dd4c5a2dff74347ba348e6f7a7ec86660971f5316d336446bd343618938239dac1940ad456a9baa3bba0a0a48f524b889ac083c01fb45a2012aa633f
|
7
|
+
data.tar.gz: 3c955ea6ed44496b97ad7ee4d92aa5764e3ff50d0c11c999f7582a6197970eed98d2f829d6ab54424f3b428c7331541307b647eeed30ce67a2176b8dad3d4601
|
data/Gemfile
CHANGED
data/elastic_record.gemspec
CHANGED
@@ -17,6 +17,14 @@ module ElasticRecord
|
|
17
17
|
def models
|
18
18
|
@models ||= model_names.map { |model_name| model_name.constantize }
|
19
19
|
end
|
20
|
+
|
21
|
+
def settings=(settings)
|
22
|
+
self.servers = settings['servers']
|
23
|
+
self.connection_options = settings['options']
|
24
|
+
if scroll_keep_alive = settings['scroll_keep_alive'].presence
|
25
|
+
self.scroll_keep_alive = scroll_keep_alive
|
26
|
+
end
|
27
|
+
end
|
20
28
|
end
|
21
29
|
end
|
22
30
|
end
|
@@ -12,7 +12,7 @@ module ElasticRecord
|
|
12
12
|
self.current_server = next_server
|
13
13
|
self.request_count = 0
|
14
14
|
self.max_request_count = 100
|
15
|
-
self.options = options
|
15
|
+
self.options = options.symbolize_keys
|
16
16
|
self.bulk_stack = []
|
17
17
|
end
|
18
18
|
|
@@ -111,4 +111,4 @@ module ElasticRecord
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
end
|
114
|
-
end
|
114
|
+
end
|
@@ -4,6 +4,19 @@ module ElasticRecord
|
|
4
4
|
require 'elastic_record/log_subscriber'
|
5
5
|
end
|
6
6
|
|
7
|
+
initializer "elastic_record.config" do |app|
|
8
|
+
pathname = Rails.root.join('config', 'elasticsearch.yml')
|
9
|
+
if pathname.exist?
|
10
|
+
config = YAML.load(pathname.read)
|
11
|
+
|
12
|
+
if config = config[Rails.env]
|
13
|
+
ElasticRecord::Config.settings = config
|
14
|
+
else
|
15
|
+
raise "Missing environment #{Rails.env} in superstore.yml"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
7
20
|
rake_tasks do
|
8
21
|
load "elastic_record/tasks/index.rake"
|
9
22
|
end
|
@@ -6,6 +6,11 @@ class ElasticRecord::ConnectionTest < MiniTest::Unit::TestCase
|
|
6
6
|
assert_equal ['foo', 'bar'], ElasticRecord::Connection.new(['foo', 'bar']).servers
|
7
7
|
end
|
8
8
|
|
9
|
+
def test_options
|
10
|
+
expected = {lol: 'rofl'}
|
11
|
+
assert_equal expected, ElasticRecord::Connection.new('foo', 'lol' => 'rofl').options
|
12
|
+
end
|
13
|
+
|
9
14
|
def test_head
|
10
15
|
FakeWeb.register_uri(:head, %r[/success], status: ["200", "OK"])
|
11
16
|
assert_equal "200", connection.head("/success")
|
@@ -57,4 +62,4 @@ class ElasticRecord::ConnectionTest < MiniTest::Unit::TestCase
|
|
57
62
|
def connection
|
58
63
|
ElasticRecord::Connection.new(ElasticRecord::Config.servers)
|
59
64
|
end
|
60
|
-
end
|
65
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Infogroup
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-06-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: arelastic
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: 1.8.11
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.2.
|
136
|
+
rubygems_version: 2.2.2
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: Use Elastic Search with your objects
|