solr_wrapper 0.9.1 → 0.9.2
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 +4 -4
- data/.rubocop.yml +4 -1
- data/exe/solr_wrapper +1 -3
- data/lib/solr_wrapper/configuration.rb +4 -0
- data/lib/solr_wrapper/instance.rb +23 -13
- data/lib/solr_wrapper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 355fb4da1493c8acef5c50b5592fbe773c220bf2
|
4
|
+
data.tar.gz: 028aaa504c0253da58d78ad498bdfe45849c0795
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5852f71aa91dca84cc24c4587a0300c3cafc218e621d6400a1a21eeab070a659dfa2f81a88417f347af032a9606ad850633548a1079a42cf113244fefcf185be
|
7
|
+
data.tar.gz: 78bc51949c8bf5c2a1dfa107a01144f748e4a3b834b9602fad88ad01785c20e5e74fcf1ea0ce48ef1081681baf79e9ca12d73e74414484206ee65d0db9177ef2
|
data/.rubocop.yml
CHANGED
data/exe/solr_wrapper
CHANGED
@@ -74,9 +74,7 @@ instance.wrap do |conn|
|
|
74
74
|
conn.with_collection(collection_options) do
|
75
75
|
$stderr.puts "http://#{instance.host}:#{instance.port}/solr/"
|
76
76
|
begin
|
77
|
-
|
78
|
-
sleep 1
|
79
|
-
end
|
77
|
+
conn.wait
|
80
78
|
rescue Interrupt
|
81
79
|
$stderr.puts "Solr is shutting down."
|
82
80
|
end
|
@@ -12,7 +12,7 @@ require 'yaml'
|
|
12
12
|
|
13
13
|
module SolrWrapper
|
14
14
|
class Instance
|
15
|
-
attr_reader :config, :md5
|
15
|
+
attr_reader :config, :md5
|
16
16
|
|
17
17
|
##
|
18
18
|
# @param [Hash] options
|
@@ -75,7 +75,7 @@ module SolrWrapper
|
|
75
75
|
|
76
76
|
# Wait for solr to start
|
77
77
|
unless status
|
78
|
-
sleep
|
78
|
+
sleep config.poll_interval
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
@@ -84,15 +84,9 @@ module SolrWrapper
|
|
84
84
|
# Stop Solr and wait for it to finish exiting
|
85
85
|
def stop
|
86
86
|
if config.managed? && started?
|
87
|
-
|
88
87
|
exec('stop', p: port)
|
89
|
-
|
90
|
-
while status
|
91
|
-
sleep 1
|
92
|
-
end
|
88
|
+
wait
|
93
89
|
end
|
94
|
-
|
95
|
-
@pid = nil
|
96
90
|
end
|
97
91
|
|
98
92
|
##
|
@@ -114,12 +108,31 @@ module SolrWrapper
|
|
114
108
|
false
|
115
109
|
end
|
116
110
|
|
111
|
+
def pid
|
112
|
+
return unless config.managed?
|
113
|
+
|
114
|
+
@pid ||= begin
|
115
|
+
out = exec('status').read
|
116
|
+
out.match(/process (?<pid>\d+) running on port #{port}/) do |m|
|
117
|
+
m[:pid].to_i
|
118
|
+
end
|
119
|
+
end
|
120
|
+
rescue
|
121
|
+
nil
|
122
|
+
end
|
123
|
+
|
117
124
|
##
|
118
125
|
# Is Solr running?
|
119
126
|
def started?
|
120
127
|
!!status
|
121
128
|
end
|
122
129
|
|
130
|
+
def wait
|
131
|
+
while (Process.getpgid(pid) rescue status)
|
132
|
+
sleep config.poll_interval
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
123
136
|
##
|
124
137
|
# Create a new collection in solr
|
125
138
|
# @param [Hash] options
|
@@ -305,7 +318,6 @@ module SolrWrapper
|
|
305
318
|
# JRuby
|
306
319
|
env_str = config.env.map { |k, v| "#{Shellwords.escape(k)}=#{Shellwords.escape(v)}" }.join(" ")
|
307
320
|
pid, input, output, error = IO.popen4(env_str + " " + args.join(" "))
|
308
|
-
@pid = pid
|
309
321
|
stringio = StringIO.new
|
310
322
|
if config.verbose? && !silence_output
|
311
323
|
IO.copy_stream(output, $stderr)
|
@@ -318,7 +330,7 @@ module SolrWrapper
|
|
318
330
|
input.close
|
319
331
|
output.close
|
320
332
|
error.close
|
321
|
-
exit_status = Process.waitpid2(
|
333
|
+
exit_status = Process.waitpid2(pid).last
|
322
334
|
else
|
323
335
|
IO.popen(config.env, args + [err: [:child, :out]]) do |io|
|
324
336
|
stringio = StringIO.new
|
@@ -329,8 +341,6 @@ module SolrWrapper
|
|
329
341
|
IO.copy_stream(io, stringio)
|
330
342
|
end
|
331
343
|
|
332
|
-
@pid = io.pid
|
333
|
-
|
334
344
|
_, exit_status = Process.wait2(io.pid)
|
335
345
|
end
|
336
346
|
end
|
data/lib/solr_wrapper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solr_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|