groonga-command-parser 1.1.3 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d15b5c7601c61b757b5f422f0edb1f8fb49f904a
4
- data.tar.gz: 6bb40d256f229dbf2e99884facc76d6dc1da11f4
2
+ SHA256:
3
+ metadata.gz: 5f7e2b01c72582f1718fdf43f61bb224754697b48fb283523fe30ef7273bb6d0
4
+ data.tar.gz: 0feaf747b1f1e28d4300ffe35044f94887b44571f1958d592b6c9c9f6b4ee739
5
5
  SHA512:
6
- metadata.gz: 618025a3101618ce4d4dde8074158c765faa4c179de98019a2375f66419e3849a5dcec40c59a9e5d0b3230ac2a875b1b6dda7247f2dd17ca7a4fb2f9f4d1cfcf
7
- data.tar.gz: 6a5f6f60e9e002bdf64949af7dbe5fb6c229b864608f695256111d2d0e1da99792e48b2c560b0721e5bdd2943d93bc7b08b9621657c5d764dc19d5d90ac15888
6
+ metadata.gz: 8d6e9e681c69244925c5366d7a9098a265194ac2c2ec64952ddfbd72ab584209ff14c763d3f3aebd1dc8454409b0abe3a928bba78cb32aa17d1bb883bc35c7b2
7
+ data.tar.gz: e096edc06404d287db93fb984e531c489290465dbb1b13c5ad719eac9a8f7e4f472fbb4acf059b66b621c875b8678fb486de225489acf8fd689bcbddfc140e38
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- # -*- mode: ruby; coding: utf-8 -*-
1
+ # -*- mode: ruby -*-
2
2
  #
3
- # Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2012-2024 Sutou Kouhei <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
@@ -43,3 +43,13 @@ desc "Run tests"
43
43
  task :test do
44
44
  ruby("test/run-test.rb")
45
45
  end
46
+
47
+ release_task = Rake.application["release"]
48
+ # We use Trusting Publishing
49
+ release_task.prerequisites.delete("build")
50
+ release_task.prerequisites.delete("release:rubygem_push")
51
+ release_task_comment = release_task.comment
52
+ if release_task_comment
53
+ release_task.clear_comments
54
+ release_task.comment = release_task_comment.gsub(/ and build.*$/, "")
55
+ end
data/doc/text/news.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # News
2
2
 
3
+ ## 1.1.5: 2024-12-24
4
+
5
+ ### Improvements
6
+
7
+ * Suppressed warnings with Ruby 3.4.
8
+
9
+ ## 1.1.4: 2019-03-26
10
+
11
+ ### Fixes
12
+
13
+ * Fixed a bug that can't convert to the Elasticsearch format
14
+ when a "load" command hasn't option name of "--value"
15
+
3
16
  ## 1.1.3: 2019-03-22
4
17
 
5
18
  ### Improvements
@@ -1,6 +1,6 @@
1
- # -*- mode: ruby; coding: utf-8 -*-
1
+ # -*- mode: ruby -*-
2
2
  #
3
- # Copyright (C) 2012-2017 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2012-2024 Sutou Kouhei <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,7 +56,6 @@ Gem::Specification.new do |spec|
56
56
  spec.add_runtime_dependency("json-stream")
57
57
 
58
58
  spec.add_development_dependency("test-unit")
59
- spec.add_development_dependency("test-unit-notify")
60
59
  spec.add_development_dependency("rake")
61
60
  spec.add_development_dependency("bundler")
62
61
  spec.add_development_dependency("packnga")
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2017 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2014-2019 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
@@ -86,6 +86,7 @@ module Groonga
86
86
  "Currently, we can specify 5, 6, 7, and 8" +
87
87
  " in this option",
88
88
  "Available only in elasticsearch format",
89
+ Integer,
89
90
  "[#{@elasticsearch_version}]") do |version|
90
91
  @elasticsearch_version = version
91
92
  end
@@ -94,9 +95,24 @@ module Groonga
94
95
  end
95
96
 
96
97
  def convert(input)
