elasticsearch-node 0.6.0 → 0.7.0
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/.travis.yml +2 -1
- data/CHANGELOG.md +10 -0
- data/README.md +0 -5
- data/bin/install_elasticsearch +1 -1
- data/elasticsearch-node.gemspec +1 -4
- data/lib/elasticsearch-node/external.rb +24 -10
- data/lib/elasticsearch-node/version.rb +1 -1
- data/lib/elasticsearch-node.rb +17 -8
- metadata +7 -7
- data/fetch_es.rb +0 -8
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -83,11 +83,6 @@ Please be aware that this library does not add any `at_exit`-hooks to your appli
|
|
83
83
|
|
84
84
|
at_exit { node.close }
|
85
85
|
|
86
|
-
## Flaws
|
87
|
-
|
88
|
-
* No windows support at the moment.
|
89
|
-
* No 1.8 support at the moment.
|
90
|
-
|
91
86
|
### License
|
92
87
|
|
93
88
|
See `COPYING.md` for all details.
|
data/bin/install_elasticsearch
CHANGED
data/elasticsearch-node.gemspec
CHANGED
@@ -13,10 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
|
14
14
|
s.rubyforge_project = "elasticsearch-node"
|
15
15
|
|
16
|
-
s.files = (
|
17
|
-
`git ls-files`.split("\n") +
|
18
|
-
Dir["elasticsearch/{bin,config,lib,README.textile,NOTICE.txt,LICENSE.txt}"]
|
19
|
-
).uniq
|
16
|
+
s.files = `git ls-files`.split("\n")
|
20
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
19
|
s.require_paths = ["lib"]
|
@@ -14,26 +14,25 @@ module ElasticSearch
|
|
14
14
|
|
15
15
|
commandline = opts.map {|opt,value| "-Des.#{opt}=#{value}" }.join(" ")
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
if Kernel.respond_to? :spawn
|
18
|
+
capture_ip_and_port do
|
19
|
+
self.pid = Kernel.spawn("#{Node.binary} -f #{commandline}", :out => :out, :err => :err)
|
20
|
+
end
|
21
|
+
else
|
22
|
+
process = IO.popen("#{Node.binary} -f #{commandline}", "r")
|
23
|
+
parse_ip_and_port(process)
|
24
|
+
start_slurper(process)
|
25
|
+
self.pid = process.pid
|
19
26
|
end
|
20
27
|
|
21
28
|
super(opts)
|
22
29
|
end
|
23
30
|
|
24
31
|
def port
|
25
|
-
unless @port
|
26
|
-
parse_ip_and_port
|
27
|
-
end
|
28
|
-
|
29
32
|
@port
|
30
33
|
end
|
31
34
|
|
32
35
|
def ip
|
33
|
-
unless @ip
|
34
|
-
parse_ip_and_port
|
35
|
-
end
|
36
|
-
|
37
36
|
@ip
|
38
37
|
end
|
39
38
|
|
@@ -68,6 +67,21 @@ module ElasticSearch
|
|
68
67
|
|
69
68
|
$stdout.reopen(old_stdout)
|
70
69
|
end
|
70
|
+
|
71
|
+
def parse_ip_and_port(process)
|
72
|
+
process.each do |line|
|
73
|
+
$stdout << line
|
74
|
+
if line =~ /\[http\s*\].*\/(.*):([0-9]+)/
|
75
|
+
@ip = $1
|
76
|
+
@port = Integer($2)
|
77
|
+
break
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def start_slurper(process)
|
83
|
+
Thread.new { process.each { |line| $stdout << line } }
|
84
|
+
end
|
71
85
|
end
|
72
86
|
end
|
73
87
|
end
|
data/lib/elasticsearch-node.rb
CHANGED
@@ -4,17 +4,21 @@ require 'elasticsearch-node/client_provider'
|
|
4
4
|
module ElasticSearch
|
5
5
|
module Node
|
6
6
|
attr_accessor :version
|
7
|
-
|
7
|
+
|
8
8
|
def self.root(*args)
|
9
9
|
File.join(File.dirname(__FILE__), "..", *args)
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def self.path
|
13
13
|
File.expand_path(File.join(root, "elasticsearch-#{version}"))
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def self.binary
|
17
|
-
|
17
|
+
if self.windows?
|
18
|
+
File.join(path, 'bin', 'elasticsearch.bat')
|
19
|
+
else
|
20
|
+
File.join(path, 'bin', 'elasticsearch')
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
24
|
def self.version
|
@@ -24,17 +28,22 @@ module ElasticSearch
|
|
24
28
|
def self.lib
|
25
29
|
File.join(path, 'lib')
|
26
30
|
end
|
27
|
-
|
31
|
+
|
28
32
|
def self.config(name)
|
29
33
|
root('configs', name.to_s, "config")
|
30
34
|
end
|
31
|
-
|
35
|
+
|
32
36
|
def self.default_config(name)
|
33
37
|
ENV["ES_JAVA_OPTS"] = "-Des.path.conf=#{self.config(name)}"
|
34
38
|
end
|
35
|
-
|
39
|
+
|
36
40
|
def self.version
|
37
|
-
@version || ENV["ES_VERSION"] || "0.19.
|
41
|
+
@version || ENV["ES_VERSION"] || "0.19.2"
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.windows?
|
45
|
+
require 'rbconfig'
|
46
|
+
RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
|
38
47
|
end
|
39
48
|
end
|
40
49
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-node
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-10 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: riot
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152180140 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152180140
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: faraday
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152172260 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152172260
|
36
36
|
description: Helper gem to install and start an elasticsearch node
|
37
37
|
email:
|
38
38
|
- florian.gilcher@asquera.de
|
@@ -43,6 +43,7 @@ extra_rdoc_files: []
|
|
43
43
|
files:
|
44
44
|
- .gitignore
|
45
45
|
- .travis.yml
|
46
|
+
- CHANGELOG.md
|
46
47
|
- COPYING.md
|
47
48
|
- Gemfile
|
48
49
|
- README.md
|
@@ -51,7 +52,6 @@ files:
|
|
51
52
|
- configs/testing/config/elasticsearch.yml
|
52
53
|
- configs/testing/config/logging.yml
|
53
54
|
- elasticsearch-node.gemspec
|
54
|
-
- fetch_es.rb
|
55
55
|
- lib/elasticsearch-node.rb
|
56
56
|
- lib/elasticsearch-node/client_provider.rb
|
57
57
|
- lib/elasticsearch-node/embedded.rb
|
data/fetch_es.rb
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
es_version = ENV['ES_VERSION'] || "0.19.1"
|
4
|
-
|
5
|
-
`curl https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-#{es_version}.tar.gz -L -o elasticsearch.tar.gz`
|
6
|
-
`tar xvf elasticsearch.tar.gz`
|
7
|
-
#mv elasticsearch-$ES_VERSION elasticsearch
|
8
|
-
File.unlink "elasticsearch-#{es_version}.tar.gz"
|