module Rake::Multilogs
`Rake::Multilogs` groups multitask output by task, displaying it when all tasks have completed, rather than the default behavior of displaying output immediately (which means that output from different tasks becomes confusingly interleaved).
This requires `Process.fork`, so is not supported on JRuby or Windows.
Constants
- VERSION
Current version of the rake-multilogs gem.
Public Class Methods
Register a block to be called before executing a task. This is called from the child processes after forking, and from the parent process after the prerequisites have completed and the child processes have exited. In each case it will receive the task that is about to execute as a parameter.
@example Handling database connections with Active Record
Rake::Multilogs.after_fork do ActiveRecord::Base.establish_connection end
@param block [#to_proc] the block to call (must accept zero or one parameters) @return [void]
# File lib/rake/multilogs.rb, line 46 def after_fork(&block) @after_fork = block end
Register a block to be called from the multitask before running its prerequisites. This is called from the parent process before forking, and will receive the multitask as a parameter.
@example Handling database connections with Active Record
Rake::Multilogs.before_fork do ActiveRecord::Base.connection.disconnect! end
@param block [#to_proc] the block to call (must accept zero or one parameters) @return [void]
# File lib/rake/multilogs.rb, line 29 def before_fork(&block) @before_fork = block end
@private
# File lib/rake/multilogs.rb, line 56 def call_after_fork(task) @after_fork&.call(task) end
@private
# File lib/rake/multilogs.rb, line 51 def call_before_fork(task) @before_fork&.call(task) end