groonga-command 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +3 -3
- data/doc/text/news.md +7 -0
- data/groonga-command.gemspec +1 -3
- data/lib/groonga/command/version.rb +2 -2
- data/lib/groonga/command.rb +18 -2
- data/test/command/test-column-create.rb +107 -108
- data/test/command/test-column-remove.rb +9 -10
- data/test/command/test-column-rename.rb +9 -10
- data/test/command/test-delete.rb +9 -10
- data/test/command/test-dump.rb +7 -7
- data/test/command/test-get.rb +13 -16
- data/test/command/test-load.rb +17 -10
- data/test/command/test-register.rb +9 -10
- data/test/command/test-select.rb +83 -82
- data/test/command/test-suggest.rb +43 -35
- data/test/command/test-table-create.rb +101 -94
- data/test/command/test-table-remove.rb +9 -10
- data/test/command/test-table-rename.rb +9 -10
- data/test/command/test-truncate.rb +9 -10
- data/test/groonga-command-test-utils.rb +1 -81
- metadata +60 -95
- data/lib/groonga/command/parser.rb +0 -449
- data/test/test-parser.rb +0 -377
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
|
-
# Copyright (C) 2011-
|
3
|
+
# Copyright (C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
|
4
4
|
#
|
5
5
|
# This library is free software; you can redistribute it and/or
|
6
6
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -16,87 +16,7 @@
|
|
16
16
|
# License along with this library; if not, write to the Free Software
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
|
19
|
-
require "cgi"
|
20
|
-
require "stringio"
|
21
|
-
|
22
19
|
require "groonga/command"
|
23
20
|
|
24
21
|
module GroongaCommandTestUtils
|
25
|
-
module CommandParser
|
26
|
-
private
|
27
|
-
def command(name, arguments)
|
28
|
-
Groonga::Command.find(name).new(name, arguments)
|
29
|
-
end
|
30
|
-
|
31
|
-
def parse_http_path(command, arguments, options={})
|
32
|
-
path = "/d/#{command}"
|
33
|
-
case options[:output_type]
|
34
|
-
when false
|
35
|
-
when nil
|
36
|
-
path << ".json"
|
37
|
-
else
|
38
|
-
path << ".#{options[:output_type]}"
|
39
|
-
end
|
40
|
-
|
41
|
-
unless arguments.empty?
|
42
|
-
uri_arguments = arguments.collect do |key, value|
|
43
|
-
[CGI.escape(key.to_s), CGI.escape(value.to_s)].join("=")
|
44
|
-
end
|
45
|
-
path << "?"
|
46
|
-
path << uri_arguments.join("&")
|
47
|
-
end
|
48
|
-
|
49
|
-
Groonga::Command::Parser.parse(path)
|
50
|
-
end
|
51
|
-
|
52
|
-
def parse_command_line(command, arguments, options={})
|
53
|
-
command_line = "#{command}"
|
54
|
-
case options[:output_type]
|
55
|
-
when false
|
56
|
-
when nil
|
57
|
-
command_line << " --output_type json"
|
58
|
-
else
|
59
|
-
command_line << " --output_type #{options[:output_type]}"
|
60
|
-
end
|
61
|
-
|
62
|
-
if arguments.is_a?(Hash)
|
63
|
-
arguments.each do |key, value|
|
64
|
-
escaped_value = escape_command_line_value(value)
|
65
|
-
command_line << " --#{key} #{escaped_value}"
|
66
|
-
end
|
67
|
-
else
|
68
|
-
arguments.each do |argument|
|
69
|
-
command_line << " #{escape_command_line_value(argument)}"
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
Groonga::Command::Parser.parse(command_line)
|
74
|
-
end
|
75
|
-
|
76
|
-
def escape_command_line_value(value)
|
77
|
-
if /"| / =~ value
|
78
|
-
'"' + value.gsub(/"/, '\"') + '"'
|
79
|
-
else
|
80
|
-
value
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
module HTTPCommandParser
|
86
|
-
include CommandParser
|
87
|
-
|
88
|
-
private
|
89
|
-
def parse(command, arguments={}, options={})
|
90
|
-
parse_http_path(command, arguments, options)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
module CommandLineCommandParser
|
95
|
-
include CommandParser
|
96
|
-
|
97
|
-
private
|
98
|
-
def parse(command, arguments={}, options={})
|
99
|
-
parse_command_line(command, arguments, options)
|
100
|
-
end
|
101
|
-
end
|
102
22
|
end
|
metadata
CHANGED
@@ -1,142 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groonga-command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Kouhei Sutou
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-29 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: yajl-ruby
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
13
|
- !ruby/object:Gem::Dependency
|
31
14
|
name: test-unit
|
32
15
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
16
|
requirements:
|
35
|
-
- -
|
17
|
+
- - '>='
|
36
18
|
- !ruby/object:Gem::Version
|
37
19
|
version: '0'
|
38
20
|
type: :development
|
39
21
|
prerelease: false
|
40
22
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
23
|
requirements:
|
43
|
-
- -
|
24
|
+
- - '>='
|
44
25
|
- !ruby/object:Gem::Version
|
45
26
|
version: '0'
|
46
27
|
- !ruby/object:Gem::Dependency
|
47
28
|
name: test-unit-notify
|
48
29
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
30
|
requirements:
|
51
|
-
- -
|
31
|
+
- - '>='
|
52
32
|
- !ruby/object:Gem::Version
|
53
33
|
version: '0'
|
54
34
|
type: :development
|
55
35
|
prerelease: false
|
56
36
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
37
|
requirements:
|
59
|
-
- -
|
38
|
+
- - '>='
|
60
39
|
- !ruby/object:Gem::Version
|
61
40
|
version: '0'
|
62
41
|
- !ruby/object:Gem::Dependency
|
63
42
|
name: rake
|
64
43
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
44
|
requirements:
|
67
|
-
- -
|
45
|
+
- - '>='
|
68
46
|
- !ruby/object:Gem::Version
|
69
47
|
version: '0'
|
70
48
|
type: :development
|
71
49
|
prerelease: false
|
72
50
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
51
|
requirements:
|
75
|
-
- -
|
52
|
+
- - '>='
|
76
53
|
- !ruby/object:Gem::Version
|
77
54
|
version: '0'
|
78
55
|
- !ruby/object:Gem::Dependency
|
79
56
|
name: bundler
|
80
57
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
58
|
requirements:
|
83
|
-
- -
|
59
|
+
- - '>='
|
84
60
|
- !ruby/object:Gem::Version
|
85
61
|
version: '0'
|
86
62
|
type: :development
|
87
63
|
prerelease: false
|
88
64
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
65
|
requirements:
|
91
|
-
- -
|
66
|
+
- - '>='
|
92
67
|
- !ruby/object:Gem::Version
|
93
68
|
version: '0'
|
94
69
|
- !ruby/object:Gem::Dependency
|
95
70
|
name: packnga
|
96
71
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
72
|
requirements:
|
99
|
-
- -
|
73
|
+
- - '>='
|
100
74
|
- !ruby/object:Gem::Version
|
101
75
|
version: '0'
|
102
76
|
type: :development
|
103
77
|
prerelease: false
|
104
78
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
79
|
requirements:
|
107
|
-
- -
|
80
|
+
- - '>='
|
108
81
|
- !ruby/object:Gem::Version
|
109
82
|
version: '0'
|
110
83
|
- !ruby/object:Gem::Dependency
|
111
84
|
name: yard
|
112
85
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
86
|
requirements:
|
115
|
-
- -
|
87
|
+
- - '>='
|
116
88
|
- !ruby/object:Gem::Version
|
117
89
|
version: '0'
|
118
90
|
type: :development
|
119
91
|
prerelease: false
|
120
92
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
93
|
requirements:
|
123
|
-
- -
|
94
|
+
- - '>='
|
124
95
|
- !ruby/object:Gem::Version
|
125
96
|
version: '0'
|
126
97
|
- !ruby/object:Gem::Dependency
|
127
98
|
name: redcarpet
|
128
99
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
100
|
requirements:
|
131
|
-
- -
|
101
|
+
- - '>='
|
132
102
|
- !ruby/object:Gem::Version
|
133
103
|
version: '0'
|
134
104
|
type: :development
|
135
105
|
prerelease: false
|
136
106
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
107
|
requirements:
|
139
|
-
- -
|
108
|
+
- - '>='
|
140
109
|
- !ruby/object:Gem::Version
|
141
110
|
version: '0'
|
142
111
|
description: ''
|
@@ -151,92 +120,88 @@ files:
|
|
151
120
|
- Gemfile
|
152
121
|
- groonga-command.gemspec
|
153
122
|
- .yardopts
|
154
|
-
- lib/groonga/command/
|
155
|
-
- lib/groonga/command/
|
123
|
+
- lib/groonga/command/version.rb
|
124
|
+
- lib/groonga/command/table-create.rb
|
125
|
+
- lib/groonga/command/table-rename.rb
|
126
|
+
- lib/groonga/command/column-rename.rb
|
156
127
|
- lib/groonga/command/table-remove.rb
|
157
|
-
- lib/groonga/command/load.rb
|
158
|
-
- lib/groonga/command/delete.rb
|
159
|
-
- lib/groonga/command/base.rb
|
160
|
-
- lib/groonga/command/suggest.rb
|
161
|
-
- lib/groonga/command/error.rb
|
162
128
|
- lib/groonga/command/register.rb
|
163
|
-
- lib/groonga/command/
|
129
|
+
- lib/groonga/command/suggest.rb
|
164
130
|
- lib/groonga/command/column-remove.rb
|
165
|
-
- lib/groonga/command/
|
131
|
+
- lib/groonga/command/get.rb
|
132
|
+
- lib/groonga/command/error.rb
|
133
|
+
- lib/groonga/command/truncate.rb
|
134
|
+
- lib/groonga/command/load.rb
|
166
135
|
- lib/groonga/command/dump.rb
|
167
|
-
- lib/groonga/command/table-create.rb
|
168
|
-
- lib/groonga/command/format/command.rb
|
169
|
-
- lib/groonga/command/format/uri.rb
|
170
136
|
- lib/groonga/command/column-create.rb
|
171
|
-
- lib/groonga/command/
|
137
|
+
- lib/groonga/command/base.rb
|
172
138
|
- lib/groonga/command/select.rb
|
173
|
-
- lib/groonga/command/
|
139
|
+
- lib/groonga/command/format/command.rb
|
140
|
+
- lib/groonga/command/format/uri.rb
|
141
|
+
- lib/groonga/command/delete.rb
|
174
142
|
- lib/groonga/command.rb
|
175
143
|
- doc/text/news.md
|
176
144
|
- doc/text/lgpl-2.1.txt
|
177
145
|
- test/groonga-command-test-utils.rb
|
178
|
-
- test/run-test.rb
|
179
|
-
- test/command/test-table-create.rb
|
180
|
-
- test/command/test-dump.rb
|
181
|
-
- test/command/test-table-rename.rb
|
182
146
|
- test/command/test-table-remove.rb
|
183
|
-
- test/command/test-
|
184
|
-
- test/command/test-
|
147
|
+
- test/command/test-table-create.rb
|
148
|
+
- test/command/test-column-remove.rb
|
185
149
|
- test/command/test-select.rb
|
186
|
-
- test/command/test-
|
187
|
-
- test/command/test-
|
150
|
+
- test/command/test-table-rename.rb
|
151
|
+
- test/command/test-load.rb
|
152
|
+
- test/command/test-column-rename.rb
|
188
153
|
- test/command/test-register.rb
|
189
|
-
- test/command/test-
|
154
|
+
- test/command/test-column-create.rb
|
190
155
|
- test/command/test-suggest.rb
|
156
|
+
- test/command/test-delete.rb
|
157
|
+
- test/command/test-base.rb
|
158
|
+
- test/command/test-truncate.rb
|
191
159
|
- test/command/format/test-command.rb
|
192
|
-
- test/command/test-
|
193
|
-
- test/command/test-
|
194
|
-
- test/
|
195
|
-
- test/test-parser.rb
|
160
|
+
- test/command/test-get.rb
|
161
|
+
- test/command/test-dump.rb
|
162
|
+
- test/run-test.rb
|
196
163
|
homepage: https://github.com/groonga/groonga-command
|
197
164
|
licenses:
|
198
165
|
- LGPLv2.1+
|
166
|
+
metadata: {}
|
199
167
|
post_install_message:
|
200
168
|
rdoc_options: []
|
201
169
|
require_paths:
|
202
170
|
- lib
|
203
171
|
required_ruby_version: !ruby/object:Gem::Requirement
|
204
|
-
none: false
|
205
172
|
requirements:
|
206
|
-
- -
|
173
|
+
- - '>='
|
207
174
|
- !ruby/object:Gem::Version
|
208
175
|
version: '0'
|
209
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
|
-
none: false
|
211
177
|
requirements:
|
212
|
-
- -
|
178
|
+
- - '>='
|
213
179
|
- !ruby/object:Gem::Version
|
214
180
|
version: '0'
|
215
181
|
requirements: []
|
216
182
|
rubyforge_project:
|
217
|
-
rubygems_version:
|
183
|
+
rubygems_version: 2.0.7
|
218
184
|
signing_key:
|
219
|
-
specification_version:
|
220
|
-
summary: Groonga-command is a library
|
221
|
-
command
|
185
|
+
specification_version: 4
|
186
|
+
summary: Groonga-command is a library that represents [groonga](http://groonga.org/)'s
|
187
|
+
command. You can write a program that handle groonga's command by using groonga-command.
|
222
188
|
test_files:
|
223
189
|
- test/groonga-command-test-utils.rb
|
224
|
-
- test/run-test.rb
|
225
|
-
- test/command/test-table-create.rb
|
226
|
-
- test/command/test-dump.rb
|
227
|
-
- test/command/test-table-rename.rb
|
228
190
|
- test/command/test-table-remove.rb
|
229
|
-
- test/command/test-
|
230
|
-
- test/command/test-
|
191
|
+
- test/command/test-table-create.rb
|
192
|
+
- test/command/test-column-remove.rb
|
231
193
|
- test/command/test-select.rb
|
232
|
-
- test/command/test-
|
233
|
-
- test/command/test-
|
194
|
+
- test/command/test-table-rename.rb
|
195
|
+
- test/command/test-load.rb
|
196
|
+
- test/command/test-column-rename.rb
|
234
197
|
- test/command/test-register.rb
|
235
|
-
- test/command/test-
|
198
|
+
- test/command/test-column-create.rb
|
236
199
|
- test/command/test-suggest.rb
|
200
|
+
- test/command/test-delete.rb
|
201
|
+
- test/command/test-base.rb
|
202
|
+
- test/command/test-truncate.rb
|
237
203
|
- test/command/format/test-command.rb
|
238
|
-
- test/command/test-
|
239
|
-
- test/command/test-
|
240
|
-
- test/
|
241
|
-
- test/test-parser.rb
|
204
|
+
- test/command/test-get.rb
|
205
|
+
- test/command/test-dump.rb
|
206
|
+
- test/run-test.rb
|
242
207
|
has_rdoc:
|