]> git.notmuchmail.org Git - sup/blobdiff - lib/sup/hook.rb
Merge branch 'master' into next
[sup] / lib / sup / hook.rb
index d3d2ba8fc4b6f88619843512c99dec8c0c94c8cb..0212c6bc9dfe26c738cab3d7f8b90929b7dc981a 100644 (file)
@@ -18,7 +18,7 @@ class HookManager
     end
 
     def log s
-      Redwood::log "hook[#@__name]: #{s}"
+      info "hook[#@__name]: #{s}"
     end
 
     def ask_yes_or_no q
@@ -54,6 +54,7 @@ class HookManager
       end
       ret = eval __hook, __binding, __filename
       BufferManager.clear @__say_id if @__say_id
+      @__cache = {}
       ret
     end
   end
@@ -68,8 +69,6 @@ class HookManager
     @tags = {}
 
     Dir.mkdir dir unless File.exists? dir
-
-    self.class.i_am_the_instance self
   end
 
   attr_reader :tags
@@ -112,13 +111,15 @@ EOS
 
   def enabled? name; !hook_for(name).nil? end
 
+  def clear; @hooks.clear; end
+
 private
 
   def hook_for name
     unless @hooks.member? name
       @hooks[name] = begin
         returning IO.read(fn_for(name)) do
-          log "read '#{name}' from #{fn_for(name)}"
+          debug "read '#{name}' from #{fn_for(name)}"
         end
       rescue SystemCallError => e
         #log "disabled hook for '#{name}': #{e.message}"
@@ -134,7 +135,7 @@ private
   end
 
   def log m
-    Redwood::log("hook: " + m)
+    info("hook: " + m)
   end
 end