Kouhei Sutou
null+****@clear*****
Mon Mar 6 10:13:27 JST 2017
Kouhei Sutou 2017-03-06 10:13:27 +0900 (Mon, 06 Mar 2017) New Revision: 72c9023cb5f7231d05f1d514f069d8207a24e734 https://github.com/ranguba/groonga-client-model/commit/72c9023cb5f7231d05f1d514f069d8207a24e734 Message: schema-loader: accept #each_line-able objects Stop to require file based schema. Modified files: lib/groonga_client_model/schema_loader.rb lib/groonga_client_model/test/groonga_server_runner.rb Modified: lib/groonga_client_model/schema_loader.rb (+4 -6) =================================================================== --- lib/groonga_client_model/schema_loader.rb 2017-03-03 21:26:25 +0900 (bc642d1) +++ lib/groonga_client_model/schema_loader.rb 2017-03-06 10:13:27 +0900 (da5a4de) @@ -18,8 +18,8 @@ require "groonga/command/parser" module GroongaClientModel class SchemaLoader - def initialize(schema_path) - @schema_path = schema_path + def initialize(schema) + @schema = schema end def load @@ -28,10 +28,8 @@ module GroongaClientModel parser.on_command do |command| client.execute(command) end - @schema_path.open do |schema_file| - schema_file.each_line do |line| - parser << line - end + @schema.each_line do |line| + parser << line end parser.finish end Modified: lib/groonga_client_model/test/groonga_server_runner.rb (+4 -2) =================================================================== --- lib/groonga_client_model/test/groonga_server_runner.rb 2017-03-03 21:26:25 +0900 (e2189ed) +++ lib/groonga_client_model/test/groonga_server_runner.rb 2017-03-06 10:13:27 +0900 (76b03f5) @@ -44,8 +44,10 @@ module GroongaClientModel schema_path = base_dir + "db" + "schema.grn" migrate_path = base_dir + "db" + "groonga" + "migrate" if schema_path.exist? - schema_loader = SchemaLoader.new(schema_path) - schema_loader.load + schema_path.open do |schema_file| + schema_loader = SchemaLoader.new(schema_file) + schema_loader.load + end elsif migrate_path.exist? output = StringIO.new migrator = Migrator.new(migrate_path, nil) -------------- next part -------------- HTML����������������������������...Download