When running rcov-0.9.7.1-java (JRuby 1.4.0 compatible version of rcov-0.9.7.1), rcov_save_aggregate_data fails (in
bin/rcov) because the coverage directory does not exist yet when it tries to create the aggregate.data file in that
directory.
To fix this, I added the following line:
FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(File.dirname(file))
So that the method looks like:
def rcov_save_aggregate_data(file)
require 'zlib'
FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(File.dirname(file))
Zlib::GzipWriter.open(file) do |f|
Marshal.dump({:callsites => $rcov_callsite_analyzer, :coverage => $rcov_code_coverage_analyzer}, f)
end
end
Do you think that this fix should be included in rcov? I'm not sure what is happening to cause this to be required,
other than the coverage directory not existing. |