Module: Sprout::Daemon
- Extended by:
- Concern
- Defined in:
- lib/sprout/daemon.rb
Overview
The Sprout::Daemon module exposes the Domain Specific Language provided by the Sprout::Executable module, but with enhancements (and modifications) to support long-lived processes (like FDB and FCSH).
NOTE: Any class that includes Sprout::Daemon should first include Sprout::Executable. This is an admittedly smelly constraint, but it works for now.
class Foo include Sprout::Executable include Sprout::Daemon ## # Keep in mind that we're still working # with Executable, so add_param is available # for the initialization of the process. add_param :input, File ## # Expose the do_something action after # the process is started. add_action :do_something ## # Expose the do_something_else action after # the process is started. add_action :do_something_else end
You can also create a globally-accessible rake task to expose your new Daemon instance to Rake by creating a method like the following:
def foo *args, &block foo_tool = Foo.new foo_tool.to_rake *args, &block end
Note: The aforementioned rake helper is usually written at the bottom of the class file that is referenced.
The aforementioned Rake task could be used like:
foo :bar do |t| t.do_something t.do_something_else end
@see: Sprout::Daemon::ClassMethods @see: Sprout::Daemon::InstanceMethods
Defined Under Namespace
Modules: ClassMethods, InstanceMethods