elasticsearch-extensions 0.0.30 → 0.0.31

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
  SHA256:
3
- metadata.gz: f4760fbeff3a693cc08f02710afebaaf1dbca1a0d0771c36fc3b5072932f0268
4
- data.tar.gz: 6f3da46e288f0ca3d98be99e6e1455dd18d2af0b69d2a3b3841a3fbbf70c660a
3
+ metadata.gz: f5f6b6c31f37e1278f22a8b9ab0c21a369f29c02c24d761c12c25126d068cbd5
4
+ data.tar.gz: 932658f2b66a2501955eb4316cf6ac430296501fe1b7bc48c8837f1ed5a92d5b
5
5
  SHA512:
6
- metadata.gz: 5e6ad27fa0c9588b9f58da4f7cecabba3a96b5b69a51fd469bac7fad0a4fe348fbd9acc8aac8a0b8205fac22fe0e5f62703da639f2bbadccda66ff7541ace0f7
7
- data.tar.gz: a092b5a179bf08df5b13675b0a9f59565bcc0ebfc1e2720f29125f6319d8d47c22ac5e8414976d678b528559c8d0aca5bb8f068f56950c04ba36d29190b24622
6
+ metadata.gz: d865de3f16d4405b49605bf264be22a9995cfb9d4eab8c94dc9ea2eb695ee59e0582541689ccefa6f6fceb38c16566391ab60583329aeb42f861ece224c3c12a
7
+ data.tar.gz: 0b8cffb3648be6894d19286cf708842a5353a54c5c05954eabc0187f6da24cf7dd6e67a0f48da9a41386491e838d08785496f4f6a9dd33e1198d95c1123fbebb
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
  s.add_development_dependency "ruby-prof" unless defined?(JRUBY_VERSION) || defined?(Rubinius)
26
26
  end
27
27
 
28
- s.add_development_dependency "bundler", "> 1"
28
+ s.add_development_dependency "bundler"
29
29
 
30
30
  if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
31
31
  s.add_development_dependency "rake", "~> 11.1"
@@ -37,8 +37,8 @@ Gem::Specification.new do |s|
37
37
 
38
38
  s.add_development_dependency 'shoulda-context'
39
39
  s.add_development_dependency 'mocha'
40
- s.add_development_dependency 'minitest', '~> 5'
41
- s.add_development_dependency 'minitest-reporters', '~> 1'
40
+ s.add_development_dependency 'minitest'
41
+ s.add_development_dependency 'minitest-reporters'
42
42
  s.add_development_dependency 'simplecov'
43
43
  s.add_development_dependency 'yard'
44
44
  s.add_development_dependency 'cane'
@@ -453,10 +453,10 @@ module Elasticsearch
453
453
  path_to_lib = File.dirname(arguments[:command]) + '/../lib/'
454
454
  version = if arguments[:version]
455
455
  arguments[:version]
456
- elsif File.exist?(path_to_lib) && !(jar = Dir.entries(path_to_lib).select { |f| f.start_with? 'elasticsearch' }.first).nil?
456
+ elsif File.exist?(path_to_lib) && !(jar = Dir.entries(path_to_lib).select { |f| f =~ /^elasticsearch\-\d/ }.first).nil?
457
457
  __log "Determining version from [#{jar}]" if ENV['DEBUG']
458
- if m = jar.match(/elasticsearch\-(\d+\.\d+\.\d+).*/)
459
- m[1]
458
+ if m = jar.match(/elasticsearch\-(\S+-)?(?<version>\d+\.\d+\.\d+).*/)
459
+ m[:version]
460
460
  else
461
461
  raise RuntimeError, "Cannot determine Elasticsearch version from jar [#{jar}]"
462
462
  end
@@ -483,15 +483,14 @@ module Elasticsearch
483
483
  begin
484
484
  # First, try the new `--version` syntax...
485
485
  __log "Running [#{arguments[:command]} --version] to determine version" if ENV['DEBUG']
486
- rout, wout = IO.pipe
487
- pid = Process.spawn("#{arguments[:command]} --version", out: wout)
486
+ io = IO.popen("#{arguments[:command]} --version")
487
+ pid = io.pid
488
488
 
489
489
  Timeout::timeout(arguments[:timeout_version]) do
490
490
  Process.wait(pid)
491
- wout.close unless wout.closed?
492
- output = rout.read unless rout.closed?
493
- rout.close unless rout.closed?
491
+ output = io.read
494
492
  end
