groonga-command 1.1.7 → 1.1.8
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 +15 -0
- data/lib/groonga/command/base.rb +39 -8
- data/lib/groonga/command/shutdown.rb +43 -0
- data/lib/groonga/command/table-remove.rb +16 -3
- data/lib/groonga/command/version.rb +1 -1
- data/lib/groonga/command.rb +1 -0
- data/test/command/test-shutdown.rb +46 -0
- data/test/command/test-table-remove.rb +29 -4
- metadata +40 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0c9670224dc3568111c60739250563fe465a10b
|
4
|
+
data.tar.gz: 7897c976034a57a216e8a9282093f491f10a7583
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae6987f30293dbdd548e8757fd18ce1e1156105acbcad9fc35930a0ea6d8201a3c94813880c90e683d655aeb3ab39f7de3d1150d9ee2808eb7755072c9966ad2
|
7
|
+
data.tar.gz: 1eeaf1457cdf569d1e02c54afca500465de66f880785b4822d054323c19f501565cf61c6766240502f5831f9f782180e171f912821ff1cb3f3779aa12ca7509c
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 1.1.8: 2016-03-21
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* {Groonga::Command::Shutdown}: Added.
|
8
|
+
* {Groonga::Command::TableRemove#name}: Added.
|
9
|
+
* {Groonga::Command::TableRemove#dependent?}: Added.
|
10
|
+
* {Groonga::Command::Base#request_id}: Added.
|
11
|
+
* {Groonga::Command.all}: Added.
|
12
|
+
* {Groonga::Command.find}: Supported `Symbol` as command name.
|
13
|
+
* {Groonga::Command#command_name}: Added. Because
|
14
|
+
{Groonga::Command#name} may be overwritten by subclasses. For
|
15
|
+
example, {Groonga::TableRemove#name} overwrites it.
|
16
|
+
* {Groonga::Command#name}: Made deprecated.
|
17
|
+
|
3
18
|
## 1.1.7: 2016-03-07
|
4
19
|
|
5
20
|
### Improvements
|
data/lib/groonga/command/base.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# Copyright (C) 2012-2014 Kouhei Sutou <kou@clear-code.com>
|
1
|
+
# Copyright (C) 2012-2016 Kouhei Sutou <kou@clear-code.com>
|
4
2
|
#
|
5
3
|
# This library is free software; you can redistribute it and/or
|
6
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -23,12 +21,26 @@ module Groonga
|
|
23
21
|
module Command
|
24
22
|
class << self
|
25
23
|
@@registered_commands = {}
|
24
|
+
def all
|
25
|
+
@@registered_commands
|
26
|
+
end
|
27
|
+
|
26
28
|
def register(name, klass)
|
27
|
-
@@registered_commands[name] = klass
|
29
|
+
@@registered_commands[normalize_name(name)] = klass
|
28
30
|
end
|
29
31
|
|
30
32
|
def find(name)
|
31
|
-
@@registered_commands[name] || Base
|
33
|
+
@@registered_commands[normalize_name(name)] || Base
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
def normalize_name(name)
|
38
|
+
case name
|
39
|
+
when String
|
40
|
+
name.to_sym
|
41
|
+
else
|
42
|
+
name
|
43
|
+
end
|
32
44
|
end
|
33
45
|
end
|
34
46
|
|
@@ -39,16 +51,28 @@ module Groonga
|
|
39
51
|
end
|
40
52
|
end
|
41
53
|
|
42
|
-
attr_reader :
|
54
|
+
attr_reader :command_name, :arguments
|
43
55
|
attr_accessor :original_format, :original_source, :path_prefix
|
44
|
-
def initialize(
|
45
|
-
@
|
56
|
+
def initialize(command_name, pair_arguments, ordered_arguments=[])
|
57
|
+
@command_name = command_name
|
46
58
|
@arguments = construct_arguments(pair_arguments, ordered_arguments)
|
47
59
|
@original_format = nil
|
48
60
|
@original_source = nil
|
49
61
|
@path_prefix = "/d/"
|
50
62
|
end
|
51
63
|
|
64
|
+
# @deprecated since 1.1.8. Use {#command_name} instead.
|
65
|
+
def name
|
66
|
+
command_name
|
67
|
+
end
|
68
|
+
|
69
|
+
# @return [String] The command name.
|
70
|
+
#
|
71
|
+
# @since 1.1.8
|
72
|
+
def command_name
|
73
|
+
@command_name
|
74
|
+
end
|
75
|
+
|
52
76
|
def [](name)
|
53
77
|
@arguments[normalize_name(name)]
|
54
78
|
end
|
@@ -80,6 +104,13 @@ module Groonga
|
|
80
104
|
(self[:output_type] || :json).to_sym
|
81
105
|
end
|
82
106
|
|
107
|
+
# @return [String, nil] `request_id` parameter value.
|
108
|
+
#
|
109
|
+
# @since 1.1.8
|
110
|
+
def request_id
|
111
|
+
self[:request_id]
|
112
|
+
end
|
113
|
+
|
83
114
|
def to_uri_format
|
84
115
|
Format::URI.new(@path_prefix, @name, normalized_arguments).path
|
85
116
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
require "groonga/command/base"
|
18
|
+
|
19
|
+
module Groonga
|
20
|
+
module Command
|
21
|
+
# A command class that represents `shutdown` command.
|
22
|
+
#
|
23
|
+
# @since 1.1.8
|
24
|
+
class Shutdown < Base
|
25
|
+
Command.register("shutdown", self)
|
26
|
+
|
27
|
+
class << self
|
28
|
+
def parameter_names
|
29
|
+
[
|
30
|
+
:mode,
|
31
|
+
]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [String] `mode` parameter value.
|
36
|
+
#
|
37
|
+
# @since 1.1.8
|
38
|
+
def mode
|
39
|
+
self[:mode]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
|
1
|
+
# Copyright (C) 2012-2016 Kouhei Sutou <kou@clear-code.com>
|
4
2
|
#
|
5
3
|
# This library is free software; you can redistribute it and/or
|
6
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -27,9 +25,24 @@ module Groonga
|
|
27
25
|
def parameter_names
|
28
26
|
[
|
29
27
|
:name,
|
28
|
+
:dependent,
|
30
29
|
]
|
31
30
|
end
|
32
31
|
end
|
32
|
+
|
33
|
+
# @return [String] `name` parameter value.
|
34
|
+
#
|
35
|
+
# @since 1.1.8
|
36
|
+
def name
|
37
|
+
self[:name]
|
38
|
+
end
|
39
|
+
|
40
|
+
# @return [Boolean] `dependent` parameter value.
|
41
|
+
#
|
42
|
+
# @since 1.1.8
|
43
|
+
def dependent?
|
44
|
+
self[:dependent] != "no"
|
45
|
+
end
|
33
46
|
end
|
34
47
|
end
|
35
48
|
end
|
data/lib/groonga/command.rb
CHANGED
@@ -53,6 +53,7 @@ require "groonga/command/request-cancel"
|
|
53
53
|
require "groonga/command/ruby-eval"
|
54
54
|
require "groonga/command/ruby-load"
|
55
55
|
require "groonga/command/select"
|
56
|
+
require "groonga/command/shutdown"
|
56
57
|
require "groonga/command/status"
|
57
58
|
require "groonga/command/suggest"
|
58
59
|
require "groonga/command/table-create"
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class ShutdownCommandTest < Test::Unit::TestCase
|
18
|
+
private
|
19
|
+
def shutdown_command(pair_arguments={}, ordered_arguments=[])
|
20
|
+
Groonga::Command::Shutdown.new("shutdown",
|
21
|
+
pair_arguments,
|
22
|
+
ordered_arguments)
|
23
|
+
end
|
24
|
+
|
25
|
+
class ConstructorTest < self
|
26
|
+
def test_ordered_arguments
|
27
|
+
mode = "immediate"
|
28
|
+
|
29
|
+
command = shutdown_command({},
|
30
|
+
[
|
31
|
+
mode,
|
32
|
+
])
|
33
|
+
assert_equal({
|
34
|
+
:mode => mode,
|
35
|
+
},
|
36
|
+
command.arguments)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class ModeTest < self
|
41
|
+
def test_reader
|
42
|
+
command = shutdown_command(:mode => "immediate")
|
43
|
+
assert_equal("immediate", command.mode)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
|
1
|
+
# Copyright (C) 2012-2016 Kouhei Sutou <kou@clear-code.com>
|
4
2
|
#
|
5
3
|
# This library is free software; you can redistribute it and/or
|
6
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -27,12 +25,39 @@ class TableRemoveCommandTest < Test::Unit::TestCase
|
|
27
25
|
class ConstructorTest < self
|
28
26
|
def test_ordered_arguments
|
29
27
|
name = "Users"
|
28
|
+
dependent = "yes"
|
30
29
|
|
31
|
-
command = table_remove_command({}, [name])
|
30
|
+
command = table_remove_command({}, [name, dependent])
|
32
31
|
assert_equal({
|
33
32
|
:name => name,
|
33
|
+
:dependent => dependent,
|
34
34
|
},
|
35
35
|
command.arguments)
|
36
36
|
end
|
37
37
|
end
|
38
|
+
|
39
|
+
class NameTest < self
|
40
|
+
def test_reader
|
41
|
+
command = table_remove_command(:name => "Users")
|
42
|
+
assert_equal("Users", command.name)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class DependentTest < self
|
47
|
+
class ReaderTest < self
|
48
|
+
def test_default
|
49
|
+
command = table_remove_command
|
50
|
+
assert do
|
51
|
+
command.dependent?
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_no
|
56
|
+
command = table_remove_command(:dependent => "no")
|
57
|
+
assert do
|
58
|
+
not command.dependent?
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
38
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groonga-command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -174,6 +174,7 @@ files:
|
|
174
174
|
- lib/groonga/command/ruby-eval.rb
|
175
175
|
- lib/groonga/command/ruby-load.rb
|
176
176
|
- lib/groonga/command/select.rb
|
177
|
+
- lib/groonga/command/shutdown.rb
|
177
178
|
- lib/groonga/command/status.rb
|
178
179
|
- lib/groonga/command/suggest.rb
|
179
180
|
- lib/groonga/command/table-create.rb
|
@@ -220,6 +221,7 @@ files:
|
|
220
221
|
- test/command/test-ruby-eval.rb
|
221
222
|
- test/command/test-ruby-load.rb
|
222
223
|
- test/command/test-select.rb
|
224
|
+
- test/command/test-shutdown.rb
|
223
225
|
- test/command/test-status.rb
|
224
226
|
- test/command/test-suggest.rb
|
225
227
|
- test/command/test-table-create.rb
|
@@ -258,51 +260,52 @@ specification_version: 4
|
|
258
260
|
summary: Groonga-command is a library that represents [Groonga](http://groonga.org/)'s
|
259
261
|
command. You can write a program that handle Groonga's command by using groonga-command.
|
260
262
|
test_files:
|
261
|
-
- test/
|
262
|
-
- test/command/test-
|
263
|
-
- test/command/test-
|
264
|
-
- test/command/test-
|
265
|
-
- test/command/test-
|
266
|
-
- test/command/test-
|
267
|
-
- test/command/test-object-inspect.rb
|
268
|
-
- test/command/test-tokenize.rb
|
269
|
-
- test/command/test-table-list.rb
|
270
|
-
- test/command/test-column-copy.rb
|
263
|
+
- test/groonga-command-test-utils.rb
|
264
|
+
- test/command/test-config-delete.rb
|
265
|
+
- test/command/test-object-remove.rb
|
266
|
+
- test/command/test-table-tokenize.rb
|
267
|
+
- test/command/test-reindex.rb
|
268
|
+
- test/command/test-plugin-unregister.rb
|
271
269
|
- test/command/test-io-flush.rb
|
270
|
+
- test/command/test-base.rb
|
271
|
+
- test/command/test-logical-count.rb
|
272
|
+
- test/command/test-table-rename.rb
|
273
|
+
- test/command/test-column-rename.rb
|
272
274
|
- test/command/test-dump.rb
|
273
|
-
- test/command/test-
|
274
|
-
- test/command/test-
|
275
|
-
- test/command/test-
|
276
|
-
- test/command/test-
|
275
|
+
- test/command/test-normalize.rb
|
276
|
+
- test/command/test-config-get.rb
|
277
|
+
- test/command/test-register.rb
|
278
|
+
- test/command/test-shutdown.rb
|
279
|
+
- test/command/test-delete.rb
|
280
|
+
- test/command/test-column-copy.rb
|
281
|
+
- test/command/test-tokenize.rb
|
282
|
+
- test/command/test-log-put.rb
|
277
283
|
- test/command/test-load.rb
|
278
|
-
- test/command/test-config-delete.rb
|
279
284
|
- test/command/test-column-list.rb
|
280
|
-
- test/command/test-plugin-unregister.rb
|
281
|
-
- test/command/format/test-command.rb
|
282
285
|
- test/command/test-plugin-register.rb
|
283
|
-
- test/command/test-
|
286
|
+
- test/command/test-request-cancel.rb
|
287
|
+
- test/command/test-column-create.rb
|
288
|
+
- test/command/test-config-set.rb
|
289
|
+
- test/command/test-logical-range-filter.rb
|
290
|
+
- test/command/test-object-inspect.rb
|
291
|
+
- test/command/format/test-command.rb
|
292
|
+
- test/command/test-logical-select.rb
|
293
|
+
- test/command/test-get.rb
|
294
|
+
- test/command/test-thread-limit.rb
|
295
|
+
- test/command/test-table-list.rb
|
296
|
+
- test/command/test-object-exist.rb
|
297
|
+
- test/command/test-log-level.rb
|
298
|
+
- test/command/test-range-filter.rb
|
284
299
|
- test/command/test-status.rb
|
285
|
-
- test/command/test-
|
300
|
+
- test/command/test-logical-shard-list.rb
|
301
|
+
- test/command/test-suggest.rb
|
286
302
|
- test/command/test-select.rb
|
287
303
|
- test/command/test-column-remove.rb
|
288
|
-
- test/command/test-table-rename.rb
|
289
304
|
- test/command/test-ruby-eval.rb
|
290
|
-
- test/command/test-range-filter.rb
|
291
|
-
- test/command/test-column-rename.rb
|
292
|
-
- test/command/test-request-cancel.rb
|
293
|
-
- test/command/test-log-put.rb
|
294
|
-
- test/command/test-get.rb
|
295
305
|
- test/command/test-table-create.rb
|
296
|
-
- test/command/test-logical-select.rb
|
297
|
-
- test/command/test-config-set.rb
|
298
|
-
- test/command/test-base.rb
|
299
|
-
- test/command/test-normalize.rb
|
300
|
-
- test/command/test-logical-count.rb
|
301
|
-
- test/command/test-logical-shard-list.rb
|
302
|
-
- test/command/test-column-create.rb
|
303
|
-
- test/command/test-delete.rb
|
304
|
-
- test/command/test-truncate.rb
|
305
306
|
- test/command/test-table-remove.rb
|
307
|
+
- test/command/test-ruby-load.rb
|
308
|
+
- test/command/test-truncate.rb
|
306
309
|
- test/command/test-logical-table-remove.rb
|
307
|
-
- test/
|
310
|
+
- test/run-test.rb
|
308
311
|
has_rdoc:
|