groonga-command 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/doc/text/news.md +17 -10
  3. data/lib/groonga/command/base.rb +37 -1
  4. data/lib/groonga/command/column-copy.rb +7 -3
  5. data/lib/groonga/command/column-create.rb +11 -7
  6. data/lib/groonga/command/column-list.rb +6 -2
  7. data/lib/groonga/command/column-remove.rb +6 -2
  8. data/lib/groonga/command/column-rename.rb +6 -2
  9. data/lib/groonga/command/config-delete.rb +6 -2
  10. data/lib/groonga/command/config-get.rb +6 -2
  11. data/lib/groonga/command/config-set.rb +6 -2
  12. data/lib/groonga/command/delete.rb +6 -2
  13. data/lib/groonga/command/dump.rb +6 -2
  14. data/lib/groonga/command/get.rb +6 -2
  15. data/lib/groonga/command/io-flush.rb +6 -2
  16. data/lib/groonga/command/load.rb +6 -2
  17. data/lib/groonga/command/log-level.rb +6 -2
  18. data/lib/groonga/command/log-put.rb +6 -2
  19. data/lib/groonga/command/logical-count.rb +6 -2
  20. data/lib/groonga/command/logical-range-filter.rb +6 -2
  21. data/lib/groonga/command/logical-select.rb +6 -2
  22. data/lib/groonga/command/logical-shard-list.rb +6 -2
  23. data/lib/groonga/command/logical-table-remove.rb +6 -2
  24. data/lib/groonga/command/normalize.rb +6 -2
  25. data/lib/groonga/command/object-exist.rb +6 -2
  26. data/lib/groonga/command/object-inspect.rb +6 -2
  27. data/lib/groonga/command/object-remove.rb +6 -2
  28. data/lib/groonga/command/plugin-register.rb +6 -2
  29. data/lib/groonga/command/plugin-unregister.rb +6 -2
  30. data/lib/groonga/command/query-expand.rb +6 -2
  31. data/lib/groonga/command/range-filter.rb +6 -2
  32. data/lib/groonga/command/register.rb +6 -2
  33. data/lib/groonga/command/reindex.rb +6 -2
  34. data/lib/groonga/command/request-cancel.rb +6 -2
  35. data/lib/groonga/command/ruby-eval.rb +6 -2
  36. data/lib/groonga/command/ruby-load.rb +6 -2
  37. data/lib/groonga/command/schema.rb +7 -1
  38. data/lib/groonga/command/select.rb +6 -2
  39. data/lib/groonga/command/shutdown.rb +6 -2
  40. data/lib/groonga/command/status.rb +7 -1
  41. data/lib/groonga/command/suggest.rb +6 -2
  42. data/lib/groonga/command/table-create.rb +6 -2
  43. data/lib/groonga/command/table-list.rb +6 -2
  44. data/lib/groonga/command/table-remove.rb +6 -2
  45. data/lib/groonga/command/table-rename.rb +6 -2
  46. data/lib/groonga/command/table-tokenize.rb +6 -2
  47. data/lib/groonga/command/thread-limit.rb +6 -2
  48. data/lib/groonga/command/tokenize.rb +6 -2
  49. data/lib/groonga/command/truncate.rb +6 -2
  50. data/lib/groonga/command/version.rb +1 -1
  51. data/test/command/test-column-copy.rb +1 -2
  52. data/test/command/test-column-create.rb +1 -2
  53. data/test/command/test-column-list.rb +1 -2
  54. data/test/command/test-column-remove.rb +1 -2
  55. data/test/command/test-column-rename.rb +1 -2
  56. data/test/command/test-config-delete.rb +1 -2
  57. data/test/command/test-config-get.rb +2 -3
  58. data/test/command/test-config-set.rb +2 -3
  59. data/test/command/test-delete.rb +1 -2
  60. data/test/command/test-dump.rb +1 -1
  61. data/test/command/test-get.rb +1 -1
  62. data/test/command/test-io-flush.rb +1 -2
  63. data/test/command/test-load.rb +1 -2
  64. data/test/command/test-log-level.rb +1 -2
  65. data/test/command/test-log-put.rb +1 -2
  66. data/test/command/test-logical-count.rb +1 -2
  67. data/test/command/test-logical-range-filter.rb +1 -2
  68. data/test/command/test-logical-select.rb +1 -2
  69. data/test/command/test-logical-shard-list.rb +1 -2
  70. data/test/command/test-logical-table-remove.rb +1 -2
  71. data/test/command/test-normalize.rb +1 -2
  72. data/test/command/test-object-exist.rb +1 -2
  73. data/test/command/test-object-inspect.rb +1 -2
  74. data/test/command/test-object-remove.rb +1 -2
  75. data/test/command/test-plugin-register.rb +2 -3
  76. data/test/command/test-plugin-unregister.rb +1 -2
  77. data/test/command/test-query-expand.rb +1 -2
  78. data/test/command/test-range-filter.rb +1 -2
  79. data/test/command/test-register.rb +1 -2
  80. data/test/command/test-reindex.rb +1 -2
  81. data/test/command/test-request-cancel.rb +1 -2
  82. data/test/command/test-ruby-eval.rb +1 -2
  83. data/test/command/test-ruby-load.rb +1 -2
  84. data/test/command/test-schema.rb +1 -1
  85. data/test/command/test-select.rb +1 -1
  86. data/test/command/test-shutdown.rb +1 -2
  87. data/test/command/test-status.rb +1 -1
  88. data/test/command/test-suggest.rb +1 -2
  89. data/test/command/test-table-create.rb +1 -2
  90. data/test/command/test-table-list.rb +1 -2
  91. data/test/command/test-table-remove.rb +1 -2
  92. data/test/command/test-table-rename.rb +1 -2
  93. data/test/command/test-table-tokenize.rb +1 -2
  94. data/test/command/test-thread-limit.rb +1 -2
  95. data/test/command/test-tokenize.rb +1 -2
  96. data/test/command/test-truncate.rb +1 -2
  97. metadata +41 -41
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24ff725dc6b799512ea4f3ebaacc6b0859eae5f4
4
- data.tar.gz: fce35fa7dc56db6ef089898c3bd6fd058650ebb7
3
+ metadata.gz: 30abb0016a8e9632deb60d737274606a85a823cb
4
+ data.tar.gz: 62c78851cf80c3faa7017747d9952329431cc590
5
5
  SHA512:
