Method: Roby::Application#run_plugins

Defined in:
lib/roby/app.rb

#run_plugins(mods, &block) ⇒ Object

Helper for Application#run to call the plugin’s run or start methods while guaranteeing the system’s cleanup

This method recursively calls each plugin’s #run method (if defined) in block forms. This guarantees that the plugins can use a begin/rescue/end mechanism to do their cleanup

If no run-related cleanup is required, the plugin can define a #start(app) method instead.

Note that the cleanup we talk about here is related to running. Cleanup required after #setup must be done in #cleanup



2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
# File 'lib/roby/app.rb', line 2410

def run_plugins(mods, &block)
    if mods.empty?
        yield if block_given?
    else
        mod = mods.shift
        if mod.respond_to?(:start)
            mod.start(self)
            run_plugins(mods, &block)
        else
            mod.run(self) do
                run_plugins(mods, &block)
            end
        end
    end
end