[Groonga-commit] groonga/groonga at d99e721 [master] dump: support Ruby plugin

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Apr 3 13:27:34 JST 2015


Kouhei Sutou	2015-04-03 13:27:34 +0900 (Fri, 03 Apr 2015)

  New Revision: d99e7213ade0bdb885e55f0bd94cc02adf79f88a
  https://github.com/groonga/groonga/commit/d99e7213ade0bdb885e55f0bd94cc02adf79f88a

  Message:
    dump: support Ruby plugin

  Added files:
    test/command/suite/dump/schema/plugin/ruby.expected
    test/command/suite/dump/schema/plugin/ruby.test
  Modified files:
    lib/proc.c

  Modified: lib/proc.c (+12 -6)
===================================================================
--- lib/proc.c    2015-04-03 13:27:03 +0900 (b320f46)
+++ lib/proc.c    2015-04-03 13:27:34 +0900 (910d17d)
@@ -3101,7 +3101,8 @@ dump_plugins(grn_ctx *ctx, grn_obj *outbuf)
   grn_id id;
   grn_hash *processed_paths;
   const char *system_plugins_dir;
-  const char *plugin_suffix;
+  const char *native_plugin_suffix;
+  const char *ruby_plugin_suffix;
 
   cursor = grn_table_cursor_open(ctx, db, NULL, 0, NULL, 0, 0, -1,
                                  GRN_CURSOR_BY_ID);
@@ -3118,7 +3119,8 @@ dump_plugins(grn_ctx *ctx, grn_obj *outbuf)
   }
 
   system_plugins_dir = grn_plugin_get_system_plugins_dir();
-  plugin_suffix = grn_plugin_get_suffix();
+  native_plugin_suffix = grn_plugin_get_suffix();
+  ruby_plugin_suffix = grn_plugin_get_ruby_suffix();
   while ((id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL) {
     grn_obj *object;
     const char *path;
@@ -3178,10 +3180,14 @@ dump_plugins(grn_ctx *ctx, grn_obj *outbuf)
       } else {
         strcat(name, relative_path);
       }
-      if (strlen(name) > strlen(plugin_suffix) &&
-          strcmp(name + strlen(name) - strlen(plugin_suffix),
-                 plugin_suffix) == 0) {
-        name[strlen(name) - strlen(plugin_suffix)] = '\0';
+      if (strlen(name) > strlen(native_plugin_suffix) &&
+          strcmp(name + strlen(name) - strlen(native_plugin_suffix),
+                 native_plugin_suffix) == 0) {
+        name[strlen(name) - strlen(native_plugin_suffix)] = '\0';
+      } else if (strlen(name) > strlen(ruby_plugin_suffix) &&
+                 strcmp(name + strlen(name) - strlen(ruby_plugin_suffix),
+                        ruby_plugin_suffix) == 0) {
+        name[strlen(name) - strlen(ruby_plugin_suffix)] = '\0';
       }
       grn_text_printf(ctx, outbuf, "plugin_register %s\n", name);
     }

  Added: test/command/suite/dump/schema/plugin/ruby.expected (+6 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/dump/schema/plugin/ruby.expected    2015-04-03 13:27:34 +0900 (3c0a514)
@@ -0,0 +1,6 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+dump
+plugin_register sharding
+
+

  Added: test/command/suite/dump/schema/plugin/ruby.test (+5 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/dump/schema/plugin/ruby.test    2015-04-03 13:27:34 +0900 (f1e89e0)
@@ -0,0 +1,5 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+dump
-------------- next part --------------
HTML����������������������������...
下载 



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