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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba55aa7317d9ac4acbace9b59e95969d5759a2bf
4
- data.tar.gz: 9a930c1afe32ed4195e3184854b74d07937e38f7
3
+ metadata.gz: 35228738d6b8875529106acd57dee54d4492725b
4
+ data.tar.gz: 5290db2983590a68dbecad15428f8d5286087c6c
5
5
  SHA512:
6
- metadata.gz: 5d058e47f7764a219af8abafcd0efce38f0beebd18730cb99d3223b0c4a1b0801dfa1531946c505e147882004a54d3b4014b0158eb1beeeca62bc0e307ec7d74
7
- data.tar.gz: 87fc7daa4404ed7fc49518e4ea0516e7b0911a49756b523b4f4342e63bb4898e6a6cfd42f14c8ade579e1385608d9864188c467993b3ac79a4852231da3bd174
6
+ metadata.gz: f4e7fb32dd4c5a2dff74347ba348e6f7a7ec86660971f5316d336446bd343618938239dac1940ad456a9baa3bba0a0a48f524b889ac083c01fb45a2012aa633f
7
+ data.tar.gz: 3c955ea6ed44496b97ad7ee4d92aa5764e3ff50d0c11c999f7582a6197970eed98d2f829d6ab54424f3b428c7331541307b647eeed30ce67a2176b8dad3d4601
data/Gemfile CHANGED
@@ -2,9 +2,9 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'activerecord'
5
+ gem 'activerecord', '~> 4.1.0'
6
6
  gem 'fakeweb'
7
7
  gem 'rake'
8
8
 
9
9
  gem 'mysql2'
10
- gem 'pg'
10
+ gem 'pg'
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'elastic_record'
5
- s.version = '1.2.4'
5
+ s.version = '1.3.0'
6
6
  s.summary = 'Use Elastic Search with your objects'
7
7
  s.description = 'Find your records with elastic search'
8
8
 
@@ -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
@@ -10,4 +10,8 @@ class ElasticRecord::ConfigTest < MiniTest::Unit::TestCase
10
10
 
11
11
  assert_equal [Warehouse, Widget], ElasticRecord::Config.models
12
12
  end
13
+
14
+ def test_settings
15
+
16
+ end
13
17
  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.2.4
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-05-27 00:00:00.000000000 Z
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.1
136
+ rubygems_version: 2.2.2
137
137
  signing_key:
138
138
  specification_version: 4
139
139
  summary: Use Elastic Search with your objects