[Groonga-commit] ranguba/groonga-client-rails at ea25f48 [master] Add groonga:sync task

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Mar 28 01:18:27 JST 2016


Kouhei Sutou	2016-03-28 01:18:27 +0900 (Mon, 28 Mar 2016)

  New Revision: ea25f4862d9e7f0c173368988a65280328c3de6e
  https://github.com/ranguba/groonga-client-rails/commit/ea25f4862d9e7f0c173368988a65280328c3de6e

  Message:
    Add groonga:sync task

  Added files:
    lib/groonga/client/railties/groonga.rake
  Modified files:
    lib/groonga/client/railtie.rb

  Modified: lib/groonga/client/railtie.rb (+4 -0)
===================================================================
--- lib/groonga/client/railtie.rb    2016-03-28 01:14:58 +0900 (8383d27)
+++ lib/groonga/client/railtie.rb    2016-03-28 01:18:27 +0900 (a3bbdc0)
@@ -20,6 +20,10 @@ module Groonga
   class Client
     # @private
     class Railtie < ::Rails::Railtie
+      rake_tasks do
+        load "groonga/client/railties/groonga.rake"
+      end
+
       initializer "groonga-client.eager_load" do |app|
         app.paths.add("app/searchers",
                       eager_load: true,

  Added: lib/groonga/client/railties/groonga.rake (+26 -0) 100644
===================================================================
--- /dev/null
+++ lib/groonga/client/railties/groonga.rake    2016-03-28 01:18:27 +0900 (cadda2b)
@@ -0,0 +1,26 @@
+# -*- ruby -*-
+#
+# Copyright (C) 2016  Kouhei Sutou <kou �� clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+namespace :groonga do
+  task :sync do
+    Rails.application.eager_load!
+    ObjectSpace.each_object(Class) do |klass|
+      klass.sync if klass < Groonga::Client::Searcher
+    end
+  end
+end
-------------- next part --------------
HTML����������������������������...
Download 



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