class ParallelTests::RSpec::LoggerBase
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/parallel_tests/rspec/logger_base.rb, line 10 def initialize(*args) super @output ||= args[0] case @output when String # a path ? FileUtils.mkdir_p(File.dirname(@output)) File.open(@output, 'w') {} # overwrite previous results @output = File.open(@output, 'a') when File # close and restart in append mode @output.close @output = File.open(@output.path, 'a') end end
Public Instance Methods
close(*)
click to toggle source
stolen from Rspec
# File lib/parallel_tests/rspec/logger_base.rb, line 27 def close(*) @output.close if (IO === @output) & (@output != $stdout) end
Protected Instance Methods
lock_output() { || ... }
click to toggle source
do not let multiple processes get in each others way
# File lib/parallel_tests/rspec/logger_base.rb, line 34 def lock_output if @output.is_a?(File) begin @output.flock File::LOCK_EX yield ensure @output.flock File::LOCK_UN end else yield end end