groonga-client-cli 1.0.1 → 1.0.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/doc/text/news.md +8 -0
- data/lib/groonga-client-cli/groonga-client.rb +21 -1
- data/lib/groonga-client-cli/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1db474cd35e6959f4ed20f3fc7e2a4c507ce6d84
|
4
|
+
data.tar.gz: 547eae2da424c2a1ee1cb6aa33609cf461006c8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaa9f3cbf276885a41a32ddc7a5f84b5162d21560332d6d9af25c7addaaae45f5a0c0d3f57136720762689416d124e62950ebf529cd57ad80fa48aa5e1af5023
|
7
|
+
data.tar.gz: 2a4d4278ccdbea02affc3b6f1b5fc8284b0b5a6222f441784cf5406d9b4add62c74044959ffa26c3e598f9e33069744493717d98f629c27457627feac35acd00
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# NEWS
|
2
2
|
|
3
|
+
## 1.0.2 - 2016-03-16
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* Accepted file that doesn't have newline at the end.
|
8
|
+
* Added `--generate-request-id` option that sets automatically
|
9
|
+
generated request ID to each command.
|
10
|
+
|
3
11
|
## 1.0.1 - 2015-06-10
|
4
12
|
|
5
13
|
### Improvements
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
|
1
|
+
# Copyright (C) 2015-2016 Kouhei Sutou <kou@clear-code.com>
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -17,6 +17,7 @@
|
|
17
17
|
require "ostruct"
|
18
18
|
require "optparse"
|
19
19
|
require "json"
|
20
|
+
require "securerandom"
|
20
21
|
|
21
22
|
require "groonga/command/parser"
|
22
23
|
|
@@ -35,6 +36,7 @@ module GroongaClientCLI
|
|
35
36
|
|
36
37
|
@runner_options = {
|
37
38
|
:split_load_chunk_size => 10000,
|
39
|
+
:generate_request_id => false,
|
38
40
|
}
|
39
41
|
end
|
40
42
|
|
@@ -55,12 +57,18 @@ module GroongaClientCLI
|
|
55
57
|
else
|
56
58
|
command_file_paths.each do |command_file_path|
|
57
59
|
File.open(command_file_path) do |command_file|
|
60
|
+
last_line = nil
|
58
61
|
command_file.each_line do |line|
|
62
|
+
last_line = line
|
59
63
|
runner << line
|
60
64
|
end
|
65
|
+
if last_line and !last_line.end_with?("\n")
|
66
|
+
runner << "\n"
|
67
|
+
end
|
61
68
|
end
|
62
69
|
end
|
63
70
|
end
|
71
|
+
runner.finish
|
64
72
|
|
65
73
|
true
|
66
74
|
end
|
@@ -110,6 +118,12 @@ module GroongaClientCLI
|
|
110
118
|
@runner_options[:split_load_chunk_size] = size
|
111
119
|
end
|
112
120
|
|
121
|
+
parser.on("--[no-]generate-request-id",
|
122
|
+
"Add auto generated request ID to all commands.",
|
123
|
+
"(#{@runner_options[:generate_request_id]})") do |boolean|
|
124
|
+
@runner_options[:generate_request_id] = boolean
|
125
|
+
end
|
126
|
+
|
113
127
|
command_file_paths = parser.parse(argv)
|
114
128
|
|
115
129
|
@port ||= default_port(@protocol)
|
@@ -130,6 +144,7 @@ module GroongaClientCLI
|
|
130
144
|
def initialize(client, options={})
|
131
145
|
@client = client
|
132
146
|
@split_load_chunk_size = options[:split_load_chunk_size] || 10000
|
147
|
+
@generate_request_id = options[:generate_request_id]
|
133
148
|
@load_values = []
|
134
149
|
@parser = create_command_parser
|
135
150
|
end
|
@@ -138,6 +153,10 @@ module GroongaClientCLI
|
|
138
153
|
@parser << line
|
139
154
|
end
|
140
155
|
|
156
|
+
def finish
|
157
|
+
@parser.finish
|
158
|
+
end
|
159
|
+
|
141
160
|
private
|
142
161
|
def create_command_parser
|
143
162
|
parser = Groonga::Command::Parser.new
|
@@ -181,6 +200,7 @@ module GroongaClientCLI
|
|
181
200
|
end
|
182
201
|
|
183
202
|
def run_command(command)
|
203
|
+
command[:request_id] ||= SecureRandom.uuid if @generate_request_id
|
184
204
|
response = @client.execute(command)
|
185
205
|
case command.output_type
|
186
206
|
when :json
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groonga-client-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: groonga-client
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.
|
136
|
+
rubygems_version: 2.5.1
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: Groonga-client-cli provides command line Groonga clients.
|