Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Unreleased ([changes](https://github.com/colszowka/simplecov/compare/v0.7.0...master))
-------------------

* [FEATURE] Automatically detect the usage of parallel_tests.
See https://github.com/colszowka/simplecov/issues/64
* [FEATURE] Adds support for Rails 4 command guessing.

v0.7.1, 2012-10-12 ([changes](https://github.com/colszowka/simplecov/compare/v0.7.0...v0.7.1))
Expand Down
10 changes: 8 additions & 2 deletions lib/simplecov.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#
# Code coverage for ruby 1.9. Please check out README for a full introduction.
#
require 'lockfile'

module SimpleCov
# Indicates invalid coverage data
class CoverageDataError < StandardError; end;
Expand Down Expand Up @@ -52,8 +54,12 @@ def result
# If we're using merging of results, store the current result
# first, then merge the results and return those
if use_merging
SimpleCov::ResultMerger.store_result(@result) if @result
return SimpleCov::ResultMerger.merged_result
lockfile = ::Lockfile.new ResultMerger.resultset_path + '.lockfile'

lockfile.lock do
SimpleCov::ResultMerger.store_result(@result) if @result
return SimpleCov::ResultMerger.merged_result
end
else
return @result if defined? @result
end
Expand Down
11 changes: 10 additions & 1 deletion lib/simplecov/command_guesser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@ class << self
attr_accessor :original_run_command

def guess
from_command_line_options || from_defined_constants
from_env || from_command_line_options || from_defined_constants
end

private

def from_env
# If being run from inside parallel_tests set the command name according to the process number
if ENV['PARALLEL_TEST_GROUPS'] && ENV['TEST_ENV_NUMBER']
number = ENV['TEST_ENV_NUMBER']
number = '1' if number == ''
"(#{number}/#{ENV['PARALLEL_TEST_GROUPS']})"
end
end

def from_command_line_options
case original_run_command
Expand Down
1 change: 1 addition & 0 deletions simplecov.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Gem::Specification.new do |gem|
gem.summary = gem.description

gem.add_dependency 'multi_json', '~> 1.0'
gem.add_dependency 'lockfile'
gem.add_dependency 'simplecov-html', '~> 0.7.1'

gem.add_development_dependency 'aruba'
Expand Down