493
+
495
494
  rescue Timeout::Error
496
495
  # ...else, the old `-v` syntax
497
496
  __log "Running [#{arguments[:command]} -v] to determine version" if ENV['DEBUG']
@@ -500,8 +499,7 @@ module Elasticsearch
500
499
  if pid
501
500
  Process.kill('INT', pid) rescue Errno::ESRCH # Most likely the process has terminated already
502
501
  end
503
- wout.close unless wout.closed?
504
- rout.close unless rout.closed?
502
+ io.close unless io.closed?
505
503
  end
506
504
 
507
505
  STDERR.puts "> #{output}" if ENV['DEBUG']
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module Extensions
3
- VERSION = "0.0.30"
3
+ VERSION = "0.0.31"
4
4
  end
5
5
  end
@@ -252,7 +252,7 @@ class Elasticsearch::Extensions::TestClusterTest < Elasticsearch::Test::UnitTest
252
252
 
253
253
  should "return version from lib/elasticsearch.X.Y.Z.jar" do
254
254
  File.expects(:exist?).with('/foo/bar/bin/../lib/').returns(true)
255
- Dir.expects(:entries).with('/foo/bar/bin/../lib/').returns(['foo.jar', 'elasticsearch-2.3.0.jar'])
255
+ Dir.expects(:entries).with('/foo/bar/bin/../lib/').returns(['foo.jar', 'elasticsearch-foo-1.0.0.jar', 'elasticsearch-2.3.0.jar', 'elasticsearch-bar-9.9.9.jar'])
256
256
 
257
257
  assert_equal '2.0', @subject.__determine_version
258
258
  end
@@ -261,13 +261,16 @@ class Elasticsearch::Extensions::TestClusterTest < Elasticsearch::Test::UnitTest
261
261
  File.expects(:exist?).with('/foo/bar/bin/../lib/').returns(false)
262
262
  File.expects(:exist?).with('/foo/bar/bin/elasticsearch').returns(true)
263
263
 
264
+ io = mock('IO')
265
+ io.expects(:pid).returns(123)
266
+ io.expects(:read).returns('Version: 2.3.0-SNAPSHOT, Build: d1c86b0/2016-03-30T10:43:20Z, JVM: 1.8.0_60')
267
+ io.expects(:closed?).returns(false)
268
+ io.expects(:close)
269
+ IO.expects(:popen).returns(io)
270
+
264
271
  Process.stubs(:wait)
265
- Process.expects(:spawn).returns(123)
266
272
  Process.expects(:kill).with('INT', 123)
267
273
 
268
- IO.any_instance.expects(:read)
269
- .returns('Version: 2.3.0-SNAPSHOT, Build: d1c86b0/2016-03-30T10:43:20Z, JVM: 1.8.0_60')
270
-
271
274
  assert_equal '2.0', @subject.__determine_version
272
275
  end
273
276
 
@@ -288,12 +291,16 @@ class Elasticsearch::Extensions::TestClusterTest < Elasticsearch::Test::UnitTest
288
291
  File.expects(:exist?).with('/foo/bar/bin/../lib/').returns(false)
289
292
  File.expects(:exist?).with('/foo/bar/bin/elasticsearch').returns(true)
290
293
 
294
+ io = mock('IO')
295
+ io.expects(:pid).returns(123)
296
+ io.expects(:read).returns('Version: FOOBAR')
297
+ io.expects(:closed?).returns(false)
298
+ io.expects(:close)
299
+ IO.expects(:popen).returns(io)
300
+
291
301
  Process.stubs(:wait)
292
- Process.expects(:spawn).returns(123)
293
302
  Process.expects(:kill).with('INT', 123)
294
303
 
295
- IO.any_instance.expects(:read).returns('Version: FOOBAR')
296
-
297
304
  assert_raise(RuntimeError) { @subject.__determine_version }
298
305
  end
299
306
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.30
4
+ version: 0.0.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-09 00:00:00.000000000 Z
11
+ date: 2019-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ansi
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '1'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '1'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -126,30 +126,30 @@ dependencies:
126
126
  name: minitest
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: '5'
131
+ version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: '5'
138
+ version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: minitest-reporters
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - "~>"
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
- version: '1'
145
+ version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - "~>"
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
- version: '1'
152
+ version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: simplecov
155
155
  requirement: !ruby/object:Gem::Requirement