Sha256: 3361774d4c777b3ed30b6f22b1a6a1ae074730a282320ba99af94a87df7d5586
Contents?: true
Size: 1.2 KB
Versions: 5
Compression:
Stored size: 1.2 KB
Contents
Sup's Hook System ----------------- Sup can be easily customized via its hook system, which allows custom user code to be injected into Sup's execution path by "hooking" the code onto pre-defined events. When those events occur, the code is executed. To see which hooks are available, simply run sup -l. Each hook sits in a file in ~/.sup/hooks/. Hooks are written in Ruby, and require no class or method definitions, just the executable code itself. Information passes from Sup to the hook code via Ruby variables (actually method calls), and from the hook code back to Sup via a return value. Each hook description lists the variables and return value expected, if any. Some example hooks: before-poll: ## runs fetchmail before polling if (@last_fetchmail_time || Time.now) < Time.now - 60 say "Running fetchmail..." system "fetchmail >& /dev/null" say "Done running fetchmail." end @last_fetchmail_time = Time.now mime-decode: ## turn text/html attachments into plain text, unless they are part ## of a multipart/alternative pair unless sibling_types.member? "text/plain" case content_type when "text/html" `/usr/bin/w3m -dump -T #{content_type} '#{filename}'` end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
sup-0.6 | doc/Hooks.txt |
sup-0.2 | doc/Hooks.txt |
sup-0.3 | doc/Hooks.txt |
sup-0.5 | doc/Hooks.txt |
sup-0.4 | doc/Hooks.txt |