[Groonga-commit] ranguba/groonga-client at 6b6a9c8 [master] Remove groonga-client

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Jun 10 15:55:40 JST 2015


Kouhei Sutou	2015-06-10 15:55:40 +0900 (Wed, 10 Jun 2015)

  New Revision: 6b6a9c8595a333bc33165afc10727b52ce49ec94
  https://github.com/ranguba/groonga-client/commit/6b6a9c8595a333bc33165afc10727b52ce49ec94

  Message:
    Remove groonga-client
    
    It's moved to groonga-client-cli.

  Removed files:
    bin/groonga-client
    lib/groonga/client/command-line/groonga-client.rb
    lib/groonga/client/default.rb
  Modified files:
    groonga-client.gemspec

  Deleted: bin/groonga-client (+0 -23) 100755
===================================================================
--- bin/groonga-client    2015-06-10 15:55:19 +0900 (ca88844)
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env ruby
-# -*- mode: ruby -*-
-#
-# Copyright (C) 2015  Kouhei Sutou <kou �� clear-code.com>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-require "groonga/client/command-line/groonga-client"
-
-client = Groonga::Client::CommandLine::GroongaClient.new
-exit(client.run(ARGV))

  Modified: groonga-client.gemspec (+0 -4)
===================================================================
--- groonga-client.gemspec    2015-06-10 15:55:19 +0900 (181cc56)
+++ groonga-client.gemspec    2015-06-10 15:55:40 +0900 (da1b371)
@@ -43,13 +43,9 @@ Gem::Specification.new do |spec|
   spec.files += Dir.glob("lib/**/*.rb")
   spec.files += Dir.glob("doc/text/*")
   spec.test_files += Dir.glob("test/**/*")
-  Dir.chdir("bin") do
-    spec.executables = Dir.glob("*")
-  end
 
   spec.add_runtime_dependency("gqtp", ">= 1.0.4")
   spec.add_runtime_dependency("groonga-command", ">= 1.0.8")
-  spec.add_runtime_dependency("groonga-command-parser")
 
   spec.add_development_dependency("bundler")
   spec.add_development_dependency("rake")

  Deleted: lib/groonga/client/command-line/groonga-client.rb (+0 -198) 100644
===================================================================
--- lib/groonga/client/command-line/groonga-client.rb    2015-06-10 15:55:19 +0900 (4e40ae2)
+++ /dev/null
@@ -1,198 +0,0 @@
-# Copyright (C) 2015  Kouhei Sutou <kou �� clear-code.com>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-require "ostruct"
-require "optparse"
-require "json"
-
-require "groonga/command/parser"
-
-require "groonga/client"
-
-module Groonga
-  class Client
-    module CommandLine
-      class GroongaClient
-        def initialize
-          @protocol = :http
-          @host     = "localhost"
-          @port     = nil
-
-          @read_timeout = Default::READ_TIMEOUT
-
-          @runner_options = {
-            :split_load_chunk_size => 10000,
-          }
-        end
-
-        def run(argv)
-          command_file_paths = parse_command_line(argv)
-
-          @client = Groonga::Client.new(:protocol => @protocol,
-                                        :host     => @host,
-                                        :port     => @port,
-                                        :read_timeout => @read_timeout,
-                                        :backend  => :synchronous)
-          runner = Runner.new(@client, @runner_options)
-
-          if command_file_paths.empty?
-            $stdin.each_line do |line|
-              runner << line
-            end
-          else
-            command_file_paths.each do |command_file_path|
-              File.open(command_file_path) do |command_file|
-                command_file.each_line do |line|
-                  runner << line
-                end
-              end
-            end
-          end
-
-          true
-        end
-
-        private
-        def parse_command_line(argv)
-          parser = OptionParser.new
-          parser.version = VERSION
-          parser.banner += " GROONGA_COMMAND_FILE1 GROONGA_COMMAND_FILE2 ..."
-
-          parser.separator("")
-
-          parser.separator("Connection:")
-
-          available_protocols = [:http, :gqtp]
-          parser.on("--protocol=PROTOCOL", [:http, :gqtp],
-                    "Protocol to connect to Groonga server.",
-                    "[#{available_protocols.join(", ")}]",
-                    "(#{@protocol})") do |protocol|
-            @protocol = protocol
-          end
-
-          parser.on("--host=HOST",
-                    "Groonga server to be connected.",
-                    "(#{@host})") do |host|
-            @host = host
-          end
-
-          parser.on("--port=PORT", Integer,
-                    "Port number of Groonga server to be connected.",
-                    "(auto)") do |port|
-            @port = port
-          end
-
-          parser.on("--read-timeout=TIMEOUT", Integer,
-                    "Timeout on reading response from Groonga server.",
-                    "You can disable timeout by specifying -1.",
-                    "(#{@read_timeout})") do |timeout|
-            @read_timeout = timeout
-          end
-
-          parser.on("--split-load-chunk-size=SIZE", Integer,
-                    "Split a large load to small loads.",
-                    "Each small load has at most SIZE records.",
-                    "Set 0 to SIZE to disable this feature.",
-                    "(#{@runner_options[:split_load_chunk_size]})") do |size|
-            @runner_options[:split_load_chunk_size] = size
-          end
-
-          command_file_paths = parser.parse(argv)
-
-          @port ||= default_port(@protocol)
-
-          command_file_paths
-        end
-
-        def default_port(protocol)
-          case protocol
-          when :http
-            10041
-          when :gqtp
-            10043
-          end
-        end
-
-        class Runner
-          def initialize(client, options={})
-            @client = client
-            @split_load_chunk_size = options[:split_load_chunk_size] || 10000
-            @load_values = []
-            @parser = create_command_parser
-          end
-
-          def <<(line)
-            @parser << line
-          end
-
-          private
-          def create_command_parser
-            parser = Groonga::Command::Parser.new
-
-            parser.on_command do |command|
-              run_command(command)
-            end
-
-            parser.on_load_columns do |command, columns|
-              command[:columns] ||= columns.join(",")
-            end
-
-            parser.on_load_value do |command, value|
-              unless command[:values]
-                @load_values << value
-                if @load_values.size == @split_load_chunk_size
-                  consume_load_values(command)
-                end
-              end
-              command.original_source.clear
-            end
-
-            parser.on_load_complete do |command|
-              if command[:values]
-                run_command(client, command)
-              else
-                consume_load_values(command)
-              end
-            end
-
-            parser
-          end
-
-          def consume_load_values(load_command)
-            return if @load_values.empty?
-
-            load_command[:values] = JSON.generate(@load_values)
-            run_command(load_command)
-            @load_values.clear
-            load_command[:values] = nil
-          end
-
-          def run_command(command)
-            response =****@clien*****(command)
-            case command.output_type
-            when :json
-              puts(JSON.pretty_generate([response.header, response.body]))
-            when :xml
-              puts(response.raw)
-            else
-              puts(response.body)
-            end
-          end
-        end
-      end
-    end
-  end
-end

  Deleted: lib/groonga/client/default.rb (+0 -25) 100644
===================================================================
--- lib/groonga/client/default.rb    2015-06-10 15:55:19 +0900 (f2f6fc3)
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 2015  Kouhei Sutou <kou �� clear-code.com>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-module Groonga
-  class Client
-    module Default
-      # The default timeout on reading response from Groonga server in
-      # seconds.
-      READ_TIMEOUT = 60
-    end
-  end
-end
-------------- next part --------------
HTML����������������������������...
Descargar 



More information about the Groonga-commit mailing list
Back to archive index