ej 0.1.9 → 0.1.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 837f77d6076803c98698ccb1247f693ec48387f8
4
- data.tar.gz: 969c0b55dae685c6ee5f07dfb137efc7e5206fe2
3
+ metadata.gz: 719a4ba9e1eb1f6fc382cce5f1d1b51571478294
4
+ data.tar.gz: a602858b43d554d18d5c588dad77caee78bf5bef
5
5
  SHA512:
6
- metadata.gz: 372f612991a945796bad11cd4827a068836be6055414a5946213f0f69c8fb508e3fdb506f16fb2b4ef02d95fad8d5d61daff70c3e0f8be6d4de8161e36bd0618
7
- data.tar.gz: 892cbcd94ecbf7627f89cd0396aba6f072971468247f7f34a093bfe1949f7ef8fe653801b5f41b5f0129027ed18ed7df2c7568e13e7185b1e137a45434744caf
6
+ metadata.gz: 7f00eb51f37d65e89791a15b1a327742db9889c8b6e059ded000f9c3e8f940bb72fef98ed074fa0f0b337c1f2966ad85b36697419b5b8fac26c690d1140961e9
7
+ data.tar.gz: e45cde9cc3abe2dcb3e063eba243bc6ef01053f34479e2da656fd877539e2e74d51450313f17f82267d28e10b5f3b84b07ed6192c7c5a5fa68fc8129ee2522bf
@@ -5,7 +5,7 @@ require 'yajl'
5
5
  module Ej
6
6
  class Commands < Thor
7
7
  class_option :index, aliases: '-i', type: :string, default: '_all', desc: 'index'
8
- class_option :host, aliases: '-h', type: :string, default: 'localhost', desc: 'host'
8
+ class_option :host, aliases: '-h', type: :string, default: DEFAULT_HOST, desc: 'host'
9
9
  class_option :debug, aliases: '-d', type: :boolean, default: false, desc: 'debug mode'
10
10
 
11
11
  map '-s' => :search
@@ -1,3 +1,5 @@
1
1
  module Ej
2
2
  DEFAULT_PER = 1000
3
+ DEFAULT_HOST = "localhost"
4
+ DEFAULT_PORT = 9200
3
5
  end
@@ -11,11 +11,16 @@ module Ej
11
11
  @index = global_options[:index]
12
12
  end
13
13
 
14
- def get_client(host, index)
15
- host, port = host.split(':')
14
+ def get_client(host_string, index)
15
+ host, port = (host_string || DEFAULT_HOST), DEFAULT_PORT
16
+ if !host_string.nil? && host_string.include?(":")
17
+ host, port = host_string.split(':')
18
+ end
19
+
20
+ hosts = [{ host: host, port: port }]
16
21
  transport = ::Elasticsearch::Transport::Transport::HTTP::Faraday.new(
17
22
  {
18
- hosts: [{ host: host, port: port }],
23
+ hosts: hosts,
19
24
  options: {
20
25
  reload_connections: true,
21
26
  reload_on_failure: false,
@@ -1,3 +1,3 @@
1
1
  module Ej
2
- VERSION = '0.1.9'
2
+ VERSION = '0.1.10'
3
3
  end
@@ -6,7 +6,7 @@ describe Ej::Core do
6
6
  values = Values.new(
7
7
  {
8
8
  index: '_all',
9
- host: 'localhost',
9
+ host: DEFAULT_HOST,
10
10
  debug: false
11
11
  }
12
12
  )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ej
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - toyama0919
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-22 00:00:00.000000000 Z
11
+ date: 2017-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
204
  version: '0'
205
205
  requirements: []
206
206
  rubyforge_project:
207
- rubygems_version: 2.6.11
207
+ rubygems_version: 2.2.2
208
208
  signing_key:
209
209
  specification_version: 4
210
210
  summary: elasticsearch command line utility.