Module: Rake::Multilogs

Defined in:
lib/rake/multilogs.rb,
lib/rake/multilogs/fork.rb,
lib/rake/multilogs/task.rb,
lib/rake/multilogs/forks.rb,
lib/rake/multilogs/version.rb

Overview

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.

Defined Under Namespace

Modules: Task

Constant Summary collapse

VERSION =

Current version of the rake-multilogs gem.

"0.3.0"

Class Method Summary collapse

Class Method Details

.after_fork(&block) ⇒ void

This method returns an undefined value.

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.

Examples:

Handling database connections with Active Record

Rake::Multilogs.after_fork do
  ActiveRecord::Base.establish_connection
end

Parameters:

  • block (#to_proc)

    the block to call (must accept zero or one parameters)



46
47
48
# File 'lib/rake/multilogs.rb', line 46

def after_fork(&block)
  @after_fork = block
end

.before_fork(&block) ⇒ void

This method returns an undefined value.

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.

Examples:

Handling database connections with Active Record

Rake::Multilogs.before_fork do
  ActiveRecord::Base.connection.disconnect!
end

Parameters:

  • block (#to_proc)

    the block to call (must accept zero or one parameters)



29
30
31
# File 'lib/rake/multilogs.rb', line 29

def before_fork(&block)
  @before_fork = block
end