6
- metadata.gz: a65cf97dcf85a45caa02a5675ad6545a11f03d8663f1937c22515f6a097d3fc06168a488593a58a4f3eba1a92be202e3a222e0ad6e4d864fa04e504b3d46e980
7
- data.tar.gz: 88ccfbc5e165220fe628dc48456a1063e7295f235a967cf5466f080a9b2062abeb7870fdd20cd15e3792dd6dda4e904eff0d0893206e1d504a213830c122d142
6
+ metadata.gz: ed570003c29725944a8cc5db8d1272cbbd292c79f59fa86b1d91117d6ab2e456362812334f5307196eb48d684cab83e2b50a88ed9e15700010abe0ba0d67d163
7
+ data.tar.gz: 64603b78e8e3ed43032a54baec45aa6e4d3725dd17166d99833b31676d09048f5f864f63ad732772bf4243807c6c02b64cc4d6227be7afbcb594fea41317df92
data/doc/text/news.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # News
2
2
 
3
+ ## 1.2.3: 2016-08-08
4
+
5
+ ### Improvements
6
+
7
+ * {Groonga::Command::Base#initialize}: Made command name optional.
8
+
3
9
  ## 1.2.2: 2016-08-05
4
10
 
5
11
  ### Improvements
@@ -36,32 +42,33 @@
36
42
  * {Groonga::Command::Base#request_id}: Added.
37
43
  * {Groonga::Command.all}: Added.
38
44
  * {Groonga::Command.find}: Supported `Symbol` as command name.
39
- * {Groonga::Command#command_name}: Added. Because
40
- {Groonga::Command#name} may be overwritten by subclasses. For
41
- example, {Groonga::TableRemove#name} overwrites it.
42
- * {Groonga::Command#name}: Made deprecated.
45
+ * {Groonga::Command::Base#command_name}: Added. Because
46
+ {Groonga::Command::Base#name} may be overwritten by subclasses. For
47
+ example, {Groonga::Command::TableRemove#name} overwrites it.
48
+ * {Groonga::Command::Base#name}: Made deprecated.
43
49
 
44
50
  ## 1.1.7: 2016-03-07
45
51
 
46
52
  ### Improvements
47
53
 
48
- * Renamed to {Groonga::Command::ObjectInspect} from {Groonga::Command::Inspect}.
54
+ * Renamed to {Groonga::Command::ObjectInspect} from
55
+ `Groonga::Command::Inspect`.
49
56
  * {Groonga::Command::ObjectRemove}: Added.
50
57
 
51
58
  ## 1.1.6: 2016-02-03
52
59
 
53
60
  ### Improvements
54
61
 
55
- * {Groonga::Command::Inspect}: Added.
62
+ * `Groonga::Command::Inspect`: Added.
56
63
 
57
64
  ## 1.1.5: 2016-01-19
58
65
 
59
66
  ### Improvements
60
67
 
61
- * Renamed to {Groonga::Command::ConfigGet} from {Groonga::Command::ConfGet}.
62
- * Renamed to {Groonga::Command::ConfigSet} from {Groonga::Command::ConfSet}.
68
+ * Renamed to {Groonga::Command::ConfigGet} from `Groonga::Command::ConfGet`.
69
+ * Renamed to {Groonga::Command::ConfigSet} from `Groonga::Command::ConfSet`.
63
70
  * Renamed to {Groonga::Command::ConfigDelete} from
64
- {Groonga::Command::ConfDelete}.
71
+ `Groonga::Command::ConfDelete`.
65
72
 
66
73
  ## 1.1.4: 2016-01-13
67
74
 
@@ -166,7 +173,7 @@
166
173
 
167
174
  ### Improvements
168
175
 
169
- * Extracted {Groonga::Command::Parser} as groonga-command-parser gem.
176
+ * Extracted `Groonga::Command::Parser` as groonga-command-parser gem.
170
177
  Now, groonga-command gem doesn't depend on any extension libraries.
171
178
 
172
179
  ## 1.0.4: 2013-09-18
@@ -57,7 +57,43 @@ module Groonga
57
57
  attr_reader :command_name
58
58
  attr_reader :arguments
59
59
  attr_accessor :original_format, :original_source, :path_prefix
60
- def initialize(command_name, pair_arguments, ordered_arguments=[])
60
+
61
+ # @overload initialize(pair_arguments, ordered_arguments={})
62
+ # Initializes a new known command. The command class must implement
63
+ # {.command_name} method.
64
+ #
65
+ # @param pair_arguments [::Hash<String, String>] The list of
66
+ # pair arguments.
67
+ #
68
+ # @param ordered_arguments [::Array<String>] The list of
69
+ # ordered arguments.
70
+ #
71
+ # @since 1.2.3
72
+ #
73
+ # @overload initialize(command_name, pair_arguments, ordered_arguments={})
74
+ # Initializes a new unknown command.
75
+ #
76
+ # @param command_name [String] The command name.
77
+ #
78
+ # @param pair_arguments [::Hash<String, String>] The list of
79
+ # pair arguments.
80
+ #
81
+ # @param ordered_arguments [::Array<String>] The list of
82
+ # ordered arguments.
83
+ def initialize(arg1=nil, arg2=nil, arg3=nil)
84
+ case arg1
85
+ when String
86
+ command_name = arg1
87
+ pair_arguments = arg2
88
+ ordered_arguments = arg3
89
+ else
90
+ command_name = self.class.command_name
91
+ pair_arguments = arg1
92
+ ordered_arguments = arg2
93
+ end
94
+ pair_arguments ||= {}
95
+ ordered_arguments ||= []
96
+
61
97
  @command_name = command_name
62
98
  @arguments = construct_arguments(pair_arguments, ordered_arguments)
63
99
  @original_format = nil
@@ -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
@@ -22,9 +22,11 @@ module Groonga
22
22
  #
23
23
  # @since 1.1.3
24
24
  class ColumnCopy < Base
25
- Command.register("column_copy", self)
26
-
27
25
  class << self
26
+ def command_name
27
+ "column_copy"
28
+ end
29
+
28
30
  def parameter_names
29
31
  [
30
32
  :from_table,
@@ -35,6 +37,8 @@ module Groonga
35
37
  end
36
38
  end
37
39
 
40
+ Command.register(command_name, self)
41
+
38
42
  # @return [String] `from_table` parameter value.
39
43
  #
40
44
  # @since 1.1.3
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
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
@@ -21,9 +19,11 @@ require "groonga/command/base"
21
19
  module Groonga
22
20
  module Command
23
21
  class ColumnCreate < Base
24
- Command.register("column_create", self)
25
-
26
22
  class << self
23
+ def command_name
24
+ "column_create"
25
+ end
26
+
27
27
  def parameter_names
28
28
  [
29
29
  :table,
@@ -35,6 +35,8 @@ module Groonga
35
35
  end
36
36
  end
37
37
 
38
+ Command.register(command_name, self)
39
+
38
40
  # @return [String] table name.
39
41
  # @since 1.0.7
40
42
  def table
@@ -93,8 +95,10 @@ module Groonga
93
95
  flags.include?("WITH_POSITION")
94
96
  end
95
97
 
96
- # @return [::Array<String>] an array of index sources. If {#source} is
97
- # empty or nil, this method returns an empty array.
98
+ # @return [::Array<String>] an array of index sources. If
99
+ # `source` parameter value is empty or nil, this method
100
+ # returns an empty array.
101
+ #
98
102
  # @since 1.0.7
99
103
  def sources
100
104
  @sources ||= (self[:source] || "").split(/\s*,\s*/)
@@ -24,9 +24,11 @@ module Groonga
24
24
  #
25
25
  # @since 1.0.6
26
26
  class ColumnList < Base
27
- Command.register("column_list", self)
28
-
29
27
  class << self
28
+ def command_name
29
+ "column_list"
30
+ end
31
+
30
32
  def parameter_names
31
33
  [
32
34
  :table,
@@ -34,6 +36,8 @@ module Groonga
34
36
  end
35
37
  end
36
38
 
39
+ Command.register(command_name, self)
40
+
37
41
  # @return [String] `table` parameter value.
38
42
  # @since 1.0.6
39
43
  def table
@@ -21,9 +21,11 @@ require "groonga/command/base"
21
21
  module Groonga
22
22
  module Command
23
23
  class ColumnRemove < Base
24
- Command.register("column_remove", self)
25
-
26
24
  class << self
25
+ def command_name
26
+ "column_remove"
27
+ end
28
+
27
29
  def parameter_names
28
30
  [
29
31
  :table,
@@ -31,6 +33,8 @@ module Groonga
31
33
  ]
32
34
  end
33
35
  end
36
+
37
+ Command.register(command_name, self)
34
38
  end
35
39
  end
36
40
  end
@@ -21,9 +21,11 @@ require "groonga/command/base"
21
21
  module Groonga
22
22
  module Command
23
23
  class ColumnRename < Base
24
- Command.register("column_rename", self)
25
-
26
24
  class << self
25
+ def command_name
26
+ "column_rename"
27
+ end
28
+
27
29
  def parameter_names
28
30
  [
29
31
  :table,
@@ -32,6 +34,8 @@ module Groonga
32
34
  ]
33
35
  end
34
36
  end
37
+
38
+ Command.register(command_name, self)
35
39
  end
36
40
  end
37
41
  end
@@ -22,9 +22,11 @@ module Groonga
22
22
  #
23
23
  # @since 1.1.5
24
24
  class ConfigDelete < Base
25
- Command.register("config_delete", self)
26
-
27
25
  class << self
26
+ def command_name
27
+ "config_delete"
28
+ end
29
+
28
30
  def parameter_names
29
31
  [
30
32
  :key,
@@ -32,6 +34,8 @@ module Groonga
32
34
  end
33
35
  end
34
36
 
37
+ Command.register(command_name, self)
38
+
35
39
  # @return [String] `key` parameter value.
36
40
  #
37
41
  # @since 1.1.4
@@ -22,9 +22,11 @@ module Groonga
22
22
  #
23
23
  # @since 1.1.5
24
24
  class ConfigGet < Base
25
- Command.register("config_get", self)
26
-
27
25
  class << self
26
+ def command_name
27
+ "config_get"
28
+ end
29
+
28
30
  def parameter_names
29
31
  [
30
32
  :key,
@@ -32,6 +34,8 @@ module Groonga
32
34
  end
33
35
  end
34
36
 
37
+ Command.register(command_name, self)
38
+
35
39
  # @return [String] `key` parameter value.
36
40
  #
37
41
  # @since 1.1.4
@@ -22,9 +22,11 @@ module Groonga
22
22
  #
23
23
  # @since 1.1.5
24
24
  class ConfigSet < Base
25
- Command.register("config_set", self)
26
-
27
25
  class << self
26
+ def command_name
27
+ "config_set"
28
+ end
29
+
28
30
  def parameter_names
29
31
  [
30
32
  :key,
@@ -33,6 +35,8 @@ module Groonga
33
35
  end
34
36
  end
35
37
 
38
+ Command.register(command_name, self)
39
+
36
40
  # @return [String] `key` parameter value.
37
41
  #
38
42
  # @since 1.1.4
@@ -21,9 +21,11 @@ require "groonga/command/base"
21
21
  module Groonga
22
22
  module Command
23
23
  class Delete < Base
24
- Command.register("delete", self)
25
-
26
24
  class << self
25
+ def command_name
26
+ "delete"
27
+ end
28
+
27
29
  def parameter_names
28
30
  [
29
31
  :table,
@@ -33,6 +35,8 @@ module Groonga
33
35
  ]
34
36
  end
35
37
  end
38
+
39
+ Command.register(command_name, self)
36
40
  end
37
41
  end
38
42
  end
@@ -21,9 +21,11 @@ require "groonga/command/base"
21
21
  module Groonga
22
22
  module Command
23
23
  class Dump < Base
24
- Command.register("dump", self)
25
-
26
24
  class << self
25
+ def command_name
26
+ "dump"
27
+ end
28
+
27
29
  def parameter_names
28
30
  [
29
31
  :tables,
@@ -36,6 +38,8 @@ module Groonga
36
38
  end
37
39
  end
38
40
 
41
+ Command.register(command_name, self)
42
+
39
43
  def output_type
40
44
  :none
41
45
  end
@@ -21,9 +21,11 @@ require "groonga/command/base"
21
21
  module Groonga
22
22
  module Command
23
23
  class Get < Base
24
- Command.register("get", self)
25
-
26
24
  class << self
25
+ def command_name
26
+ "get"
27
+ end
28
+
27
29
  def parameter_names
28
30
  [
29
31
  :table,
@@ -33,6 +35,8 @@ module Groonga
33
35
  ]
34
36
  end
35
37
  end
38
+
39
+ Command.register(command_name, self)
36
40
  end
37
41
  end
38
42
  end
@@ -22,9 +22,11 @@ module Groonga
22
22
  #
23
23
  # @since 1.1.3
24
24
  class IOFlush < Base
25
- Command.register("io_flush", self)
26
-
27
25
  class << self
26
+ def command_name
27
+ "io_flush"
28
+ end
29
+
28
30
  def parameter_names
29
31
  [
30
32
  :target_name,
@@ -33,6 +35,8 @@ module Groonga
33
35
  end
34
36
  end
35
37
 
38
+ Command.register(command_name, self)
39
+
36
40
  # @return [String] `target_name` parameter value.
37
41
  #
38
42
  # @since 1.1.3
@@ -23,9 +23,11 @@ require "groonga/command/base"
23
23
  module Groonga
24
24
  module Command
25
25
  class Load < Base
26
- Command.register("load", self)
27
-
28
26
  class << self
27
+ def command_name
28
+ "load"
29
+ end
30
+
29
31
  def parameter_names
30
32
  [
31
33
  :values,
@@ -38,6 +40,8 @@ module Groonga
38
40
  end
39
41
  end
40
42
 
43
+ Command.register(command_name, self)
44
+
41
45
  attr_writer :values
42
46
  attr_writer :columns
43
47
  def initialize(*argumetns)