groonga-command 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cfe3f7636980048811df9b36b3553cf2b868cf2c
4
+ data.tar.gz: 8d48249afba06e16dd6165091d4b016a6488e77e
5
+ SHA512:
6
+ metadata.gz: 549c80ac84a5023436fae2fdb6ca1dc846658749ef2adec2db3e658573d1df13393c61e37e7a3b41ebef72caae763d9106d89d414b180aeeb31b156b903e7e96
7
+ data.tar.gz: 8f32bb87c46960b0623ed3501d0ad5ed6d432b8571dfdc6a464908dbc214dad4a16fad54c1ae0dd154e4abe8dc83ba8af8fc68d85ed3a40cfd71dc19a348eb0e
data/doc/text/news.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # News
2
2
 
3
+ ## 1.0.2: 2013-06-27
4
+
5
+ ### Improvements
6
+
7
+ * Supported "dump" command.
8
+ * Added {Groonga::Command::Base#output_type}.
9
+ * [http] Supported key only parameter.
10
+ * Supported {Groonga::Command::Select#conditions} without
11
+ filter parameter.
12
+
3
13
  ## 1.0.1: 2012-12-06
4
14
 
5
15
  It's bug fix release.
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2012-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
@@ -74,6 +74,10 @@ module Groonga
74
74
  @original_format == :command
75
75
  end
76
76
 
77
+ def output_type
78
+ (self[:output_type] || :json).to_sym
79
+ end
80
+
77
81
  def to_uri_format
78
82
  path = "/d/#{@name}"
79
83
  arguments = @arguments.dup
@@ -0,0 +1,31 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ require "groonga/command/base"
20
+
21
+ module Groonga
22
+ module Command
23
+ class Dump < Base
24
+ Command.register("dump", self)
25
+
26
+ def output_type
27
+ :none
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2011-2012 Kouhei Sutou <kou@clear-code.com>
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
@@ -25,6 +25,7 @@ require "groonga/command/error"
25
25
 
26
26
  require "groonga/command/base"
27
27
 
28
+ require "groonga/command/dump"
28
29
  require "groonga/command/get"
29
30
  require "groonga/command/select"
30
31
  require "groonga/command/suggest"
@@ -397,6 +398,7 @@ module Groonga
397
398
  if arguments_string
398
399
  arguments_string.split(/&/).each do |argument_string|
399
400
  key, value = argument_string.split(/\=/, 2)
401
+ next if value.nil?
400
402
  arguments[key] = CGI.unescape(value)
401
403
  end
402
404
  end
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2012-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
@@ -49,12 +49,7 @@ module Groonga
49
49
  end
50
50
 
51
51
  def conditions
52
- @conditions ||= filter.split(/(?:&&|&!|\|\|)/).collect do |condition|
53
- condition = condition.strip
54
- condition = condition.gsub(/\A[\s\(]*/, '')
55
- condition = condition.gsub(/[\s\)]*\z/, '') unless /\(/ =~ condition
56
- condition
57
- end
52
+ @conditions ||= split_filter_conditions
58
53
  end
59
54
 
60
55
  def drilldowns
@@ -64,6 +59,16 @@ module Groonga
64
59
  def output_columns
65
60
  self[:output_columns]
66
61
  end
62
+
63
+ private
64
+ def split_filter_conditions
65
+ (filter || "").split(/(?:&&|&!|\|\|)/).collect do |condition|
66
+ condition = condition.strip
67
+ condition = condition.gsub(/\A[\s\(]*/, '')
68
+ condition = condition.gsub(/[\s\)]*\z/, '') unless /\(/ =~ condition
69
+ condition
70
+ end
71
+ end
67
72
  end
68
73
  end
69
74
  end
@@ -18,6 +18,6 @@
18
18
 
19
19
  module Groonga
20
20
  module Command
21
- VERSION = "1.0.1"
21
+ VERSION = "1.0.2"
22
22
  end
23
23
  end
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2011-2012 Kouhei Sutou <kou@clear-code.com>
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
@@ -111,4 +111,17 @@ class BaseCommandTest < Test::Unit::TestCase
111
111
  assert_true(@select.has_key?("table"))
112
112
  end
113
113
  end
114
+
115
+ sub_test_case("#output_type") do
116
+ def test_default
117
+ command = Groonga::Command::Base.new("table_list", {})
118
+ assert_equal(:json, command.output_type)
119
+ end
120
+
121
+ def test_specified
122
+ command = Groonga::Command::Base.new("table_list",
123
+ :output_type => "xml")
124
+ assert_equal(:xml, command.output_type)
125
+ end
126
+ end
114
127
  end
@@ -0,0 +1,30 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ class DumpCommandTest < Test::Unit::TestCase
20
+ include GroongaCommandTestUtils::CommandLineCommandParser
21
+
22
+ def test_output_type
23
+ assert_equal(:none, command.output_type)
24
+ end
25
+
26
+ private
27
+ def command(arguments={})
28
+ Groonga::Command::Dump.new("dump", arguments)
29
+ end
30
+ end
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2011-2012 Kouhei Sutou <kou@clear-code.com>
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
@@ -56,5 +56,12 @@ class SelectCommandTest < Test::Unit::TestCase
56
56
  'keyword @ "養殖"'],
57
57
  select.conditions)
58
58
  end
59
+
60
+ def test_omitted
61
+ select = command(:table => "Users",
62
+ :filter => nil)
63
+ assert_equal([],
64
+ select.conditions)
65
+ end
59
66
  end
60
67
  end
data/test/test-parser.rb CHANGED
@@ -43,6 +43,12 @@ class ParserTest < Test::Unit::TestCase
43
43
  assert_not_predicate(command, :command_format?)
44
44
  end
45
45
 
46
+ def test_no_value
47
+ path = "/d/select?table=Users&key_only"
48
+ command = Groonga::Command::Parser.parse(path)
49
+ assert_equal({:table => "Users"}, command.arguments)
50
+ end
51
+
46
52
  class ParseTest < self
47
53
  include ParseTests
48
54
  end
metadata CHANGED
@@ -1,142 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-command
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
5
- prerelease:
4
+ version: 1.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Kouhei Sutou
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-06 00:00:00.000000000 Z
11
+ date: 2013-06-27 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: yajl-ruby
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: test-unit
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: test-unit-notify
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: bundler
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: packnga
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: yard
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: redcarpet
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - '>='
132
116
  - !ruby/object:Gem::Version
133
117
  version: '0'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - '>='
140
123
  - !ruby/object:Gem::Version
141
124
  version: '0'
142
125
  description: ''
@@ -151,91 +134,87 @@ files:
151
134
  - Gemfile
152
135
  - groonga-command.gemspec
153
136
  - .yardopts
154
- - lib/groonga/command/parser.rb
137
+ - lib/groonga/command/register.rb
138
+ - lib/groonga/command/version.rb
139
+ - lib/groonga/command/column-rename.rb
140
+ - lib/groonga/command/truncate.rb
155
141
  - lib/groonga/command/load.rb
142
+ - lib/groonga/command/delete.rb
143
+ - lib/groonga/command/error.rb
144
+ - lib/groonga/command/column-create.rb
145
+ - lib/groonga/command/suggest.rb
156
146
  - lib/groonga/command/table-remove.rb
157
- - lib/groonga/command/truncate.rb
158
- - lib/groonga/command/version.rb
159
147
  - lib/groonga/command/column-remove.rb
160
- - lib/groonga/command/column-create.rb
148
+ - lib/groonga/command/table-create.rb
161
149
  - lib/groonga/command/get.rb
162
- - lib/groonga/command/suggest.rb
150
+ - lib/groonga/command/base.rb
151
+ - lib/groonga/command/dump.rb
163
152
  - lib/groonga/command/table-rename.rb
164
- - lib/groonga/command/register.rb
165
- - lib/groonga/command/column-rename.rb
166
- - lib/groonga/command/table-create.rb
167
- - lib/groonga/command/delete.rb
168
153
  - lib/groonga/command/select.rb
169
- - lib/groonga/command/base.rb
170
- - lib/groonga/command/error.rb
154
+ - lib/groonga/command/parser.rb
171
155
  - lib/groonga/command.rb
172
- - doc/text/news.md
173
156
  - doc/text/lgpl-2.1.txt
174
- - test/run-test.rb
175
- - test/command/test-base.rb
176
- - test/command/test-truncate.rb
177
- - test/command/test-delete.rb
157
+ - doc/text/news.md
158
+ - test/command/test-column-remove.rb
159
+ - test/command/test-table-rename.rb
178
160
  - test/command/test-table-create.rb
161
+ - test/command/test-column-rename.rb
162
+ - test/command/test-load.rb
163
+ - test/command/test-suggest.rb
179
164
  - test/command/test-table-remove.rb
180
- - test/command/test-get.rb
165
+ - test/command/test-delete.rb
166
+ - test/command/test-base.rb
181
167
  - test/command/test-column-create.rb
182
- - test/command/test-suggest.rb
183
- - test/command/test-load.rb
184
- - test/command/test-column-remove.rb
185
- - test/command/test-column-rename.rb
186
- - test/command/test-table-rename.rb
187
168
  - test/command/test-register.rb
188
169
  - test/command/test-select.rb
189
- - test/groonga-command-test-utils.rb
170
+ - test/command/test-truncate.rb
171
+ - test/command/test-dump.rb
172
+ - test/command/test-get.rb
190
173
  - test/test-parser.rb
174
+ - test/run-test.rb
175
+ - test/groonga-command-test-utils.rb
191
176
  homepage: https://github.com/groonga/groonga-command
192
177
  licenses:
193
178
  - LGPLv2.1+
179
+ metadata: {}
194
180
  post_install_message:
195
181
  rdoc_options: []
196
182
  require_paths:
197
183
  - lib
198
184
  required_ruby_version: !ruby/object:Gem::Requirement
199
- none: false
200
185
  requirements:
201
- - - ! '>='
186
+ - - '>='
202
187
  - !ruby/object:Gem::Version
203
188
  version: '0'
204
- segments:
205
- - 0
206
- hash: -126866082870084770
207
189
  required_rubygems_version: !ruby/object:Gem::Requirement
208
- none: false
209
190
  requirements:
210
- - - ! '>='
191
+ - - '>='
211
192
  - !ruby/object:Gem::Version
212
193
  version: '0'
213
- segments:
214
- - 0
215
- hash: -126866082870084770
216
194
  requirements: []
217
195
  rubyforge_project:
218
- rubygems_version: 1.8.23
196
+ rubygems_version: 2.0.2
219
197
  signing_key:
220
- specification_version: 3
198
+ specification_version: 4
221
199
  summary: Groonga-command is a library to process [groonga](http://groonga.org/)'s
222
200
  command syntax. You can write a program to process groonga's command by using groonga-command.
223
201
  test_files:
224
- - test/run-test.rb
225
- - test/command/test-base.rb
226
- - test/command/test-truncate.rb
227
- - test/command/test-delete.rb
202
+ - test/command/test-column-remove.rb
203
+ - test/command/test-table-rename.rb
228
204
  - test/command/test-table-create.rb
205
+ - test/command/test-column-rename.rb
206
+ - test/command/test-load.rb
207
+ - test/command/test-suggest.rb
229
208
  - test/command/test-table-remove.rb
230
- - test/command/test-get.rb
209
+ - test/command/test-delete.rb
210
+ - test/command/test-base.rb
231
211
  - test/command/test-column-create.rb
232
- - test/command/test-suggest.rb
233
- - test/command/test-load.rb
234
- - test/command/test-column-remove.rb
235
- - test/command/test-column-rename.rb
236
- - test/command/test-table-rename.rb
237
212
  - test/command/test-register.rb
238
213
  - test/command/test-select.rb
239
- - test/groonga-command-test-utils.rb
214
+ - test/command/test-truncate.rb
215
+ - test/command/test-dump.rb
216
+ - test/command/test-get.rb
240
217
  - test/test-parser.rb
218
+ - test/run-test.rb
219
+ - test/groonga-command-test-utils.rb
241
220
  has_rdoc: