[Groonga-commit] groonga/groonga-command [master] Add column_create

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Nov 25 19:30:46 JST 2012


Kouhei Sutou	2012-11-25 19:30:46 +0900 (Sun, 25 Nov 2012)

  New Revision: 8ca674998c51e3735585efb432e4aa97cc1eddbe
  https://github.com/groonga/groonga-command/commit/8ca674998c51e3735585efb432e4aa97cc1eddbe

  Log:
    Add column_create

  Added files:
    lib/groonga/command/column-create.rb
    test/command/test-column-create.rb
  Modified files:
    lib/groonga/command/parser.rb

  Added: lib/groonga/command/column-create.rb (+39 -0) 100644
===================================================================
--- /dev/null
+++ lib/groonga/command/column-create.rb    2012-11-25 19:30:46 +0900 (5bc8741)
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012  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/command/base"
+
+module Groonga
+  module Command
+    class ColumnCreate < Base
+      Command.register("column_create", self)
+
+      class << self
+        def parameter_names
+          [
+            :table,
+            :name,
+            :flags,
+            :key_type,
+            :source,
+          ]
+        end
+      end
+    end
+  end
+end

  Modified: lib/groonga/command/parser.rb (+1 -0)
===================================================================
--- lib/groonga/command/parser.rb    2012-11-25 19:29:34 +0900 (948dda1)
+++ lib/groonga/command/parser.rb    2012-11-25 19:30:46 +0900 (5cb2786)
@@ -24,6 +24,7 @@ require "groonga/command/select"
 require "groonga/command/table-create"
 require "groonga/command/table-remove"
 require "groonga/command/table-rename"
+require "groonga/command/column-create"
 
 module Groonga
   module Command

  Added: test/command/test-column-create.rb (+47 -0) 100644
===================================================================
--- /dev/null
+++ test/command/test-column-create.rb    2012-11-25 19:30:46 +0900 (00a6c90)
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012  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
+
+class ColumnCreateCommandTest < Test::Unit::TestCase
+  class CommandLineTest < self
+    include GroongaCommandTestUtils::CommandLineCommandParser
+
+    def test_ordered_arguments
+      table    = "Lexicon"
+      name     = "content_index"
+      flags    = "COLUMN_INDEX"
+      key_type = "Posts"
+      source   = "content"
+
+      command = parse(table, name, flags, key_type, source)
+      assert_instance_of(Groonga::Command::ColumnCreate, command)
+      assert_equal({
+                     :table    => table,
+                     :name     => name,
+                     :flags    => flags,
+                     :key_type => key_type,
+                     :source   => source,
+                   },
+                   command.arguments)
+    end
+
+    private
+    def parse(*arguments)
+      super("column_create", arguments, :output_type => false)
+    end
+  end
+end
-------------- next part --------------
HTML����������������������������...
Download 



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