97
- parser = Parser.new
98
- parser.on_command do |command|
99
- puts(convert_format(command))
98
+ parser = Parser.new(need_original_source: false)
99
+ case @format
100
+ when :elasticsearch
101
+ parser.on_load_columns do |command, columns|
102
+ command[:columns] ||= columns.join(",")
103
+ end
104
+ loaded_values = []
105
+ parser.on_load_value do |command, value|
106
+ loaded_values << value
107
+ end
108
+ parser.on_load_complete do |command|
109
+ command[:values] = JSON.generate(loaded_values)
110
+ puts(convert_format(command))
111
+ end
112
+ else
113
+ parser.on_command do |command|
114
+ puts(convert_format(command))
115
+ end
100
116
  end
101
117
  input.each_line do |line|
102
118
  parser << line
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2015-2024 Sutou Kouhei <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
@@ -32,7 +32,7 @@ module Groonga
32
32
  start_quote = nil
33
33
  until scanner.eos?
34
34
  if start_quote
35
- token = ""
35
+ token = +""
36
36
  loop do
37
37
  chunk = scanner.scan_until(/#{Regexp.escape(start_quote)}/)
38
38
  if chunk.nil?
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2011-2024 Sutou Kouhei <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
@@ -31,7 +29,7 @@ module Groonga
31
29
 
32
30
  private
33
31
  def compute_location(before, after)
34
- location = ""
32
+ location = +""
35
33
  if before[-1] == ?\n
36
34
  location << before
37
35
  location << after
@@ -17,7 +17,7 @@
17
17
  module Groonga
18
18
  module Command
19
19
  class Parser
20
- VERSION = "1.1.3"
20
+ VERSION = "1.1.5"
21
21
  end
22
22
  end
23
23
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2011-2019 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2011-2024 Sutou Kouhei <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
@@ -345,7 +345,8 @@ module Groonga
345
345
  def reset
346
346
  @command = nil
347
347
  @loading = false
348
- @buffer = "".force_encoding("ASCII-8BIT")
348
+ @buffer = +""
349
+ @buffer.force_encoding("ASCII-8BIT")
349
350
  @load_values_parser = nil
350
351
  end
351
352
 
@@ -371,7 +372,8 @@ module Groonga
371
372
  if @loading
372
373
  @command.original_source << consumed if @need_original_source
373
374
  if @buffer.bytesize == consumed.bytesize
374
- @buffer = "".force_encoding("ASCII-8BIT")
375
+ @buffer = +""
376
+ @buffer.force_encoding("ASCII-8BIT")
375
377
  else
376
378
  @buffer = @buffer[consumed.bytesize..-1]
377
379
  end
data/test/run-test.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Copyright (C) 2012-2016 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2012-2024 Sutou Kouhei <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
@@ -23,9 +23,6 @@ lib_dir = File.join(base_dir, "lib")
23
23
  test_dir = File.join(base_dir, "test")
24
24
 
25
25
  require "test-unit"
26
- require "test/unit/notify"
27
-
28
- Test::Unit::Priority.enable
29
26
 
30
27
  groonga_command_dir = File.join(base_dir, "..", "groonga-command")
31
28
  groonga_command_dir = File.expand_path(groonga_command_dir)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-command-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-22 00:00:00.000000000 Z
11
+ date: 2024-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: groonga-command
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: test-unit-notify
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rake
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -188,15 +174,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
174
  - !ruby/object:Gem::Version
189
175
  version: '0'
190
176
  requirements: []
191
- rubyforge_project:
192
- rubygems_version: 2.5.2.1
177
+ rubygems_version: 3.5.22
193
178
  signing_key:
194
179
  specification_version: 4
195
180
  summary: Groonga-command-parser is a Ruby library to parses [groonga](http://groonga.org/)'s
196
181
  command syntax. You can write a program to process groonga's command by using groonga-command-parser.
197
182
  test_files:
198
- - test/test-load-value-parser.rb
199
- - test/run-test.rb
200
- - test/test-parser.rb
201
183
  - test/groonga-command-parser-test-utils.rb
184
+ - test/run-test.rb
202
185
  - test/test-command-line-splitter.rb
186
+ - test/test-load-value-parser.rb
187
+ - test/test-parser.rb