solr_wrapper 0.4.0 → 0.5.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.
- checksums.yaml +4 -4
- data/exe/solr_wrapper +15 -4
- data/lib/solr_wrapper/instance.rb +8 -5
- data/lib/solr_wrapper/version.rb +1 -1
- data/lib/solr_wrapper.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: 5229665bfffd6eb3c3e38108cd36d84b409cc54b
|
|
4
|
+
data.tar.gz: e8a7241dea583db2962c2b6d6246075b990a3d67
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8c69756abf7399f832f0bf43e2b36d215634fa5d6819bf1809b94e34f9dbf82adf51483c8ab6d5c8b99ac3c941dfad020bb18721dd7b24ff39c4d83eb0973910
|
|
7
|
+
data.tar.gz: e8d79fda52e963694f6e253743ed45e19b41c4c0c676ab73b183340de0d1b8385fa8521da3681e9fd6a16fe6d78ae18aed50b74fa5c1974c6c37e35abf8588a8
|
data/exe/solr_wrapper
CHANGED
|
@@ -17,7 +17,11 @@ OptionParser.new do |opts|
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
opts.on("-pPORT", "--port PORT", "Specify the port Solr should run at (default: 8983)") do |p|
|
|
20
|
-
|
|
20
|
+
if p == 'random'
|
|
21
|
+
options[:port] = nil
|
|
22
|
+
else
|
|
23
|
+
options[:port] = p
|
|
24
|
+
end
|
|
21
25
|
end
|
|
22
26
|
|
|
23
27
|
opts.on("-c", "--cloud", "Run solr in cloud mode") do |c|
|
|
@@ -45,10 +49,17 @@ end.parse!
|
|
|
45
49
|
# default to verbose
|
|
46
50
|
options[:verbose] = true if options[:verbose].nil?
|
|
47
51
|
|
|
48
|
-
SolrWrapper.
|
|
52
|
+
instance = SolrWrapper.default_instance(options)
|
|
53
|
+
$stderr.print "Starting Solr #{instance.version} on port #{instance.port} ... "
|
|
54
|
+
instance.wrap do |conn|
|
|
49
55
|
conn.with_collection(collection_options) do
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
$stderr.puts "http://#{instance.host}:#{instance.port}/solr/"
|
|
57
|
+
begin
|
|
58
|
+
while conn.status
|
|
59
|
+
sleep 1
|
|
60
|
+
end
|
|
61
|
+
rescue Interrupt
|
|
62
|
+
$stderr.puts "Solr is shutting down."
|
|
52
63
|
end
|
|
53
64
|
end
|
|
54
65
|
end
|
|
@@ -87,6 +87,8 @@ module SolrWrapper
|
|
|
87
87
|
|
|
88
88
|
out = exec('status').read
|
|
89
89
|
out =~ /running on port #{port}/
|
|
90
|
+
rescue
|
|
91
|
+
false
|
|
90
92
|
end
|
|
91
93
|
|
|
92
94
|
##
|
|
@@ -143,7 +145,8 @@ module SolrWrapper
|
|
|
143
145
|
##
|
|
144
146
|
# Get the port this Solr instance is running at
|
|
145
147
|
def port
|
|
146
|
-
@port ||= options
|
|
148
|
+
@port ||= options[:port]
|
|
149
|
+
@port ||= random_open_port.to_s
|
|
147
150
|
end
|
|
148
151
|
|
|
149
152
|
##
|
|
@@ -224,6 +227,10 @@ module SolrWrapper
|
|
|
224
227
|
end
|
|
225
228
|
# rubocop:enable Lint/RescueException
|
|
226
229
|
|
|
230
|
+
def version
|
|
231
|
+
@version ||= options.fetch(:version, SolrWrapper.default_solr_version)
|
|
232
|
+
end
|
|
233
|
+
|
|
227
234
|
protected
|
|
228
235
|
|
|
229
236
|
def extracted?
|
|
@@ -335,10 +342,6 @@ module SolrWrapper
|
|
|
335
342
|
"http://www.us.apache.org/dist/lucene/solr/#{version}/solr-#{version}.zip.md5"
|
|
336
343
|
end
|
|
337
344
|
|
|
338
|
-
def version
|
|
339
|
-
@version ||= options.fetch(:version, SolrWrapper.default_solr_version)
|
|
340
|
-
end
|
|
341
|
-
|
|
342
345
|
def solr_options
|
|
343
346
|
options.fetch(:solr_options, {})
|
|
344
347
|
end
|
data/lib/solr_wrapper/version.rb
CHANGED
data/lib/solr_wrapper.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.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Beer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-02-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rubyzip
|