From null+ranguba at clear-code.com Thu Apr 5 07:04:46 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Thu, 05 Apr 2012 16:04:46 +0900 Subject: [groonga-commit:4357] ranguba/rroonga [master] Fix a GC related crash bug Message-ID: <20120405070457.EE49F9A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-05 16:04:46 +0900 (Thu, 05 Apr 2012) New Revision: b1364acdf883d32f83d08ec5e7794cbff0b9ae1e Log: Fix a GC related crash bug This commit fixes the following case: DB: close GC: start Context: close Expression: close <- CRASH Modified files: ext/groonga/rb-grn-context.c ext/groonga/rb-grn-database.c ext/groonga/rb-grn-object.c ext/groonga/rb-grn.h Modified: ext/groonga/rb-grn-context.c (+6 -3) =================================================================== --- ext/groonga/rb-grn-context.c 2012-03-29 17:26:53 +0900 (2d910a9) +++ ext/groonga/rb-grn-context.c 2012-04-05 16:04:46 +0900 (cc62d1b) @@ -66,7 +66,7 @@ rb_grn_context_register_floating_object (RbGrnObject *rb_grn_object) grn_ctx *context; grn_hash *floating_objects; - Data_Get_Struct(rb_grn_object->rb_context, RbGrnContext, rb_grn_context); + rb_grn_context = rb_grn_object->rb_grn_context; context = rb_grn_context->context; floating_objects = rb_grn_context->floating_objects; grn_hash_add(context, floating_objects, @@ -85,7 +85,10 @@ rb_grn_context_unregister_floating_object (RbGrnObject *rb_grn_object) if (!rb_grn_object->floating) return; - Data_Get_Struct(rb_grn_object->rb_context, RbGrnContext, rb_grn_context); + rb_grn_context = rb_grn_object->rb_grn_context; + if (!rb_grn_context) + return; + context = rb_grn_context->context; floating_objects = rb_grn_context->floating_objects; grn_hash_delete(context, floating_objects, @@ -94,7 +97,7 @@ rb_grn_context_unregister_floating_object (RbGrnObject *rb_grn_object) rb_grn_object->floating = GRN_FALSE; } -static void +void rb_grn_context_close_floating_objects (RbGrnContext *rb_grn_context) { grn_ctx *context; Modified: ext/groonga/rb-grn-database.c (+15 -0) =================================================================== --- ext/groonga/rb-grn-database.c 2012-03-29 17:26:53 +0900 (e15aaf4) +++ ext/groonga/rb-grn-database.c 2012-04-05 16:04:46 +0900 (732b87e) @@ -119,6 +119,21 @@ rb_grn_database_deconstruct (RbGrnObject *rb_grn_database, range_id, range); } +void +rb_grn_database_finalizer (grn_ctx *context, + RbGrnContext *rb_grn_context, + grn_obj *column, + RbGrnObject *rb_grn_database) +{ + if (rb_grn_context) { + rb_grn_context_close_floating_objects(rb_grn_context); + } + + if (!(context->flags & GRN_CTX_PER_DB)) { + grn_ctx_use(context, NULL); + } +} + /* * Document-method: close * Modified: ext/groonga/rb-grn-object.c (+19 -7) =================================================================== --- ext/groonga/rb-grn-object.c 2012-03-29 17:26:53 +0900 (e72ee04) +++ ext/groonga/rb-grn-object.c 2012-04-05 16:04:46 +0900 (4e79b2e) @@ -83,26 +83,27 @@ static void rb_grn_object_run_finalizer (grn_ctx *context, grn_obj *grn_object, RbGrnObject *rb_grn_object) { + RbGrnContext *rb_grn_context = NULL; + if (rb_grn_exited) return; grn_obj_set_finalizer(context, grn_object, NULL); - debug("finalize: %p:%p:%p:%p:%p %s(%#x)\n", + debug("finalize: %p:%p:%p:%p:%p:%p %s(%#x)\n", context, grn_object, rb_grn_object, rb_grn_object->context, rb_grn_object->object, + rb_grn_object->rb_grn_context, rb_grn_inspect_type(grn_object->header.type), grn_object->header.type); - rb_grn_object->context = NULL; - rb_grn_object->object = NULL; + rb_grn_context = rb_grn_object->rb_grn_context; rb_grn_object->have_finalizer = GRN_FALSE; switch (grn_object->header.type) { case GRN_DB: - if (!(context->flags & GRN_CTX_PER_DB)) { - grn_ctx_use(context, NULL); - } + rb_grn_database_finalizer(context, rb_grn_context, + grn_object, rb_grn_object); break; case GRN_TYPE: case GRN_PROC: @@ -153,6 +154,10 @@ rb_grn_object_run_finalizer (grn_ctx *context, grn_obj *grn_object, grn_object->header.type); break; } + + rb_grn_object->rb_grn_context = NULL; + rb_grn_object->context = NULL; + rb_grn_object->object = NULL; } static grn_obj * @@ -326,8 +331,15 @@ rb_grn_object_bind_common (VALUE klass, VALUE self, VALUE rb_context, grn_ctx *context, grn_obj *object) { grn_user_data *user_data; + RbGrnContext *rb_grn_context; + + debug("bind: %p:%p:%p %s(%#x)\n", + context, object, rb_grn_object, + rb_grn_inspect_type(object->header.type), + object->header.type); - rb_grn_object->rb_context = rb_context; + Data_Get_Struct(rb_context, RbGrnContext, rb_grn_context); + rb_grn_object->rb_grn_context = rb_grn_context; rb_grn_object->context = context; rb_grn_object->object = object; rb_grn_object->self = self; Modified: ext/groonga/rb-grn.h (+7 -1) =================================================================== --- ext/groonga/rb-grn.h 2012-03-29 17:26:53 +0900 (d0d9421) +++ ext/groonga/rb-grn.h 2012-04-05 16:04:46 +0900 (964f05a) @@ -106,7 +106,7 @@ typedef struct _RbGrnObject RbGrnObject; struct _RbGrnObject { VALUE self; - VALUE rb_context; + RbGrnContext *rb_grn_context; grn_ctx *context; grn_obj *object; grn_obj *domain; @@ -296,6 +296,7 @@ void rb_grn_context_register_floating_object (RbGrnObject *rb_grn_object); void rb_grn_context_unregister_floating_object (RbGrnObject *rb_grn_object); +void rb_grn_context_close_floating_objects(RbGrnContext *rb_grn_context); grn_ctx *rb_grn_context_ensure (VALUE *context); VALUE rb_grn_context_get_default (void); VALUE rb_grn_context_to_exception (grn_ctx *context, @@ -357,6 +358,11 @@ VALUE rb_grn_object_inspect_content (VALUE object, VALUE rb_grn_object_inspect_footer (VALUE object, VALUE inspected); +void rb_grn_database_finalizer (grn_ctx *context, + RbGrnContext *rb_grn_context, + grn_obj *column, + RbGrnObject *rb_grn_database); + void rb_grn_named_object_bind (RbGrnNamedObject *rb_grn_named_object, grn_ctx *context, grn_obj *object); From null+ranguba at clear-code.com Thu Apr 5 09:20:40 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Thu, 05 Apr 2012 18:20:40 +0900 Subject: [groonga-commit:4358] ranguba/rroonga [master] gc: support reusing context Message-ID: <20120405092051.9B3AB9A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-05 18:20:40 +0900 (Thu, 05 Apr 2012) New Revision: fc2b5919d950f51c173c37f358ac0dda2ccb8745 Log: gc: support reusing context Modified files: ext/groonga/rb-grn-context.c ext/groonga/rb-grn-database.c ext/groonga/rb-grn.h Modified: ext/groonga/rb-grn-context.c (+15 -4) =================================================================== --- ext/groonga/rb-grn-context.c 2012-04-05 16:04:46 +0900 (cc62d1b) +++ ext/groonga/rb-grn-context.c 2012-04-05 18:20:40 +0900 (2a2b1bd) @@ -117,6 +117,19 @@ rb_grn_context_close_floating_objects (RbGrnContext *rb_grn_context) grn_hash_close(context, floating_objects); } +void +rb_grn_context_reset_floating_objects (RbGrnContext *rb_grn_context) +{ + grn_ctx *context; + + rb_grn_context_close_floating_objects(rb_grn_context); + context = rb_grn_context->context; + rb_grn_context->floating_objects = grn_hash_create(context, NULL, + sizeof(RbGrnObject *), + 0, + GRN_OBJ_TABLE_HASH_KEY); +} + static void rb_grn_context_unlink_database (grn_ctx *context) { @@ -424,10 +437,8 @@ rb_grn_context_initialize (int argc, VALUE *argv, VALUE self) rb_grn_context_check(context, self); GRN_CTX_USER_DATA(context)->ptr = rb_grn_context; - rb_grn_context->floating_objects = grn_hash_create(context, NULL, - sizeof(RbGrnObject *), - 0, - GRN_OBJ_TABLE_HASH_KEY); + rb_grn_context->floating_objects = NULL; + rb_grn_context_reset_floating_objects(rb_grn_context); grn_ctx_set_finalizer(context, rb_grn_context_finalizer); if (!NIL_P(rb_encoding)) { Modified: ext/groonga/rb-grn-database.c (+10 -0) =================================================================== --- ext/groonga/rb-grn-database.c 2012-04-05 16:04:46 +0900 (732b87e) +++ ext/groonga/rb-grn-database.c 2012-04-05 18:20:40 +0900 (152ea32) @@ -155,6 +155,14 @@ rb_grn_database_close (VALUE self) return rb_grn_object_close(self); } +static void +reset_floating_objects (VALUE rb_context) +{ + RbGrnContext *rb_grn_context; + Data_Get_Struct(rb_context, RbGrnContext, rb_grn_context); + rb_grn_context_reset_floating_objects(rb_grn_context); +} + /* * call-seq: * Groonga::Database.create(options=nil) -> Groonga::Database @@ -210,6 +218,7 @@ rb_grn_database_s_create (int argc, VALUE *argv, VALUE klass) old_database = grn_ctx_db(context); if (old_database) grn_obj_unlink(context, old_database); + reset_floating_objects(rb_context); database = grn_db_create(context, path, &create_args); rb_grn_context_check(context, rb_ary_new4(argc, argv)); owner = (context->flags & GRN_CTX_PER_DB) ? GRN_FALSE : GRN_TRUE; @@ -264,6 +273,7 @@ rb_grn_database_initialize (int argc, VALUE *argv, VALUE self) old_database = grn_ctx_db(context); if (old_database) grn_obj_unlink(context, old_database); + reset_floating_objects(rb_context); database = grn_db_open(context, path); rb_grn_object_assign(Qnil, self, rb_context, context, database); rb_grn_context_check(context, self); Modified: ext/groonga/rb-grn.h (+1 -0) =================================================================== --- ext/groonga/rb-grn.h 2012-04-05 16:04:46 +0900 (964f05a) +++ ext/groonga/rb-grn.h 2012-04-05 18:20:40 +0900 (a680553) @@ -297,6 +297,7 @@ void rb_grn_context_register_floating_object void rb_grn_context_unregister_floating_object (RbGrnObject *rb_grn_object); void rb_grn_context_close_floating_objects(RbGrnContext *rb_grn_context); +void rb_grn_context_reset_floating_objects(RbGrnContext *rb_grn_context); grn_ctx *rb_grn_context_ensure (VALUE *context); VALUE rb_grn_context_get_default (void); VALUE rb_grn_context_to_exception (grn_ctx *context, From null+ranguba at clear-code.com Fri Apr 6 03:06:02 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Fri, 06 Apr 2012 12:06:02 +0900 Subject: [groonga-commit:4359] ranguba/rroonga [master] Fix a GC related crash bug Message-ID: <20120406030615.2203C9A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-06 12:06:02 +0900 (Fri, 06 Apr 2012) New Revision: 389322f1d5b9b411482e3b48dd75c61d1c519d7b Log: Fix a GC related crash bug This commit fixes the following case: DB: close GC: start Snippet: new <- CRASH Modified files: ext/groonga/rb-grn-context.c Modified: ext/groonga/rb-grn-context.c (+4 -0) =================================================================== --- ext/groonga/rb-grn-context.c 2012-04-05 18:20:40 +0900 (2a2b1bd) +++ ext/groonga/rb-grn-context.c 2012-04-06 12:06:02 +0900 (c433a96) @@ -69,6 +69,10 @@ rb_grn_context_register_floating_object (RbGrnObject *rb_grn_object) rb_grn_context = rb_grn_object->rb_grn_context; context = rb_grn_context->context; floating_objects = rb_grn_context->floating_objects; + if (!floating_objects) { + rb_grn_context_reset_floating_objects(rb_grn_context); + floating_objects = rb_grn_context->floating_objects; + } grn_hash_add(context, floating_objects, (const void *)(&rb_grn_object), sizeof(RbGrnObject *), NULL, NULL); From null+ranguba at clear-code.com Tue Apr 17 09:18:48 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 17 Apr 2012 18:18:48 +0900 Subject: [groonga-commit:4360] ranguba/rroonga [master] Merge pull request #5 from ryoqun/concurrent-schema-manipulation Message-ID: <20120417091854.6CC729A0A7@jenkins.clear-code.com> Kouhei Sutou 2012-04-17 18:18:48 +0900 (Tue, 17 Apr 2012) New Revision: 7c87335e858e1b777f673bc95a99d697e39d1528 Log: Merge pull request #5 from ryoqun/concurrent-schema-manipulation Add tests for schema manipulation by an other process Patch by Ryo Onodera. Thanks!!! From null+ranguba at clear-code.com Tue Apr 17 09:11:14 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 17 Apr 2012 18:11:14 +0900 Subject: [groonga-commit:4361] ranguba/rroonga [master] Add tests for schema manipulation by an other process Message-ID: <20120417091854.4DBB19A0A5@jenkins.clear-code.com> Ryo Onodera 2012-04-17 18:11:14 +0900 (Tue, 17 Apr 2012) New Revision: 4963ac6a113a498df60bccf2d9095dbe9cebf0e1 Merged 7c87335: Merge pull request #5 from ryoqun/concurrent-schema-manipulation Log: Add tests for schema manipulation by an other process Modified files: test/test-table.rb Modified: test/test-table.rb (+39 -0) =================================================================== --- test/test-table.rb 2012-04-06 12:06:02 +0900 (c7994d6) +++ test/test-table.rb 2012-04-17 18:11:14 +0900 (f58fba4) @@ -657,6 +657,38 @@ class TableTest < Test::Unit::TestCase assert_not_predicate(bookmarks, :builtin?) end + def test_create_by_other_process + by_other_process do + Groonga::PatriciaTrie.create(:name => "Bookmarks") + end + assert_not_nil(Groonga["Bookmarks"]) + end + + def test_define_column_by_other_process + bookmarks = Groonga::Hash.create(:name => "Bookmarks") + by_other_process do + bookmarks.define_column("name", "Text") + end + assert_not_nil(bookmarks.column("name")) + end + + def test_remove_by_other_process + bookmarks = Groonga::Array.create(:name => "Bookmarks") + by_other_process do + bookmarks.remove + end + assert_predicate(bookmarks, :closed?) + end + + def test_remove_column_by_other_process + bookmarks = Groonga::Hash.create(:name => "Bookmarks") + real_name = bookmarks.define_column("name", "Text") + by_other_process do + real_name.remove + end + assert_predicate(real_name, :closed?) + end + private def create_bookmarks bookmarks = Groonga::Array.create(:name => "Bookmarks") @@ -672,4 +704,11 @@ class TableTest < Test::Unit::TestCase end bookmarks end + + def by_other_process + pid = Process.fork do + yield + end + Process.waitpid pid + end end From null+ranguba at clear-code.com Tue Apr 17 09:36:39 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 17 Apr 2012 18:36:39 +0900 Subject: [groonga-commit:4362] ranguba/rroonga [master] Remove redundant _by_other_process from OtherProcessTest tests Message-ID: <20120417094620.947759A0A8@jenkins.clear-code.com> Ryo Onodera 2012-04-17 18:36:39 +0900 (Tue, 17 Apr 2012) New Revision: 7e4cecebe0b96cacfc8e8d70f616c876ddf831ce Log: Remove redundant _by_other_process from OtherProcessTest tests Modified files: test/test-table.rb Modified: test/test-table.rb (+4 -4) =================================================================== --- test/test-table.rb 2012-04-17 18:34:18 +0900 (757ba1f) +++ test/test-table.rb 2012-04-17 18:36:39 +0900 (7908a49) @@ -658,14 +658,14 @@ class TableTest < Test::Unit::TestCase end class OtherProcessTest < self - def test_create_by_other_process + def test_create by_other_process do Groonga::PatriciaTrie.create(:name => "Bookmarks") end assert_not_nil(Groonga["Bookmarks"]) end - def test_define_column_by_other_process + def test_define_column bookmarks = Groonga::Hash.create(:name => "Bookmarks") by_other_process do bookmarks.define_column("name", "Text") @@ -673,7 +673,7 @@ class TableTest < Test::Unit::TestCase assert_not_nil(bookmarks.column("name")) end - def test_remove_by_other_process + def test_remove bookmarks = Groonga::Array.create(:name => "Bookmarks") by_other_process do bookmarks.remove @@ -681,7 +681,7 @@ class TableTest < Test::Unit::TestCase assert_predicate(bookmarks, :closed?) end - def test_remove_column_by_other_process + def test_remove_column bookmarks = Groonga::Hash.create(:name => "Bookmarks") real_name = bookmarks.define_column("name", "Text") by_other_process do From null+ranguba at clear-code.com Tue Apr 17 09:34:18 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 17 Apr 2012 18:34:18 +0900 Subject: [groonga-commit:4363] ranguba/rroonga [master] Indent OtherProcessTest Message-ID: <20120417094620.897C49A0A7@jenkins.clear-code.com> Ryo Onodera 2012-04-17 18:34:18 +0900 (Tue, 17 Apr 2012) New Revision: f46a3af5954b89a93d5552ea5d1d07e5464fc688 Log: Indent OtherProcessTest Modified files: test/test-table.rb Modified: test/test-table.rb (+30 -30) =================================================================== --- test/test-table.rb 2012-04-17 18:23:50 +0900 (267564d) +++ test/test-table.rb 2012-04-17 18:34:18 +0900 (757ba1f) @@ -658,45 +658,45 @@ class TableTest < Test::Unit::TestCase end class OtherProcessTest < self - def test_create_by_other_process - by_other_process do - Groonga::PatriciaTrie.create(:name => "Bookmarks") + def test_create_by_other_process + by_other_process do + Groonga::PatriciaTrie.create(:name => "Bookmarks") + end + assert_not_nil(Groonga["Bookmarks"]) end - assert_not_nil(Groonga["Bookmarks"]) - end - def test_define_column_by_other_process - bookmarks = Groonga::Hash.create(:name => "Bookmarks") - by_other_process do - bookmarks.define_column("name", "Text") + def test_define_column_by_other_process + bookmarks = Groonga::Hash.create(:name => "Bookmarks") + by_other_process do + bookmarks.define_column("name", "Text") + end + assert_not_nil(bookmarks.column("name")) end - assert_not_nil(bookmarks.column("name")) - end - def test_remove_by_other_process - bookmarks = Groonga::Array.create(:name => "Bookmarks") - by_other_process do - bookmarks.remove + def test_remove_by_other_process + bookmarks = Groonga::Array.create(:name => "Bookmarks") + by_other_process do + bookmarks.remove + end + assert_predicate(bookmarks, :closed?) end - assert_predicate(bookmarks, :closed?) - end - def test_remove_column_by_other_process - bookmarks = Groonga::Hash.create(:name => "Bookmarks") - real_name = bookmarks.define_column("name", "Text") - by_other_process do - real_name.remove + def test_remove_column_by_other_process + bookmarks = Groonga::Hash.create(:name => "Bookmarks") + real_name = bookmarks.define_column("name", "Text") + by_other_process do + real_name.remove + end + assert_predicate(real_name, :closed?) end - assert_predicate(real_name, :closed?) - end - private - def by_other_process - pid = Process.fork do - yield + private + def by_other_process + pid = Process.fork do + yield + end + Process.waitpid pid end - Process.waitpid pid - end end private From null+ranguba at clear-code.com Tue Apr 17 09:45:51 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 17 Apr 2012 18:45:51 +0900 Subject: [groonga-commit:4364] ranguba/rroonga [master] Use parentheses to call a method Message-ID: <20120417094620.9FEE59A0A9@jenkins.clear-code.com> Ryo Onodera 2012-04-17 18:45:51 +0900 (Tue, 17 Apr 2012) New Revision: d179f725db62f6b1bc338c4bbb12126cf45c032c Log: Use parentheses to call a method Modified files: test/test-table.rb Modified: test/test-table.rb (+1 -1) =================================================================== --- test/test-table.rb 2012-04-17 18:36:39 +0900 (7908a49) +++ test/test-table.rb 2012-04-17 18:45:51 +0900 (47059b7) @@ -695,7 +695,7 @@ class TableTest < Test::Unit::TestCase pid = Process.fork do yield end - Process.waitpid pid + Process.waitpid(pid) end end From null+ranguba at clear-code.com Tue Apr 17 09:23:50 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 17 Apr 2012 18:23:50 +0900 Subject: [groonga-commit:4365] ranguba/rroonga [master] Define OtherProcessTest to group *_by_other_process tests Message-ID: <20120417094620.6DE439A0A5@jenkins.clear-code.com> Ryo Onodera 2012-04-17 18:23:50 +0900 (Tue, 17 Apr 2012) New Revision: 0558ece84807792abb20f9d40ba9c98928c58277 Log: Define OtherProcessTest to group *_by_other_process tests Modified files: test/test-table.rb Modified: test/test-table.rb (+10 -7) =================================================================== --- test/test-table.rb 2012-04-17 18:18:48 +0900 (f58fba4) +++ test/test-table.rb 2012-04-17 18:23:50 +0900 (267564d) @@ -657,6 +657,7 @@ class TableTest < Test::Unit::TestCase assert_not_predicate(bookmarks, :builtin?) end + class OtherProcessTest < self def test_create_by_other_process by_other_process do Groonga::PatriciaTrie.create(:name => "Bookmarks") @@ -690,6 +691,15 @@ class TableTest < Test::Unit::TestCase end private + def by_other_process + pid = Process.fork do + yield + end + Process.waitpid pid + end + end + + private def create_bookmarks bookmarks = Groonga::Array.create(:name => "Bookmarks") bookmarks.define_column("id", "Int32") @@ -704,11 +714,4 @@ class TableTest < Test::Unit::TestCase end bookmarks end - - def by_other_process - pid = Process.fork do - yield - end - Process.waitpid pid - end end From null+ranguba at clear-code.com Thu Apr 19 00:58:47 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Thu, 19 Apr 2012 09:58:47 +0900 Subject: [groonga-commit:4366] ranguba/rroonga [master] test: move cursor tests to traverse group Message-ID: <20120419010049.C48B89A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-19 09:58:47 +0900 (Thu, 19 Apr 2012) New Revision: ba34efe499ea62828e99e9b5b2f59a7aa226374c Log: test: move cursor tests to traverse group Modified files: test/test-table-cursor.rb Modified: test/test-table-cursor.rb (+3 -1) =================================================================== --- test/test-table-cursor.rb 2012-04-17 18:45:51 +0900 (d583b78) +++ test/test-table-cursor.rb 2012-04-19 09:58:47 +0900 (e33e774) @@ -13,7 +13,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -class TableCursorTest < Test::Unit::TestCase +class TableTraverseTest < Test::Unit::TestCase include GroongaTestUtils def setup @@ -27,6 +27,7 @@ class TableCursorTest < Test::Unit::TestCase @ruby_bookmark = @bookmarks.add("Ruby") end + class CursorTest < self def test_open keys = [] @bookmarks.open_cursor do |cursor| @@ -169,6 +170,7 @@ class TableCursorTest < Test::Unit::TestCase "http://www.ruby-lang.org/"], keys) end + end private def create_users From null+ranguba at clear-code.com Thu Apr 19 01:05:16 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Thu, 19 Apr 2012 10:05:16 +0900 Subject: [groonga-commit:4367] ranguba/rroonga [master] test: indent Message-ID: <20120419010527.136FB9A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-19 10:05:16 +0900 (Thu, 19 Apr 2012) New Revision: d2f3827984fc9d3ec160c8dcf856cddfc6545b4b Log: test: indent Modified files: test/test-table-cursor.rb Modified: test/test-table-cursor.rb (+112 -112) =================================================================== --- test/test-table-cursor.rb 2012-04-19 09:58:47 +0900 (e33e774) +++ test/test-table-cursor.rb 2012-04-19 10:05:16 +0900 (2ae5e6b) @@ -28,148 +28,148 @@ class TableTraverseTest < Test::Unit::TestCase end class CursorTest < self - def test_open - keys = [] - @bookmarks.open_cursor do |cursor| - while cursor.next - keys << cursor.key + def test_open + keys = [] + @bookmarks.open_cursor do |cursor| + while cursor.next + keys << cursor.key + end end + assert_equal(["Cutter", "Ruby", "groonga"], + keys) end - assert_equal(["Cutter", "Ruby", "groonga"], - keys) - end - def test_open_ascendent - record_and_key_list = [] - @bookmarks.open_cursor(:order => :ascending) do |cursor| - record_and_key_list = cursor.collect {|record| [record, cursor.key]} + def test_open_ascendent + record_and_key_list = [] + @bookmarks.open_cursor(:order => :ascending) do |cursor| + record_and_key_list = cursor.collect {|record| [record, cursor.key]} + end + assert_equal([[@cutter_bookmark, "Cutter"], + [@ruby_bookmark, "Ruby"], + [@groonga_bookmark, "groonga"]], + record_and_key_list) end - assert_equal([[@cutter_bookmark, "Cutter"], - [@ruby_bookmark, "Ruby"], - [@groonga_bookmark, "groonga"]], - record_and_key_list) - end - def test_without_limit_and_offset - users = create_users - add_users(users) - results = [] - users.open_cursor do |cursor| - cursor.each do |record| - results << record["name"] + def test_without_limit_and_offset + users = create_users + add_users(users) + results = [] + users.open_cursor do |cursor| + cursor.each do |record| + results << record["name"] + end end - end - assert_equal((100..199).collect {|i| "user#{i}"}, - results) - end + assert_equal((100..199).collect {|i| "user#{i}"}, + results) + end - def test_with_limit - users = create_users - add_users(users) - results = [] - users.open_cursor(:limit => 20) do |cursor| - cursor.each do |record| - results << record["name"] + def test_with_limit + users = create_users + add_users(users) + results = [] + users.open_cursor(:limit => 20) do |cursor| + cursor.each do |record| + results << record["name"] + end end - end - assert_equal((100...120).collect {|i| "user#{i}"}, - results) - end + assert_equal((100...120).collect {|i| "user#{i}"}, + results) + end - def test_with_offset - users = create_users - add_users(users) - results = [] - users.open_cursor(:offset => 20) do |cursor| - cursor.each do |record| - results << record["name"] + def test_with_offset + users = create_users + add_users(users) + results = [] + users.open_cursor(:offset => 20) do |cursor| + cursor.each do |record| + results << record["name"] + end end - end - assert_equal((120...200).collect {|i| "user#{i}"}, - results) - end + assert_equal((120...200).collect {|i| "user#{i}"}, + results) + end - def test_with_limit_and_offset - users = create_users - add_users(users) - results = [] - users.open_cursor(:limit => 20, :offset => 20) do |cursor| - cursor.each do |record| - results << record["name"] + def test_with_limit_and_offset + users = create_users + add_users(users) + results = [] + users.open_cursor(:limit => 20, :offset => 20) do |cursor| + cursor.each do |record| + results << record["name"] + end end - end - assert_equal((120...140).collect {|i| "user#{i}"}, - results) - end + assert_equal((120...140).collect {|i| "user#{i}"}, + results) + end - def test_delete - users = create_users - add_users(users) + def test_delete + users = create_users + add_users(users) - users.open_cursor(:limit => 20) do |cursor| - 20.times do - cursor.next - cursor.delete + users.open_cursor(:limit => 20) do |cursor| + 20.times do + cursor.next + cursor.delete + end end - end - results = [] - users.open_cursor do |cursor| - cursor.each do |record| - results << record["name"] + results = [] + users.open_cursor do |cursor| + cursor.each do |record| + results << record["name"] + end end - end - assert_equal((120...200).collect {|i| "user#{i}"}, - results) - end + assert_equal((120...200).collect {|i| "user#{i}"}, + results) + end - def test_patricia_trie_cursor_key - sites = Groonga::PatriciaTrie.create(:name => "Sites") - sites.add("http://groonga.org/") - sites.open_cursor do |cursor| - cursor.next - assert_equal("http://groonga.org/", cursor.key) + def test_patricia_trie_cursor_key + sites = Groonga::PatriciaTrie.create(:name => "Sites") + sites.add("http://groonga.org/") + sites.open_cursor do |cursor| + cursor.next + assert_equal("http://groonga.org/", cursor.key) + end end - end - def test_order_by_id - sites = Groonga::PatriciaTrie.create(:name => "Sites") - sites.add("http://qwik.jp/senna/") - sites.add("http://www.ruby-lang.org/") - sites.add("http://groonga.org/") - keys = [] - sites.open_cursor(:order_by => :id) do |cursor| - while cursor.next - keys << cursor.key + def test_order_by_id + sites = Groonga::PatriciaTrie.create(:name => "Sites") + sites.add("http://qwik.jp/senna/") + sites.add("http://www.ruby-lang.org/") + sites.add("http://groonga.org/") + keys = [] + sites.open_cursor(:order_by => :id) do |cursor| + while cursor.next + keys << cursor.key + end end + assert_equal(["http://qwik.jp/senna/", + "http://www.ruby-lang.org/", + "http://groonga.org/"], + keys) end - assert_equal(["http://qwik.jp/senna/", - "http://www.ruby-lang.org/", - "http://groonga.org/"], - keys) - end - def test_order_by_key - sites = Groonga::PatriciaTrie.create(:name => "Sites") - sites.add("http://www.ruby-lang.org/") - sites.add("http://qwik.jp/senna/") - sites.add("http://groonga.org/") - keys = [] - sites.open_cursor(:order_by => :key) do |cursor| - while cursor.next - keys << cursor.key + def test_order_by_key + sites = Groonga::PatriciaTrie.create(:name => "Sites") + sites.add("http://www.ruby-lang.org/") + sites.add("http://qwik.jp/senna/") + sites.add("http://groonga.org/") + keys = [] + sites.open_cursor(:order_by => :key) do |cursor| + while cursor.next + keys << cursor.key + end end + assert_equal(["http://groonga.org/", + "http://qwik.jp/senna/", + "http://www.ruby-lang.org/"], + keys) end - assert_equal(["http://groonga.org/", - "http://qwik.jp/senna/", - "http://www.ruby-lang.org/"], - keys) - end end private From null+ranguba at clear-code.com Thu Apr 19 01:05:53 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Thu, 19 Apr 2012 10:05:53 +0900 Subject: [groonga-commit:4368] ranguba/rroonga [master] test: use suitable file name Message-ID: <20120419010604.A35C59A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-19 10:05:53 +0900 (Thu, 19 Apr 2012) New Revision: eb2447e7c746458202e9b93874dd35b9a196877c Log: test: use suitable file name test-table-cursor -> test-table-traverse Renamed files: test/test-table-traverse.rb (from test/test-table-cursor.rb) Renamed: test/test-table-traverse.rb (+0 -0) 100% =================================================================== From null+ranguba at clear-code.com Thu Apr 19 01:22:10 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Thu, 19 Apr 2012 10:22:10 +0900 Subject: [groonga-commit:4369] ranguba/rroonga [master] test: use suitable name Message-ID: <20120419012221.C17549A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-19 10:22:10 +0900 (Thu, 19 Apr 2012) New Revision: cb04c040892a8ea26f25852d056da9205ea16a0c Log: test: use suitable name Modified files: test/test-table-traverse.rb Modified: test/test-table-traverse.rb (+1 -1) =================================================================== --- test/test-table-traverse.rb 2012-04-19 10:05:53 +0900 (2ae5e6b) +++ test/test-table-traverse.rb 2012-04-19 10:22:10 +0900 (3b0ead5) @@ -28,7 +28,7 @@ class TableTraverseTest < Test::Unit::TestCase end class CursorTest < self - def test_open + def test_default keys = [] @bookmarks.open_cursor do |cursor| while cursor.next From null+ranguba at clear-code.com Thu Apr 19 01:23:09 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Thu, 19 Apr 2012 10:23:09 +0900 Subject: [groonga-commit:4370] ranguba/rroonga [master] test: use consistent name Message-ID: <20120419012320.2CABE9A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-19 10:23:09 +0900 (Thu, 19 Apr 2012) New Revision: 5e35c7f5092bd64bfcbc1556a6041c41e9dafe8c Log: test: use consistent name Modified files: test/test-table-traverse.rb Modified: test/test-table-traverse.rb (+1 -1) =================================================================== --- test/test-table-traverse.rb 2012-04-19 10:22:10 +0900 (3b0ead5) +++ test/test-table-traverse.rb 2012-04-19 10:23:09 +0900 (93263aa) @@ -39,7 +39,7 @@ class TableTraverseTest < Test::Unit::TestCase keys) end - def test_open_ascendent + def test_order_ascending record_and_key_list = [] @bookmarks.open_cursor(:order => :ascending) do |cursor| record_and_key_list = cursor.collect {|record| [record, cursor.key]} From null+ranguba at clear-code.com Thu Apr 19 01:27:53 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Thu, 19 Apr 2012 10:27:53 +0900 Subject: [groonga-commit:4371] ranguba/rroonga [master] table: each supports options that are the same as open_cursor's one Message-ID: <20120419012817.B2C139A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-19 10:27:53 +0900 (Thu, 19 Apr 2012) New Revision: 8c69d8f377280938ce00b02ae27b6a34a89302fd Log: table: each supports options that are the same as open_cursor's one Modified files: ext/groonga/rb-grn-table.c test/test-table-traverse.rb test/test-table.rb Modified: ext/groonga/rb-grn-table.c (+8 -10) =================================================================== --- ext/groonga/rb-grn-table.c 2012-04-19 10:23:09 +0900 (d6d71c4) +++ ext/groonga/rb-grn-table.c 2012-04-19 10:27:53 +0900 (3ff6502) @@ -919,12 +919,15 @@ rb_grn_table_truncate (VALUE self) /* * call-seq: - * table.each {|record| } -> nil + * table.each {|record| } -> nil + * table.each(options={}) {|record| } -> nil * * ???????????????????????????? + * + * _options_ is the same as #open_cursor's one. */ static VALUE -rb_grn_table_each (VALUE self) +rb_grn_table_each (int argc, VALUE *argv, VALUE self) { RbGrnTable *rb_table; RbGrnObject *rb_grn_object; @@ -934,14 +937,9 @@ rb_grn_table_each (VALUE self) VALUE rb_cursor; grn_id id; - rb_table = SELF(self); - rb_grn_table_deconstruct(rb_table, &table, &context, - NULL, NULL, - NULL, NULL, NULL, - NULL); - cursor = grn_table_cursor_open(context, table, NULL, 0, NULL, 0, - 0, -1, GRN_CURSOR_ASCENDING); + cursor = rb_grn_table_open_grn_cursor(argc, argv, self, &context); rb_cursor = GRNTABLECURSOR2RVAL(Qnil, context, cursor); + rb_table = SELF(self); rb_grn_object = RB_GRN_OBJECT(rb_table); while (rb_grn_object->object && (id = grn_table_cursor_next(context, cursor)) != GRN_ID_NIL) { @@ -2176,7 +2174,7 @@ rb_grn_init_table (VALUE mGrn) rb_define_method(rb_cGrnTable, "empty?", rb_grn_table_empty_p, 0); rb_define_method(rb_cGrnTable, "truncate", rb_grn_table_truncate, 0); - rb_define_method(rb_cGrnTable, "each", rb_grn_table_each, 0); + rb_define_method(rb_cGrnTable, "each", rb_grn_table_each, -1); rb_define_method(rb_cGrnTable, "delete", rb_grn_table_delete, 1); Modified: test/test-table-traverse.rb (+108 -0) =================================================================== --- test/test-table-traverse.rb 2012-04-19 10:23:09 +0900 (93263aa) +++ test/test-table-traverse.rb 2012-04-19 10:27:53 +0900 (95ae23f) @@ -172,6 +172,114 @@ class TableTraverseTest < Test::Unit::TestCase end end + class EachTest < self + def test_default + keys = [] + @bookmarks.each do |record| + keys << record.key + end + assert_equal(["Cutter", "Ruby", "groonga"], + keys) + end + + def test_order_ascending + record_and_key_list = [] + @bookmarks.each(:order => :ascending) do |record| + record_and_key_list << [record, record.key] + end + assert_equal([[@cutter_bookmark, "Cutter"], + [@ruby_bookmark, "Ruby"], + [@groonga_bookmark, "groonga"]], + record_and_key_list) + end + + def test_without_limit_and_offset + users = create_users + add_users(users) + results = [] + users.each do |record| + results << record["name"] + end + + assert_equal((100..199).collect {|i| "user#{i}"}, + results) + end + + def test_with_limit + users = create_users + add_users(users) + results = [] + users.each(:limit => 20) do |record| + results << record["name"] + end + + assert_equal((100...120).collect {|i| "user#{i}"}, + results) + end + + def test_with_offset + users = create_users + add_users(users) + results = [] + users.each(:offset => 20) do |record| + results << record["name"] + end + + assert_equal((120...200).collect {|i| "user#{i}"}, + results) + end + + def test_with_limit_and_offset + users = create_users + add_users(users) + results = [] + users.each(:limit => 20, :offset => 20) do |record| + results << record["name"] + end + + assert_equal((120...140).collect {|i| "user#{i}"}, + results) + end + + def test_patricia_trie_cursor_key + sites = Groonga::PatriciaTrie.create(:name => "Sites") + sites.add("http://groonga.org/") + sites.each do |record| + assert_equal("http://groonga.org/", record.key) + end + end + + def test_order_by_id + sites = Groonga::PatriciaTrie.create(:name => "Sites") + sites.add("http://qwik.jp/senna/") + sites.add("http://www.ruby-lang.org/") + sites.add("http://groonga.org/") + keys = [] + sites.each(:order_by => :id) do |record| + keys << record.key + end + assert_equal(["http://qwik.jp/senna/", + "http://www.ruby-lang.org/", + "http://groonga.org/"], + keys) + end + + def test_order_by_key + sites = Groonga::PatriciaTrie.create(:name => "Sites") + sites.add("http://www.ruby-lang.org/") + sites.add("http://qwik.jp/senna/") + sites.add("http://groonga.org/") + keys = [] + sites.each(:order_by => :key) do |record| + keys << record.key + end + assert_equal(["http://groonga.org/", + "http://qwik.jp/senna/", + "http://www.ruby-lang.org/"], + keys) + end + end + private def create_users users = Groonga::Array.create(:name => "Users") Modified: test/test-table.rb (+0 -13) =================================================================== --- test/test-table.rb 2012-04-19 10:23:09 +0900 (47059b7) +++ test/test-table.rb 2012-04-19 10:27:53 +0900 (798715f) @@ -284,19 +284,6 @@ class TableTest < Test::Unit::TestCase assert_equal(1, table.size) end - def test_each - users = Groonga::Array.create(:name => "Users") - users.define_column("name", "ShortText") - - names = ["daijiro", "gunyarakun", "yu"] - names.each do |name| - user = users.add - user["name"] = name - end - - assert_equal(names.sort, users.collect {|user| user["name"]}.sort) - end - def test_truncate users = Groonga::Array.create(:name => "Users") users.add From null+ranguba at clear-code.com Thu Apr 19 09:02:40 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Thu, 19 Apr 2012 18:02:40 +0900 Subject: [groonga-commit:4372] ranguba/rroonga [master] grndump: add --order-by=id option Message-ID: <20120419090252.303B29A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-19 18:02:40 +0900 (Thu, 19 Apr 2012) New Revision: 71a230bc5c2fdabff057704102a100b30a358b93 Log: grndump: add --order-by=id option fixes #1341 Modified files: bin/grndump lib/groonga/dumper.rb test/test-table-dumper.rb Modified: bin/grndump (+11 -1) =================================================================== --- bin/grndump 2012-04-19 10:27:53 +0900 (dcc7a31) +++ bin/grndump 2012-04-19 18:02:40 +0900 (4d6ab5e) @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # -*- coding: utf-8 -*- # -# Copyright (C) 2011 Kouhei Sutou +# Copyright (C) 2011-2012 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -27,6 +27,7 @@ options.tables = [] options.exclude_tables = [] options.dump_schema = true options.dump_tables = true +options.order_by = "id" option_parser = OptionParser.new do |parser| parser.banner += " DB_PATH" @@ -63,6 +64,14 @@ option_parser = OptionParser.new do |parser| options.exclude_tables << table end end + + types = ["id", "key"] + parser.on("--order-by=TYPE", types, + "sort output recoreds by TYPE.", + "available TYPEs: #{types.join(', ')}", + "(#{options.type})") do |type| + options.order_by = type + end end args = option_parser.parse!(ARGV) @@ -80,6 +89,7 @@ dumper_options = { :dump_tables => options.dump_tables, :tables => options.tables, :exclude_tables => options.exclude_tables, + :order_by => options.order_by, } database_dumper = Groonga::DatabaseDumper.new(dumper_options) database_dumper.dump Modified: lib/groonga/dumper.rb (+2 -2) =================================================================== --- lib/groonga/dumper.rb 2012-04-19 10:27:53 +0900 (54bfda3) +++ lib/groonga/dumper.rb 2012-04-19 18:02:40 +0900 (caa79fa) @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2011 Kouhei Sutou +# Copyright (C) 2011-2012 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -479,7 +479,7 @@ module Groonga end def dump_records(columns) - @table.each do |record| + @table.each(:order_by => @options[:order_by]) do |record| write(",\n") values = columns.collect do |column| resolve_value(column[record.id]) Modified: test/test-table-dumper.rb (+34 -4) =================================================================== --- test/test-table-dumper.rb 2012-04-19 10:27:53 +0900 (35ddaa2) +++ test/test-table-dumper.rb 2012-04-19 18:02:40 +0900 (2c7256a) @@ -1,4 +1,4 @@ -# Copyright (C) 2011 Kouhei Sutou +# Copyright (C) 2011-2012 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -25,7 +25,7 @@ class TableDumperTest < Test::Unit::TestCase def setup_tables Groonga::Schema.define do |schema| schema.create_table("Users", - :type => :hash, + :type => :patricia_trie, :key_type => "ShortText") do |table| table.text("name") end @@ -72,9 +72,39 @@ load --table Posts EOS end + def test_patricia_trie_order_by_default + users.add("s-yata", :name => "Susumu Yata") + users.add("mori", :name => "mori daijiro") + assert_equal(<<-EOS, dump("Users")) +load --table Users +[ +[\"_key\",\"name\"], +[\"mori\",\"mori daijiro\"], +[\"s-yata\",\"Susumu Yata\"] +] +EOS + end + + def test_patricia_trie_order_by_id + users.add("s-yata", :name => "Susumu Yata") + users.add("mori", :name => "mori daijiro") + assert_equal(<<-EOS, dump("Users", :order_by => "id")) +load --table Users +[ +[\"_key\",\"name\"], +[\"s-yata\",\"Susumu Yata\"], +[\"mori\",\"mori daijiro\"] +] +EOS + end + private - def dump(table_name) - Groonga::TableDumper.new(context[table_name]).dump + def dump(table_name, options={}) + Groonga::TableDumper.new(context[table_name], options).dump + end + + def users + context["Users"] end def posts From null+ranguba at clear-code.com Mon Apr 23 23:02:55 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 24 Apr 2012 08:02:55 +0900 Subject: [groonga-commit:4373] ranguba/rroonga [master] Merge pull request #6 from ongaeshi/master Message-ID: <20120423230300.7ADDC9A0A8@jenkins.clear-code.com> Kouhei Sutou 2012-04-24 08:02:55 +0900 (Tue, 24 Apr 2012) New Revision: ecc80c931c0e3fd4b4544c8d6be6f479bdc852d7 Log: Merge pull request #6 from ongaeshi/master Support building rroonga on Windows Patch by @ongaeshi. Thanks!!! From null+ranguba at clear-code.com Mon Apr 23 16:28:22 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 24 Apr 2012 01:28:22 +0900 Subject: [groonga-commit:4374] ranguba/rroonga [master] Can be compiled in the RubyInstaller for Windows with DevKit Message-ID: <20120423230300.5F3749A0A5@jenkins.clear-code.com> ongaeshi 2012-04-24 01:28:22 +0900 (Tue, 24 Apr 2012) New Revision: 4d2e68d8d6b779ddb8f1796894720c62f663711a Merged ecc80c9: Merge pull request #6 from ongaeshi/master Log: Can be compiled in the RubyInstaller for Windows with DevKit Modified files: Gemfile ext/groonga/extconf.rb Modified: Gemfile (+1 -0) =================================================================== --- Gemfile 2012-04-19 18:02:40 +0900 (c4b6d87) +++ Gemfile 2012-04-24 01:28:22 +0900 (edf845b) @@ -19,6 +19,7 @@ source "http://rubygems.org/" gem 'pkg-config' gem 'json' +gem 'archive-zip' group :development, :test do gem "test-unit", ">= 2.4.6" Modified: ext/groonga/extconf.rb (+121 -44) =================================================================== --- ext/groonga/extconf.rb 2012-04-19 18:02:40 +0900 (035bc31) +++ ext/groonga/extconf.rb 2012-04-24 01:28:22 +0900 (8f22f22) @@ -46,8 +46,12 @@ checking_for(checking_message("GCC")) do end end +def win32? + /cygwin|mingw|mswin/ =~ RUBY_PLATFORM +end + checking_for(checking_message("Win32 OS")) do - win32 = /cygwin|mingw|mswin/ =~ RUBY_PLATFORM + win32 = win32? if win32 $defs << "-DRB_GRN_PLATFORM_WIN32" import_library_name = "libruby-#{module_name}.a" @@ -65,65 +69,138 @@ def install_groonga_locally(major, minor, micro) require 'open-uri' require 'shellwords' - tar_gz = "groonga-#{major}.#{minor}.#{micro}.tar.gz" FileUtils.mkdir_p(local_groonga_base_dir) - install_dir = local_groonga_install_dir Dir.chdir(local_groonga_base_dir) do - url = "http://packages.groonga.org/source/groonga/#{tar_gz}" - message("downloading %s...", url) - open(url, "rb") do |input| - File.open(tar_gz, "wb") do |output| - while (buffer = input.read(1024)) - output.print(buffer) - end + unless win32? + install_groonga_locally_with_compile(major, minor, micro) + else + install_groonga_locally_win32(major, minor, micro) + end + end + + prepend_pkg_config_path_for_local_groonga +end + +begin + require 'archive/zip' +rescue LoadError + require 'rubygems' + require 'archive/zip' +end + +def zip_extract(filename, dst_dir) + return nil unless File.exist?(filename) + + root_list = root_entrylist(filename) + + if (root_list.size == 1) + Archive::Zip.extract filename, dst_dir + return root_list[0].gsub("/", "") + else + dir = File.basename(filename).sub(/#{File.extname(filename)}$/, "") + FileUtils.mkdir_p File.join(dst_dir, dir) + Archive::Zip.extract filename, File.join(dst_dir, dir) + return dir + end +end + +def root_entrylist(filename) + list = [] + + Archive::Zip.open(filename) do |archive| + archive.each do |entry| + list << entry.zip_path if entry.zip_path.split('/').size == 1 + end + end + + list +end + +def install_groonga_locally_win32(major, minor, micro) + file_name = "groonga-#{major}.#{minor}.#{micro}-x86.zip" + # file_name = "groonga-#{major}.#{minor}.#{micro}-x64.zip" + url = "http://packages.groonga.org/windows/groonga/#{file_name}" + install_dir = local_groonga_install_dir + + message("downloading %s...", url) + open(url, "rb") do |input| + File.open(file_name, "wb") do |output| + while (buffer = input.read(1024)) + output.print(buffer) + end + end + end + message(" done\n") + + message("extracting...\n") + zip_extract(file_name, '.') + + require 'fileutils' + if File.exist?(install_dir) + message("remove old install...\n") + FileUtils.rm_r(install_dir) + end + + message("install...\n") + FileUtils.mv(File.basename(file_name, ".zip"), File.basename(install_dir)) +end + +def install_groonga_locally_with_compile(major, minor, micro) + tar_gz = "groonga-#{major}.#{minor}.#{micro}.tar.gz" + url = "http://packages.groonga.org/source/groonga/#{tar_gz}" + install_dir = local_groonga_install_dir + + message("downloading %s...", url) + open(url, "rb") do |input| + File.open(tar_gz, "wb") do |output| + while (buffer = input.read(1024)) + output.print(buffer) end end + end + message(" done\n") + + message("extracting...") + if xsystem("tar xfz #{tar_gz}") message(" done\n") + else + message(" failed\n") + exit 1 + end - message("extracting...") - if xsystem("tar xfz #{tar_gz}") + groonga_source_dir = "groonga-#{major}.#{minor}.#{micro}" + Dir.chdir(groonga_source_dir) do + message("configuring...") + prefix = Shellwords.escape(install_dir) + if xsystem("./configure CFLAGS='-g -O0' --prefix=#{prefix}") message(" done\n") else message(" failed\n") exit 1 end - groonga_source_dir = "groonga-#{major}.#{minor}.#{micro}" - Dir.chdir(groonga_source_dir) do - message("configuring...") - prefix = Shellwords.escape(install_dir) - if xsystem("./configure CFLAGS='-g -O0' --prefix=#{prefix}") - message(" done\n") - else - message(" failed\n") - exit 1 - end - - message("building (maybe long time)...") - if xsystem("make") - message(" done\n") - else - message(" failed\n") - exit 1 - end + message("building (maybe long time)...") + if xsystem("make") + message(" done\n") + else + message(" failed\n") + exit 1 + end - message("installing...") - if [major, minor, micro] == [0, 1, 6] - make_install_args = " MKDIR_P='mkdir -p --'" - else - make_install_args = "" - end - if xsystem("make install#{make_install_args}") - message(" done\n") - else - message(" failed\n") - exit 1 - end + message("installing...") + if [major, minor, micro] == [0, 1, 6] + make_install_args = " MKDIR_P='mkdir -p --'" + else + make_install_args = "" + end + if xsystem("make install#{make_install_args}") + message(" done\n") + else + message(" failed\n") + exit 1 end end - - prepend_pkg_config_path_for_local_groonga end unless PKGConfig.have_package(package_name, major, minor, micro) From null+ranguba at clear-code.com Tue Apr 24 14:32:58 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 24 Apr 2012 23:32:58 +0900 Subject: [groonga-commit:4375] ranguba/rroonga [master] Build groonga without debug flags by default Message-ID: <20120424143318.8BDF89A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-24 23:32:58 +0900 (Tue, 24 Apr 2012) New Revision: c5943ad8568cc2784a78739472f1c1ec6c19e00e Log: Build groonga without debug flags by default Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+13 -2) =================================================================== --- ext/groonga/extconf.rb 2012-04-24 08:02:55 +0900 (8f22f22) +++ ext/groonga/extconf.rb 2012-04-24 23:32:58 +0900 (3f2de84) @@ -146,6 +146,18 @@ def install_groonga_locally_win32(major, minor, micro) FileUtils.mv(File.basename(file_name, ".zip"), File.basename(install_dir)) end +def configure_command_line(prefix) + command_line = ["./configure"] + debug_build_p = ENV["DEBUG_BUILD"] == "yes" + debug_flags = ["CFLAGS=-ggdb3 -O0", "CXXFLAGS=-ggdb3 -O0"] + command_line.concat(debug_flags) if debug_build_p + command_line << "--prefix=#{prefix}" + escaped_command_line = command_line.collect do |command| + Shellwords.escape(command) + end + escaped_command_line.join(" ") +end + def install_groonga_locally_with_compile(major, minor, micro) tar_gz = "groonga-#{major}.#{minor}.#{micro}.tar.gz" url = "http://packages.groonga.org/source/groonga/#{tar_gz}" @@ -172,8 +184,7 @@ def install_groonga_locally_with_compile(major, minor, micro) groonga_source_dir = "groonga-#{major}.#{minor}.#{micro}" Dir.chdir(groonga_source_dir) do message("configuring...") - prefix = Shellwords.escape(install_dir) - if xsystem("./configure CFLAGS='-g -O0' --prefix=#{prefix}") + if xsystem(configure_command_line(install_dir)) message(" done\n") else message(" failed\n") From null+ranguba at clear-code.com Tue Apr 24 14:33:30 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 24 Apr 2012 23:33:30 +0900 Subject: [groonga-commit:4376] ranguba/rroonga [master] Remove trailing spaces Message-ID: <20120424143342.ED4199A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-24 23:33:30 +0900 (Tue, 24 Apr 2012) New Revision: b6ea47ba72fa8bbf961eac3de4012156746b0c52 Log: Remove trailing spaces Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+4 -4) =================================================================== --- ext/groonga/extconf.rb 2012-04-24 23:32:58 +0900 (3f2de84) +++ ext/groonga/extconf.rb 2012-04-24 23:33:30 +0900 (874bf74) @@ -91,9 +91,9 @@ end def zip_extract(filename, dst_dir) return nil unless File.exist?(filename) - + root_list = root_entrylist(filename) - + if (root_list.size == 1) Archive::Zip.extract filename, dst_dir return root_list[0].gsub("/", "") @@ -107,7 +107,7 @@ end def root_entrylist(filename) list = [] - + Archive::Zip.open(filename) do |archive| archive.each do |entry| list << entry.zip_path if entry.zip_path.split('/').size == 1 @@ -162,7 +162,7 @@ def install_groonga_locally_with_compile(major, minor, micro) tar_gz = "groonga-#{major}.#{minor}.#{micro}.tar.gz" url = "http://packages.groonga.org/source/groonga/#{tar_gz}" install_dir = local_groonga_install_dir - + message("downloading %s...", url) open(url, "rb") do |input| File.open(tar_gz, "wb") do |output| From null+ranguba at clear-code.com Tue Apr 24 15:06:58 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:06:58 +0900 Subject: [groonga-commit:4377] ranguba/rroonga [master] Add gemspec Message-ID: <20120424150713.C4B169A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:06:58 +0900 (Wed, 25 Apr 2012) New Revision: 2cbb317901913d7d219506a929abfbe0657d4fe0 Log: Add gemspec Added files: rroonga.gemspec Modified files: .gitignore Gemfile Modified: .gitignore (+1 -1) =================================================================== --- .gitignore 2012-04-24 23:33:30 +0900 (9c15803) +++ .gitignore 2012-04-25 00:06:58 +0900 (25d465c) @@ -14,7 +14,7 @@ /tmp /vendor *.so -/*.gemspec +/Gemfile.lock /doc/po/rroonga.pot /.yardoc/ /references/ Modified: Gemfile (+1 -13) =================================================================== --- Gemfile 2012-04-24 23:33:30 +0900 (edf845b) +++ Gemfile 2012-04-25 00:06:58 +0900 (4a80f18) @@ -17,16 +17,4 @@ source "http://rubygems.org/" -gem 'pkg-config' -gem 'json' -gem 'archive-zip' - -group :development, :test do - gem "test-unit", ">= 2.4.6" - gem "test-unit-notify" - gem "rake" - gem "rake-compiler" - gem "jeweler" - gem "yard" - gem "packnga" -end +gemspec Added: rroonga.gemspec (+87 -0) 100644 =================================================================== --- /dev/null +++ rroonga.gemspec 2012-04-25 00:06:58 +0900 (6446f8e) @@ -0,0 +1,87 @@ +# -*- mode: ruby; coding: utf-8 -*- +# +# Copyright (C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1 as published by the Free Software Foundation. +# +# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +base_dir = File.dirname(__FILE__) +ext_dir = File.join(base_dir, "ext", "groonga") + +guess_version = lambda do |ext_dir| + version = {} + File.open(File.join(ext_dir, "rb-grn.h")) do |rb_grn_h| + rb_grn_h.each_line do |line| + case line + when /\A#define RB_GRN_([A-Z]+)_VERSION (\d+)/ + version[$1.downcase] = $2 + end + end + end + [version["major"], version["minor"], version["micro"]].join(".") +end + +clean_white_space = lambda do |entry| + entry.gsub(/(\A\n+|\n+\z)/, '') + "\n" +end + +Gem::Specification.new do |s| + s.name = "rroonga" + s.version = guess_version.call(ext_dir) + + authors_path = File.join(base_dir, "AUTHORS") + authors, emails = File.readlines(authors_path).collect do |line| + if /\s*<([^<>]*)>$/ =~ line + [$PREMATCH, $1] + else + nil + end + end.compact + s.authors = authors + s.email = emails + + readme_path = File.join(base_dir, "README.textile") + entries = File.read(readme_path).split(/^h2\.\s(.*)$/) + description = clean_white_space.call(entries[entries.index("Description") + 1]) + s.summary, s.description, = description.split(/\n\n+/, 3) + + s.files = ["README.textile", "AUTHORS", "Rakefile", "Gemfile"] + s.files += ["rroonga-build.rb", "extconf.rb"] + Dir.chdir(base_dir) do + s.files += Dir.glob("{lib,benchmark,misc,example}/**/*.rb") + s.files += Dir.glob("ext/**/*.{c,h,rb,def}") + s.extensions = ["ext/groonga/extconf.rb"] + s.extra_rdoc_files = ["README.textile"] + s.test_files = Dir.glob("text/**/*.rb") + Dir.chdir("bin") do + s.executables = Dir.glob("*") + end + end + + s.homepage = "http://groonga.rubyforge.org/#about-rroonga" + s.licenses = ["LGPLv2"] + s.require_paths = ["lib"] + s.rubyforge_project = "groonga" + + s.add_runtime_dependency("pkg-config") + s.add_runtime_dependency("json") + s.add_runtime_dependency("archive-zip") + s.add_development_dependency("test-unit", [">= 2.4.6"]) + s.add_development_dependency("test-unit-notify") + s.add_development_dependency("rake") + s.add_development_dependency("rake-compiler") + s.add_development_dependency("jeweler") + s.add_development_dependency("yard") + s.add_development_dependency("packnga") +end + From null+ranguba at clear-code.com Tue Apr 24 15:10:29 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:10:29 +0900 Subject: [groonga-commit:4378] ranguba/rroonga [master] Jeweler -> Bundler Message-ID: <20120424151044.298519A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:10:29 +0900 (Wed, 25 Apr 2012) New Revision: c0b86449fcf7c197e437964694783e133a41e282 Log: Jeweler -> Bundler Modified files: Rakefile rroonga.gemspec Modified: Rakefile (+4 -57) =================================================================== --- Rakefile 2012-04-25 00:06:58 +0900 (8e699c5) +++ Rakefile 2012-04-25 00:10:29 +0900 (0f002e0) @@ -24,7 +24,7 @@ require 'erb' require 'rubygems' require 'rubygems/package_task' require 'yard' -require 'jeweler' +require 'bundler/gem_helper' require 'rake/extensiontask' require 'packnga' @@ -43,62 +43,9 @@ $LOAD_PATH.unshift(groonga_ext_dir) $LOAD_PATH.unshift(groonga_lib_dir) ENV["RUBYLIB"] = "#{groonga_lib_dir}:#{groonga_ext_dir}:#{ENV['RUBYLIB']}" -def guess_version(groonga_ext_dir) - version = {} - File.open(File.join(groonga_ext_dir, "rb-grn.h")) do |rb_grn_h| - rb_grn_h.each_line do |line| - case line - when /\A#define RB_GRN_([A-Z]+)_VERSION (\d+)/ - version[$1.downcase] = $2 - end - end - end - [version["major"], version["minor"], version["micro"]].join(".") -end - -def cleanup_white_space(entry) - entry.gsub(/(\A\n+|\n+\z)/, '') + "\n" -end - -ENV["VERSION"] ||= guess_version(groonga_ext_dir) -version = ENV["VERSION"].dup -spec = nil -Jeweler::Tasks.new do |_spec| - spec = _spec - spec.name = "rroonga" - spec.version = version - spec.rubyforge_project = "groonga" - spec.homepage = "http://groonga.rubyforge.org/" - authors = File.join(base_dir, "AUTHORS") - spec.authors = File.readlines(authors).collect do |line| - if /\s*<[^<>]*>$/ =~ line - $PREMATCH - else - nil - end - end.compact - spec.email = [ - 'groonga-users-en at rubyforge.org', - 'groonga-dev at lists.sourceforge.jp', - ] - entries = File.read("README.textile").split(/^h2\.\s(.*)$/) - description = cleanup_white_space(entries[entries.index("Description") + 1]) - spec.summary, spec.description, = description.split(/\n\n+/, 3) - spec.license = "LGPLv2" - spec.files = FileList["{lib,benchmark,misc}/**/*.rb", - "bin/*", - "extconf.rb", - "rroonga-build.rb", - "example/*.rb", - "Rakefile", - "Gemfile", - "ext/**/*.{c,h,rb,def}"] - spec.test_files = FileList["test/**/*.rb"] -end - -Rake::Task["release"].prerequisites.clear -Jeweler::RubygemsDotOrgTasks.new do -end +helper = Bundler::GemHelper.new(base_dir) +helper.install +spec = helper.gemspec Gem::PackageTask.new(spec) do |pkg| pkg.need_tar_gz = true Modified: rroonga.gemspec (+1 -1) =================================================================== --- rroonga.gemspec 2012-04-25 00:06:58 +0900 (6446f8e) +++ rroonga.gemspec 2012-04-25 00:10:29 +0900 (eb80dbe) @@ -80,7 +80,7 @@ Gem::Specification.new do |s| s.add_development_dependency("test-unit-notify") s.add_development_dependency("rake") s.add_development_dependency("rake-compiler") - s.add_development_dependency("jeweler") + s.add_development_dependency("bundler") s.add_development_dependency("yard") s.add_development_dependency("packnga") end From null+ranguba at clear-code.com Tue Apr 24 15:13:01 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:13:01 +0900 Subject: [groonga-commit:4379] ranguba/rroonga [master] Don't require archive-zip until it's needed Message-ID: <20120424151315.5DBCF9A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:13:01 +0900 (Wed, 25 Apr 2012) New Revision: 824285a7849a2664f686b9daaa0e016d0470fbdf Log: Don't require archive-zip until it's needed Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+8 -8) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:10:29 +0900 (874bf74) +++ ext/groonga/extconf.rb 2012-04-25 00:13:01 +0900 (344a4a2) @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # -# Copyright (C) 2009-2010 Kouhei Sutou +# Copyright (C) 2009-2012 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -82,16 +82,16 @@ def install_groonga_locally(major, minor, micro) prepend_pkg_config_path_for_local_groonga end -begin - require 'archive/zip' -rescue LoadError - require 'rubygems' - require 'archive/zip' -end - def zip_extract(filename, dst_dir) return nil unless File.exist?(filename) + begin + require 'archive/zip' + rescue LoadError + require 'rubygems' + require 'archive/zip' + end + root_list = root_entrylist(filename) if (root_list.size == 1) From null+ranguba at clear-code.com Tue Apr 24 15:14:19 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:14:19 +0900 Subject: [groonga-commit:4380] ranguba/rroonga [master] unless ... else ... -> if ... else ... Message-ID: <20120424151430.CB5CE9A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:14:19 +0900 (Wed, 25 Apr 2012) New Revision: bb1258bb602dea82a1bff151032e72a3f76c3796 Log: unless ... else ... -> if ... else ... Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+3 -3) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:13:01 +0900 (344a4a2) +++ ext/groonga/extconf.rb 2012-04-25 00:14:19 +0900 (6e6a2b4) @@ -72,10 +72,10 @@ def install_groonga_locally(major, minor, micro) FileUtils.mkdir_p(local_groonga_base_dir) Dir.chdir(local_groonga_base_dir) do - unless win32? - install_groonga_locally_with_compile(major, minor, micro) - else + if win32? install_groonga_locally_win32(major, minor, micro) + else + install_groonga_locally_with_compile(major, minor, micro) end end From null+ranguba at clear-code.com Tue Apr 24 15:16:34 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:16:34 +0900 Subject: [groonga-commit:4381] ranguba/rroonga [master] Use false for failure exit status Message-ID: <20120424151647.95ED79A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:16:34 +0900 (Wed, 25 Apr 2012) New Revision: 5561e2ee1c610dd9eacf95a56492ae4c9422a308 Log: Use false for failure exit status Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+4 -4) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:14:19 +0900 (6e6a2b4) +++ ext/groonga/extconf.rb 2012-04-25 00:16:34 +0900 (815e5fe) @@ -178,7 +178,7 @@ def install_groonga_locally_with_compile(major, minor, micro) message(" done\n") else message(" failed\n") - exit 1 + exit(false) end groonga_source_dir = "groonga-#{major}.#{minor}.#{micro}" @@ -188,7 +188,7 @@ def install_groonga_locally_with_compile(major, minor, micro) message(" done\n") else message(" failed\n") - exit 1 + exit(false) end message("building (maybe long time)...") @@ -196,7 +196,7 @@ def install_groonga_locally_with_compile(major, minor, micro) message(" done\n") else message(" failed\n") - exit 1 + exit(false) end message("installing...") @@ -209,7 +209,7 @@ def install_groonga_locally_with_compile(major, minor, micro) message(" done\n") else message(" failed\n") - exit 1 + exit(false) end end end From null+ranguba at clear-code.com Tue Apr 24 15:18:59 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:18:59 +0900 Subject: [groonga-commit:4382] ranguba/rroonga [master] Use meaningful method name Message-ID: <20120424151912.971309A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:18:59 +0900 (Wed, 25 Apr 2012) New Revision: 598981c441a607a32d649b6d13ebcecf78a19fa1 Log: Use meaningful method name Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+4 -4) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:16:34 +0900 (815e5fe) +++ ext/groonga/extconf.rb 2012-04-25 00:18:59 +0900 (7c36815) @@ -73,9 +73,9 @@ def install_groonga_locally(major, minor, micro) Dir.chdir(local_groonga_base_dir) do if win32? - install_groonga_locally_win32(major, minor, micro) + extract_groonga_win32_binary(major, minor, micro) else - install_groonga_locally_with_compile(major, minor, micro) + build_groonga(major, minor, micro) end end @@ -117,7 +117,7 @@ def root_entrylist(filename) list end -def install_groonga_locally_win32(major, minor, micro) +def extract_groonga_win32_binary(major, minor, micro) file_name = "groonga-#{major}.#{minor}.#{micro}-x86.zip" # file_name = "groonga-#{major}.#{minor}.#{micro}-x64.zip" url = "http://packages.groonga.org/windows/groonga/#{file_name}" @@ -158,7 +158,7 @@ def configure_command_line(prefix) escaped_command_line.join(" ") end -def install_groonga_locally_with_compile(major, minor, micro) +def build_groonga(major, minor, micro) tar_gz = "groonga-#{major}.#{minor}.#{micro}.tar.gz" url = "http://packages.groonga.org/source/groonga/#{tar_gz}" install_dir = local_groonga_install_dir From null+ranguba at clear-code.com Tue Apr 24 15:21:15 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:21:15 +0900 Subject: [groonga-commit:4383] ranguba/rroonga [master] Support RROONGA_USE_GROONGA_X64=yes to install 64bit groonga win32 binary Message-ID: <20120424152129.178739A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:21:15 +0900 (Wed, 25 Apr 2012) New Revision: d92bbee381607d3ca44794d776132623c3ddf156 Log: Support RROONGA_USE_GROONGA_X64=yes to install 64bit groonga win32 binary Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+6 -2) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:18:59 +0900 (7c36815) +++ ext/groonga/extconf.rb 2012-04-25 00:21:15 +0900 (2ca88bb) @@ -118,8 +118,12 @@ def root_entrylist(filename) end def extract_groonga_win32_binary(major, minor, micro) - file_name = "groonga-#{major}.#{minor}.#{micro}-x86.zip" - # file_name = "groonga-#{major}.#{minor}.#{micro}-x64.zip" + if ENV["RROONGA_USE_GROONGA_X64"] + architecture = "x64" + else + architecture = "x86" + end + file_name = "groonga-#{major}.#{minor}.#{micro}-#{architecture}.zip" url = "http://packages.groonga.org/windows/groonga/#{file_name}" install_dir = local_groonga_install_dir From null+ranguba at clear-code.com Tue Apr 24 15:22:38 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:22:38 +0900 Subject: [groonga-commit:4384] ranguba/rroonga [master] Don't omit parenthesis Message-ID: <20120424152254.143779A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:22:38 +0900 (Wed, 25 Apr 2012) New Revision: e6d2bd9c57361aaeada08744c93c61742010991d Log: Don't omit parenthesis Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+3 -3) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:21:15 +0900 (2ca88bb) +++ ext/groonga/extconf.rb 2012-04-25 00:22:38 +0900 (cd24420) @@ -95,12 +95,12 @@ def zip_extract(filename, dst_dir) root_list = root_entrylist(filename) if (root_list.size == 1) - Archive::Zip.extract filename, dst_dir + Archive::Zip.extract(filename, dst_dir) return root_list[0].gsub("/", "") else dir = File.basename(filename).sub(/#{File.extname(filename)}$/, "") - FileUtils.mkdir_p File.join(dst_dir, dir) - Archive::Zip.extract filename, File.join(dst_dir, dir) + FileUtils.mkdir_p(File.join(dst_dir, dir)) + Archive::Zip.extract(filename, File.join(dst_dir, dir)) return dir end end From null+ranguba at clear-code.com Tue Apr 24 15:25:39 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:25:39 +0900 Subject: [groonga-commit:4385] ranguba/rroonga [master] Show done messages Message-ID: <20120424152550.D321F9A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:25:39 +0900 (Wed, 25 Apr 2012) New Revision: bb03c51674311dbde9d27460f3388d8e2ef86d6c Log: Show done messages Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+6 -3) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:22:38 +0900 (cd24420) +++ ext/groonga/extconf.rb 2012-04-25 00:25:39 +0900 (33b52e0) @@ -137,17 +137,20 @@ def extract_groonga_win32_binary(major, minor, micro) end message(" done\n") - message("extracting...\n") + message("extracting...") zip_extract(file_name, '.') + message(" done\n") require 'fileutils' if File.exist?(install_dir) - message("remove old install...\n") + message("remove old install...") FileUtils.rm_r(install_dir) + message(" done\n") end - message("install...\n") + message("install...") FileUtils.mv(File.basename(file_name, ".zip"), File.basename(install_dir)) + message(" done\n") end def configure_command_line(prefix) From null+ranguba at clear-code.com Tue Apr 24 15:29:39 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:29:39 +0900 Subject: [groonga-commit:4386] ranguba/rroonga [master] Don't download already downloaded file Message-ID: <20120424152950.136D29A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:29:39 +0900 (Wed, 25 Apr 2012) New Revision: dd496275edcbcff8fbbcc0b1d4a7affdee26d7de Log: Don't download already downloaded file Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+21 -19) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:25:39 +0900 (33b52e0) +++ ext/groonga/extconf.rb 2012-04-25 00:29:39 +0900 (0d0838a) @@ -66,7 +66,6 @@ checking_for(checking_message("Win32 OS")) do end def install_groonga_locally(major, minor, micro) - require 'open-uri' require 'shellwords' FileUtils.mkdir_p(local_groonga_base_dir) @@ -82,6 +81,25 @@ def install_groonga_locally(major, minor, micro) prepend_pkg_config_path_for_local_groonga end +def download(url) + require 'open-uri' + + message("downloading %s...", url) + base_name = File.basename(url) + if File.exist?(base_name) + message(" skip (use downloaded file)\n") + else + open(url, "rb") do |input| + File.open(base_name, "wb") do |output| + while (buffer = input.read(1024)) + output.print(buffer) + end + end + end + message(" done\n") + end +end + def zip_extract(filename, dst_dir) return nil unless File.exist?(filename) @@ -127,15 +145,7 @@ def extract_groonga_win32_binary(major, minor, micro) url = "http://packages.groonga.org/windows/groonga/#{file_name}" install_dir = local_groonga_install_dir - message("downloading %s...", url) - open(url, "rb") do |input| - File.open(file_name, "wb") do |output| - while (buffer = input.read(1024)) - output.print(buffer) - end - end - end - message(" done\n") + download(url) message("extracting...") zip_extract(file_name, '.') @@ -170,15 +180,7 @@ def build_groonga(major, minor, micro) url = "http://packages.groonga.org/source/groonga/#{tar_gz}" install_dir = local_groonga_install_dir - message("downloading %s...", url) - open(url, "rb") do |input| - File.open(tar_gz, "wb") do |output| - while (buffer = input.read(1024)) - output.print(buffer) - end - end - end - message(" done\n") + download(url) message("extracting...") if xsystem("tar xfz #{tar_gz}") From null+ranguba at clear-code.com Tue Apr 24 15:31:13 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:31:13 +0900 Subject: [groonga-commit:4387] ranguba/rroonga [master] Require standard libraries at the head Message-ID: <20120424153124.EFF1D9A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:31:13 +0900 (Wed, 25 Apr 2012) New Revision: 824b32b3afaca7786e0405b6d6ef883b358f3e35 Log: Require standard libraries at the head Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+3 -5) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:29:39 +0900 (0d0838a) +++ ext/groonga/extconf.rb 2012-04-25 00:31:13 +0900 (5970b61) @@ -18,6 +18,9 @@ require 'English' require 'pathname' require 'mkmf' +require 'fileutils' +require 'shellwords' +require 'open-uri' begin require 'pkg-config' @@ -66,8 +69,6 @@ checking_for(checking_message("Win32 OS")) do end def install_groonga_locally(major, minor, micro) - require 'shellwords' - FileUtils.mkdir_p(local_groonga_base_dir) Dir.chdir(local_groonga_base_dir) do @@ -82,8 +83,6 @@ def install_groonga_locally(major, minor, micro) end def download(url) - require 'open-uri' - message("downloading %s...", url) base_name = File.basename(url) if File.exist?(base_name) @@ -151,7 +150,6 @@ def extract_groonga_win32_binary(major, minor, micro) zip_extract(file_name, '.') message(" done\n") - require 'fileutils' if File.exist?(install_dir) message("remove old install...") FileUtils.rm_r(install_dir) From null+ranguba at clear-code.com Tue Apr 24 15:32:18 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:32:18 +0900 Subject: [groonga-commit:4388] ranguba/rroonga [master] Expand abbrebiated name Message-ID: <20120424153228.10AB19A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:32:18 +0900 (Wed, 25 Apr 2012) New Revision: cc91dd5aae6dbcb3ac94cd5b7c503b3a002d694e Log: Expand abbrebiated name dst -> destination Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+4 -4) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:31:13 +0900 (5970b61) +++ ext/groonga/extconf.rb 2012-04-25 00:32:18 +0900 (b787928) @@ -99,7 +99,7 @@ def download(url) end end -def zip_extract(filename, dst_dir) +def zip_extract(filename, destrination_dir) return nil unless File.exist?(filename) begin @@ -112,12 +112,12 @@ def zip_extract(filename, dst_dir) root_list = root_entrylist(filename) if (root_list.size == 1) - Archive::Zip.extract(filename, dst_dir) + Archive::Zip.extract(filename, destrination_dir) return root_list[0].gsub("/", "") else dir = File.basename(filename).sub(/#{File.extname(filename)}$/, "") - FileUtils.mkdir_p(File.join(dst_dir, dir)) - Archive::Zip.extract(filename, File.join(dst_dir, dir)) + FileUtils.mkdir_p(File.join(destrination_dir, dir)) + Archive::Zip.extract(filename, File.join(destrination_dir, dir)) return dir end end From null+ranguba at clear-code.com Tue Apr 24 15:32:59 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:32:59 +0900 Subject: [groonga-commit:4389] ranguba/rroonga [master] Don't ignore invalid input Message-ID: <20120424153309.2D2DE9A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:32:59 +0900 (Wed, 25 Apr 2012) New Revision: 46f326a65dcf6335bdef5d345922e6ce317bf21c Log: Don't ignore invalid input Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+0 -2) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:32:18 +0900 (b787928) +++ ext/groonga/extconf.rb 2012-04-25 00:32:59 +0900 (0ea1079) @@ -100,8 +100,6 @@ def download(url) end def zip_extract(filename, destrination_dir) - return nil unless File.exist?(filename) - begin require 'archive/zip' rescue LoadError From null+ranguba at clear-code.com Tue Apr 24 15:33:36 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:33:36 +0900 Subject: [groonga-commit:4390] ranguba/rroonga [master] Use extra_ as prefix Message-ID: <20120424153345.D8E149A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:33:36 +0900 (Wed, 25 Apr 2012) New Revision: a710531c65fd4d2f8d7a59ef3771607adb9999eb Log: Use extra_ as prefix Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+2 -2) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:32:59 +0900 (0ea1079) +++ ext/groonga/extconf.rb 2012-04-25 00:33:36 +0900 (9acde04) @@ -99,7 +99,7 @@ def download(url) end end -def zip_extract(filename, destrination_dir) +def extract_zip(filename, destrination_dir) begin require 'archive/zip' rescue LoadError @@ -145,7 +145,7 @@ def extract_groonga_win32_binary(major, minor, micro) download(url) message("extracting...") - zip_extract(file_name, '.') + extract_zip(file_name, '.') message(" done\n") if File.exist?(install_dir) From null+ranguba at clear-code.com Tue Apr 24 15:34:12 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:34:12 +0900 Subject: [groonga-commit:4391] ranguba/rroonga [master] Use suitable variable name for zip path Message-ID: <20120424153423.1A6729A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:34:12 +0900 (Wed, 25 Apr 2012) New Revision: 659ce294231322ee4058bcfcd6ec8c5c99bc1937 Log: Use suitable variable name for zip path Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+4 -4) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:33:36 +0900 (9acde04) +++ ext/groonga/extconf.rb 2012-04-25 00:34:12 +0900 (11e99cc) @@ -138,14 +138,14 @@ def extract_groonga_win32_binary(major, minor, micro) else architecture = "x86" end - file_name = "groonga-#{major}.#{minor}.#{micro}-#{architecture}.zip" - url = "http://packages.groonga.org/windows/groonga/#{file_name}" + zip = "groonga-#{major}.#{minor}.#{micro}-#{architecture}.zip" + url = "http://packages.groonga.org/windows/groonga/#{zip}" install_dir = local_groonga_install_dir download(url) message("extracting...") - extract_zip(file_name, '.') + extract_zip(zip, '.') message(" done\n") if File.exist?(install_dir) @@ -155,7 +155,7 @@ def extract_groonga_win32_binary(major, minor, micro) end message("install...") - FileUtils.mv(File.basename(file_name, ".zip"), File.basename(install_dir)) + FileUtils.mv(File.basename(zip, ".zip"), File.basename(install_dir)) message(" done\n") end From null+ranguba at clear-code.com Tue Apr 24 15:35:16 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:35:16 +0900 Subject: [groonga-commit:4392] ranguba/rroonga [master] Use RROONGA_ prefix for environment variable Message-ID: <20120424153526.EC5C49A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:35:16 +0900 (Wed, 25 Apr 2012) New Revision: 5618c7dc930cdfa3465ecc6fbd6fba15d2772fae Log: Use RROONGA_ prefix for environment variable Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+1 -1) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:34:12 +0900 (11e99cc) +++ ext/groonga/extconf.rb 2012-04-25 00:35:16 +0900 (00e6aa1) @@ -161,7 +161,7 @@ end def configure_command_line(prefix) command_line = ["./configure"] - debug_build_p = ENV["DEBUG_BUILD"] == "yes" + debug_build_p = ENV["RROONGA_DEBUG_BUILD"] == "yes" debug_flags = ["CFLAGS=-ggdb3 -O0", "CXXFLAGS=-ggdb3 -O0"] command_line.concat(debug_flags) if debug_build_p command_line << "--prefix=#{prefix}" From null+ranguba at clear-code.com Tue Apr 24 15:37:30 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:37:30 +0900 Subject: [groonga-commit:4393] ranguba/rroonga [master] Show removing path Message-ID: <20120424153742.CF7839A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:37:30 +0900 (Wed, 25 Apr 2012) New Revision: 4b02fcb41c76105ff229a1d635d9add3b8fe34c8 Log: Show removing path Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+1 -1) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:35:16 +0900 (00e6aa1) +++ ext/groonga/extconf.rb 2012-04-25 00:37:30 +0900 (00a5256) @@ -149,7 +149,7 @@ def extract_groonga_win32_binary(major, minor, micro) message(" done\n") if File.exist?(install_dir) - message("remove old install...") + message("remove old install... #{install_dir}") FileUtils.rm_r(install_dir) message(" done\n") end From null+ranguba at clear-code.com Tue Apr 24 15:37:50 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:37:50 +0900 Subject: [groonga-commit:4394] ranguba/rroonga [master] Force to remove old install directory Message-ID: <20120424153759.5D7639A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:37:50 +0900 (Wed, 25 Apr 2012) New Revision: 17350edb66485105e2d36d20ff970065629d70b2 Log: Force to remove old install directory Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+1 -1) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:37:30 +0900 (00a5256) +++ ext/groonga/extconf.rb 2012-04-25 00:37:50 +0900 (6221400) @@ -150,7 +150,7 @@ def extract_groonga_win32_binary(major, minor, micro) if File.exist?(install_dir) message("remove old install... #{install_dir}") - FileUtils.rm_r(install_dir) + FileUtils.rm_rf(install_dir) message(" done\n") end From null+ranguba at clear-code.com Tue Apr 24 15:39:24 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:39:24 +0900 Subject: [groonga-commit:4395] ranguba/rroonga [master] Remove needless File.basename Message-ID: <20120424153934.47F499A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:39:24 +0900 (Wed, 25 Apr 2012) New Revision: 24b60b5cb86fd287ce525fda5c2694851ecaf462 Log: Remove needless File.basename Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+1 -1) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:37:50 +0900 (6221400) +++ ext/groonga/extconf.rb 2012-04-25 00:39:24 +0900 (97a7810) @@ -155,7 +155,7 @@ def extract_groonga_win32_binary(major, minor, micro) end message("install...") - FileUtils.mv(File.basename(zip, ".zip"), File.basename(install_dir)) + FileUtils.mv(File.basename(zip, ".zip"), install_dir) message(" done\n") end From null+ranguba at clear-code.com Tue Apr 24 15:45:22 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:45:22 +0900 Subject: [groonga-commit:4396] ranguba/rroonga [master] Remove needless codes Message-ID: <20120424154534.D86299A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:45:22 +0900 (Wed, 25 Apr 2012) New Revision: cbfbf3d5fd8bb69e9e1659478a3edaf4f24b7506 Log: Remove needless codes Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+1 -23) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:39:24 +0900 (97a7810) +++ ext/groonga/extconf.rb 2012-04-25 00:45:22 +0900 (4dfaab2) @@ -107,29 +107,7 @@ def extract_zip(filename, destrination_dir) require 'archive/zip' end - root_list = root_entrylist(filename) - - if (root_list.size == 1) - Archive::Zip.extract(filename, destrination_dir) - return root_list[0].gsub("/", "") - else - dir = File.basename(filename).sub(/#{File.extname(filename)}$/, "") - FileUtils.mkdir_p(File.join(destrination_dir, dir)) - Archive::Zip.extract(filename, File.join(destrination_dir, dir)) - return dir - end -end - -def root_entrylist(filename) - list = [] - - Archive::Zip.open(filename) do |archive| - archive.each do |entry| - list << entry.zip_path if entry.zip_path.split('/').size == 1 - end - end - - list + Archive::Zip.extract(filename, destrination_dir) end def extract_groonga_win32_binary(major, minor, micro) From null+ranguba at clear-code.com Tue Apr 24 15:46:42 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 00:46:42 +0900 Subject: [groonga-commit:4397] ranguba/rroonga [master] Use " for string literal instead of ' Message-ID: <20120424154653.2B4749A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 00:46:42 +0900 (Wed, 25 Apr 2012) New Revision: c0542153e957e0230921568349f2b150f6e5e25e Log: Use " for string literal instead of ' Modified files: ext/groonga/extconf.rb Modified: ext/groonga/extconf.rb (+15 -15) =================================================================== --- ext/groonga/extconf.rb 2012-04-25 00:45:22 +0900 (4dfaab2) +++ ext/groonga/extconf.rb 2012-04-25 00:46:42 +0900 (3b6426a) @@ -15,24 +15,24 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -require 'English' -require 'pathname' -require 'mkmf' -require 'fileutils' -require 'shellwords' -require 'open-uri' +require "English" +require "pathname" +require "mkmf" +require "fileutils" +require "shellwords" +require "open-uri" begin - require 'pkg-config' + require "pkg-config" rescue LoadError - require 'rubygems' - require 'pkg-config' + require "rubygems" + require "pkg-config" end base_dir = Pathname(__FILE__).dirname.parent.parent $LOAD_PATH.unshift(base_dir.to_s) -require 'rroonga-build' +require "rroonga-build" include RroongaBuild @@ -42,7 +42,7 @@ major, minor, micro = RequiredGroongaVersion::VERSION checking_for(checking_message("GCC")) do if macro_defined?("__GNUC__", "") - $CFLAGS += ' -Wall' + $CFLAGS += " -Wall" true else false @@ -101,10 +101,10 @@ end def extract_zip(filename, destrination_dir) begin - require 'archive/zip' + require "archive/zip" rescue LoadError - require 'rubygems' - require 'archive/zip' + require "rubygems" + require "archive/zip" end Archive::Zip.extract(filename, destrination_dir) @@ -123,7 +123,7 @@ def extract_groonga_win32_binary(major, minor, micro) download(url) message("extracting...") - extract_zip(zip, '.') + extract_zip(zip, ".") message(" done\n") if File.exist?(install_dir) From null+ranguba at clear-code.com Tue Apr 24 16:01:10 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 25 Apr 2012 01:01:10 +0900 Subject: [groonga-commit:4398] ranguba/rroonga [master] Require groonga >= 2.0.2 Message-ID: <20120424160121.A97EA9A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-25 01:01:10 +0900 (Wed, 25 Apr 2012) New Revision: 11b99bf1ed53698009ee3a4e0e4332ef01be4375 Log: Require groonga >= 2.0.2 Modified files: rroonga-build.rb Modified: rroonga-build.rb (+1 -1) =================================================================== --- rroonga-build.rb 2012-04-25 00:46:42 +0900 (59774f4) +++ rroonga-build.rb 2012-04-25 01:01:10 +0900 (8761de5) @@ -19,7 +19,7 @@ module RroongaBuild module RequiredGroongaVersion MAJOR = 2 MINOR = 0 - MICRO = 1 + MICRO = 2 VERSION = [MAJOR, MINOR, MICRO] end From null+ranguba at clear-code.com Fri Apr 27 03:30:48 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Fri, 27 Apr 2012 12:30:48 +0900 Subject: [groonga-commit:4399] ranguba/rroonga [master] Fix a typo Message-ID: <20120427033110.C178D9A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-27 12:30:48 +0900 (Fri, 27 Apr 2012) New Revision: ac1436fe2d035c2b55d462e82f99c9e518030514 Log: Fix a typo Modified files: test/test-record.rb Modified: test/test-record.rb (+1 -1) =================================================================== --- test/test-record.rb 2012-04-25 01:01:10 +0900 (3f5974b) +++ test/test-record.rb 2012-04-27 12:30:48 +0900 (93d6a1f) @@ -315,7 +315,7 @@ class RecordTest < Test::Unit::TestCase values = { "uri" => "http://groonga.org/", "rate" => 5, - "comment" => "Grate!" + "comment" => "Great!" } groonga = @bookmarks.add(values) assert_equal(values.merge("_id" => groonga.id, From null+ranguba at clear-code.com Sun Apr 29 08:27:01 2012 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Sun, 29 Apr 2012 17:27:01 +0900 Subject: [groonga-commit:4400] ranguba/rroonga [master] test: remove tests for unsupported features Message-ID: <20120429082713.192BC9A0A5@jenkins.clear-code.com> Kouhei Sutou 2012-04-29 17:27:01 +0900 (Sun, 29 Apr 2012) New Revision: d50f5fd01af2c08ed2fb5294ad60f5f4228daf80 Log: test: remove tests for unsupported features I'm sorry but groonga can't detect object remove in other process. So rroogna also cannot support it. We need to reopen database. Modified files: test/test-table.rb Modified: test/test-table.rb (+0 -17) =================================================================== --- test/test-table.rb 2012-04-27 12:30:48 +0900 (798715f) +++ test/test-table.rb 2012-04-29 17:27:01 +0900 (c8b1bc5) @@ -660,23 +660,6 @@ class TableTest < Test::Unit::TestCase assert_not_nil(bookmarks.column("name")) end - def test_remove - bookmarks = Groonga::Array.create(:name => "Bookmarks") - by_other_process do - bookmarks.remove - end - assert_predicate(bookmarks, :closed?) - end - - def test_remove_column - bookmarks = Groonga::Hash.create(:name => "Bookmarks") - real_name = bookmarks.define_column("name", "Text") - by_other_process do - real_name.remove - end - assert_predicate(real_name, :closed?) - end - private def by_other_process pid = Process.fork do