Sha256: 5483559f83a560c2bcf1266387e6f34a4f32e12a3de27f54ba9e55450280a1e2
Contents?: true
Size: 1.51 KB
Versions: 2
Compression:
Stored size: 1.51 KB
Contents
module ParallelTests module RSpec end end begin require 'rspec/core/formatters/base_text_formatter' base = RSpec::Core::Formatters::BaseTextFormatter rescue LoadError require 'spec/runner/formatter/base_text_formatter' base = Spec::Runner::Formatter::BaseTextFormatter end ParallelTests::RSpec::LoggerBaseBase = base class ParallelTests::RSpec::LoggerBase < ParallelTests::RSpec::LoggerBaseBase RSPEC_1 = !defined?(RSpec::Core::Formatters::BaseTextFormatter) # do not test for Spec, this will trigger deprecation warning in rspec 2 def initialize(*args) super @output ||= args[1] || args[0] # rspec 1 has output as second argument if String === @output # a path ? FileUtils.mkdir_p(File.dirname(@output)) File.open(@output, 'w'){} # overwrite previous results @output = File.open(@output, 'a') elsif File === @output # close and restart in append mode @output.close @output = File.open(@output.path, 'a') end end #stolen from Rspec def close @output.close if (IO === @output) & (@output != $stdout) end # do not let multiple processes get in each others way def lock_output if File === @output begin @output.flock File::LOCK_EX yield ensure @output.flock File::LOCK_UN end else yield end end def lock_output_begin if File === @output @output.flock File::LOCK_EX end end def lock_output_end if File === @output @output.flock File::LOCK_UN end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sim-0.0.2 | lib/sim/logger_base.rb |
sim-0.0.1 | lib/sim/logger_base.rb |