groonga-client 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/text/news.md +6 -0
- data/lib/groonga/client/test/groonga-server-runner.rb +13 -6
- data/lib/groonga/client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 716963b0471224b408c7282c106abf6963eec5e3
|
4
|
+
data.tar.gz: dda03fa55b5f474b590f81bce1c3fad4761c0b72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d7ba9d303ce1da3aa3229d82d2af43d76ac4e663d5f6b17e2ffc72be7a385da2a715f4ce6423c3d127546e33b84605eb1d1e6f7eeed0b7b9cf9335fa21ae7be
|
7
|
+
data.tar.gz: acd4190d4b4e3f4e2b0bb72e9a69cc76eda467fa55fcd00289796b4a4c8ad5d0918af663acc9ba302666b6d4eb9b1ebad652280516629752fa351fd177f1b3cc
|
data/doc/text/news.md
CHANGED
@@ -26,7 +26,6 @@ module Groonga
|
|
26
26
|
def initialize
|
27
27
|
@pid = nil
|
28
28
|
@using_running_server = false
|
29
|
-
@url = build_url
|
30
29
|
@groonga = find_groonga
|
31
30
|
@tmp_dir = nil
|
32
31
|
end
|
@@ -34,7 +33,7 @@ module Groonga
|
|
34
33
|
def run
|
35
34
|
if groonga_server_running?
|
36
35
|
@using_running_server = true
|
37
|
-
@dump =
|
36
|
+
@dump = open_client do |client|
|
38
37
|
client.dump.body
|
39
38
|
end
|
40
39
|
else
|
@@ -42,7 +41,7 @@ module Groonga
|
|
42
41
|
@tmp_dir = create_tmp_dir
|
43
42
|
db_path = @tmp_dir + "db"
|
44
43
|
@pid = spawn(@groonga,
|
45
|
-
"--port",
|
44
|
+
"--port", url.port.to_s,
|
46
45
|
"--log-path", (@tmp_dir + "groonga.log").to_s,
|
47
46
|
"--query-log-path", (@tmp_dir + "query.log").to_s,
|
48
47
|
"--protocol", "http",
|
@@ -54,13 +53,13 @@ module Groonga
|
|
54
53
|
|
55
54
|
def stop
|
56
55
|
if @using_running_server
|
57
|
-
|
56
|
+
open_client do |client|
|
58
57
|
remove_all(client)
|
59
58
|
restore(client)
|
60
59
|
end
|
61
60
|
else
|
62
61
|
if @pid
|
63
|
-
|
62
|
+
open_client do |client|
|
64
63
|
client.shutdown
|
65
64
|
end
|
66
65
|
wait_groonga_shutdown
|
@@ -75,7 +74,15 @@ module Groonga
|
|
75
74
|
@using_running_server
|
76
75
|
end
|
77
76
|
|
77
|
+
def url
|
78
|
+
@url ||= build_url
|
79
|
+
end
|
80
|
+
|
78
81
|
private
|
82
|
+
def open_client(&block)
|
83
|
+
Client.open(url: url, &block)
|
84
|
+
end
|
85
|
+
|
79
86
|
def build_url
|
80
87
|
default_options = Groonga::Client.default_options
|
81
88
|
url = default_options[:url]
|
@@ -92,7 +99,7 @@ module Groonga
|
|
92
99
|
|
93
100
|
def groonga_server_running?
|
94
101
|
begin
|
95
|
-
TCPSocket.open(
|
102
|
+
TCPSocket.open(url.host, url.port) do
|
96
103
|
end
|
97
104
|
rescue SystemCallError
|
98
105
|
false
|