[milter-manager-commit] milter-manager/milter-manager at 27317f7 [master] binding ruby: Add debian-detector.rb to support debian-systemd-detector

Back to archive index

Kenji Okimoto null+****@clear*****
Tue Jun 27 15:09:41 JST 2017


Kenji Okimoto	2017-06-27 15:09:41 +0900 (Tue, 27 Jun 2017)

  New Revision: 27317f7c78e914d71269affd3a09a1daa5423288
  https://github.com/milter-manager/milter-manager/commit/27317f7c78e914d71269affd3a09a1daa5423288

  Message:
    binding ruby: Add debian-detector.rb to support debian-systemd-detector

  Added files:
    binding/ruby/lib/milter/manager/debian-detector.rb
  Modified files:
    binding/ruby/lib/milter/manager/Makefile.am

  Modified: binding/ruby/lib/milter/manager/Makefile.am (+1 -0)
===================================================================
--- binding/ruby/lib/milter/manager/Makefile.am    2017-06-27 14:53:04 +0900 (ad9cef7)
+++ binding/ruby/lib/milter/manager/Makefile.am    2017-06-27 15:09:41 +0900 (46c4f5a)
@@ -13,6 +13,7 @@ dist_binding_lib_milter_DATA =			\
 	freebsd-rc-detector.rb			\
 	pkgsrc-rc-detector.rb			\
 	init-detector.rb			\
+	debian-detector.rb			\
 	debian-init-detector.rb			\
 	debian-systemd-detector.rb		\
 	redhat-detector.rb			\

  Added: binding/ruby/lib/milter/manager/debian-detector.rb (+49 -0) 100644
===================================================================
--- /dev/null
+++ binding/ruby/lib/milter/manager/debian-detector.rb    2017-06-27 15:09:41 +0900 (562714d)
@@ -0,0 +1,49 @@
+module Milter::Manager
+  class DebianDetector
+    include Detector
+
+    def detect
+      @systemd_detector.detect
+      @init_detector.detect
+    end
+
+    def apply(loader, &block)
+      if @systemd_detector.enabled?
+        @systemd_detector.apply(loader, &block)
+      else
+        @init_detector.apply(loader, &block)
+      end
+    end
+
+    def run_command
+      if @systemd_detector.enabled?
+        @systemd_detector.command
+      else
+        @init_detector.command
+      end
+    end
+
+    def command_options
+      if @systemd_detector.enabled?
+        @systemd_detector.command_options
+      else
+        @init_detector.command_options
+      end
+    end
+
+    def enabled?
+      @systemd_detector.enabled? or
+        @init_detector.enabled?
+    end
+
+    private
+
+    def init_variables
+      super
+      @init_detector = DebianInitDetector.new(@configuration, @script_name,
+                                              &@connection_spec_detector)
+      @systemd_detector = DebianSystemdDetector.new(@configuration, @script_name,
+                                                    &@connection_spec_detector)
+    end
+  end
+end
-------------- next part --------------
An HTML attachment was scrubbed...
Télécharger 



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