simplecov 0.8.0.pre → 0.8.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7768d38b9aeb395f607dda4c66716e0d2666e16a
4
+ data.tar.gz: 3cf5925dbcaf7506be09faaad38edca5bad8f488
5
+ SHA512:
6
+ metadata.gz: bd3a2f25dc14d3cc3b65309aa06ea37563929d0951fa7d6ec90f9b1b6868ea8a670764230cbb5e7cbf0807c8b04d22a16d051204159a56d8231af909aa4b67f1
7
+ data.tar.gz: 27f202f8386e4478fed7a746e7e464106220ffcf716f506e3dac4914cd7f186fda21b794637ff9b7b52381fcdacfce3bd6af24c14a998d98047888d33ebfdf01
@@ -12,9 +12,9 @@ rvm:
12
12
  - 2.0.0
13
13
  - rbx-18mode
14
14
  - rbx-19mode
15
- - jruby-18mode
16
- - jruby-19mode
17
- - jruby-head
15
+ # - jruby-18mode
16
+ # - jruby-19mode
17
+ # - jruby-head
18
18
  - ruby-head
19
19
  matrix:
20
20
  allow_failures:
@@ -15,6 +15,8 @@ Unreleased ([changes](https://github.com/colszowka/simplecov/compare/v0.7.1...ma
15
15
  See [#212](https://github.com/colszowka/simplecov/pull/212) (thanks to @ersatzryan and @betelgeuse)
16
16
  * [REFACTORING] The internal cucumber test suite now uses Capybara 2.
17
17
  See [#206](https://github.com/colszowka/simplecov/pull/206) (thanks to @infertux)
18
+ * [FEATURE] Automatically detect the usage of parallel_tests.
19
+ See https://github.com/colszowka/simplecov/issues/64
18
20
 
19
21
  v0.7.1, 2012-10-12 ([changes](https://github.com/colszowka/simplecov/compare/v0.7.0...v0.7.1))
20
22
  -------------------
data/README.md CHANGED
@@ -511,7 +511,7 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
511
511
  Apart from the direct companion [simplecov-html], there are other formatters
512
512
  available:
513
513
 
514
- ### [simplecov-rcov](https://github.com/fguillen/simplecov-rcov)
514
+ #### [simplecov-rcov](https://github.com/fguillen/simplecov-rcov)
515
515
  *by Fernando Guillen*
516
516
 
517
517
  "The target of this formatter is to cheat on Hudson so I can use the Ruby metrics plugin with SimpleCov."
@@ -531,6 +531,16 @@ A formatter for Simplecov that emits a Vim script to mark up code files with cov
531
531
 
532
532
  A formatter that prints the coverage of the file under test when you run a single test file.
533
533
 
534
+ #### [simplecov-json](https://github.com/vicentllongo/simplecov-json)
535
+ *by Vicent Llongo*
536
+
537
+ JSON formatter for SimpleCov
538
+
539
+ #### [simplecov-badge](https://github.com/matthew342/simplecov-badge)
540
+ *by Matt Hale*
541
+
542
+ A formatter that generates a coverage badge for use in your project's readme using ImageMagick.
543
+
534
544
  ## Ruby version compatibility
535
545
 
536
546
  [![Build Status](https://secure.travis-ci.org/colszowka/simplecov.png)](http://travis-ci.org/colszowka/simplecov)
@@ -18,3 +18,16 @@ Feature:
18
18
  When I successfully run `bundle exec rake test`
19
19
  Then a coverage report should have been generated in "test/simplecov"
20
20
  And a directory named "coverage" should not exist
21
+
22
+ Scenario:
23
+ Given SimpleCov for Test/Unit is configured with:
24
+ """
25
+ require 'simplecov'
26
+ SimpleCov.start do
27
+ coverage_dir '/tmp/test/simplecov'
28
+ end
29
+ """
30
+
31
+ When I successfully run `bundle exec rake test`
32
+ Then a coverage report should have been generated in "/tmp/test/simplecov"
33
+ And a directory named "coverage" should not exist
@@ -24,6 +24,34 @@ Feature:
24
24
  Then I should see "4 files in total."
25
25
  And I should see "using Config Test Runner" within "#footer"
26
26
 
27
+ Scenario: Inside start block, using instance var from outside
28
+ Given a file named ".simplecov" with:
29
+ """
30
+ @filter = 'test'
31
+ SimpleCov.start do
32
+ add_filter @filter
33
+ command_name 'Config Test Runner'
34
+ end
35
+ """
36
+
37
+ When I open the coverage report generated with `bundle exec rake test`
38
+ Then I should see "4 files in total."
39
+ And I should see "using Config Test Runner" within "#footer"
40
+
41
+ Scenario: Inside start block, using local var from outside
42
+ Given a file named ".simplecov" with:
43
+ """
44
+ filter = 'test'
45
+ SimpleCov.start do
46
+ add_filter filter
47
+ command_name 'Config Test Runner'
48
+ end
49
+ """
50
+
51
+ When I open the coverage report generated with `bundle exec rake test`
52
+ Then I should see "4 files in total."
53
+ And I should see "using Config Test Runner" within "#footer"
54
+
27
55
  Scenario: Explicitly before start block
28
56
  Given a file named ".simplecov" with:
29
57
  """
@@ -1,6 +1,8 @@
1
1
  #
2
2
  # Code coverage for ruby 1.9. Please check out README for a full introduction.
3
3
  #
4
+ require 'lockfile'
5
+
4
6
  module SimpleCov
5
7
  class << self
6
8
  attr_accessor :running
@@ -31,6 +33,7 @@ module SimpleCov
31
33
  Coverage.start
32
34
  else
33
35
  warn "WARNING: SimpleCov is activated, but you're not running Ruby 1.9+ - no coverage analysis will happen"
36
+ warn "Starting with SimpleCov 1.0.0, even no-op compatibility with Ruby <= 1.8 will be entirely dropped."
34
37
  false
35
38
  end
36
39
  end
@@ -44,8 +47,12 @@ module SimpleCov
44
47
  # If we're using merging of results, store the current result
45
48
  # first, then merge the results and return those
46
49
  if use_merging
47
- SimpleCov::ResultMerger.store_result(@result) if @result
48
- return SimpleCov::ResultMerger.merged_result
50
+ lockfile = ::Lockfile.new ResultMerger.resultset_path + '.lockfile'
51
+
52
+ lockfile.lock do
53
+ SimpleCov::ResultMerger.store_result(@result) if @result
54
+ return SimpleCov::ResultMerger.merged_result
55
+ end
49
56
  else
50
57
  return @result if defined? @result
51
58
  end
@@ -11,10 +11,19 @@ module SimpleCov::CommandGuesser
11
11
  attr_accessor :original_run_command
12
12
 
13
13
  def guess
14
- from_command_line_options || from_defined_constants
14
+ from_env || from_command_line_options || from_defined_constants
15
15
  end
16
16
 
17
17
  private
18
+
19
+ def from_env
20
+ # If being run from inside parallel_tests set the command name according to the process number
21
+ if ENV['PARALLEL_TEST_GROUPS'] && ENV['TEST_ENV_NUMBER']
22
+ number = ENV['TEST_ENV_NUMBER']
23
+ number = '1' if number == ''
24
+ "(#{number}/#{ENV['PARALLEL_TEST_GROUPS']})"
25
+ end
26
+ end
18
27
 
19
28
  def from_command_line_options
20
29
  case original_run_command
@@ -1,4 +1,5 @@
1
1
  require 'fileutils'
2
+ require 'docile'
2
3
  #
3
4
  # Bundles the configuration options used for SimpleCov. All methods
4
5
  # defined here are usable from SimpleCov directly. Please check out
@@ -34,7 +35,7 @@ module SimpleCov::Configuration
34
35
  # values. Will create the directory if it's missing
35
36
  #
36
37
  def coverage_path
37
- coverage_path = File.join(root, coverage_dir)
38
+ coverage_path = File.expand_path(coverage_dir, root)
38
39
  FileUtils.mkdir_p coverage_path
39
40
  coverage_path
40
41
  end
@@ -118,7 +119,7 @@ module SimpleCov::Configuration
118
119
  #
119
120
  def configure(&block)
120
121
  return false unless SimpleCov.usable?
121
- instance_exec(&block)
122
+ Docile.dsl_eval(self, &block)
122
123
  end
123
124
 
124
125
  #
@@ -4,7 +4,7 @@ require 'simplecov-html'
4
4
  SimpleCov.profiles.define 'root_filter' do
5
5
  # Exclude all files outside of simplecov root
6
6
  add_filter do |src|
7
- !(src.filename =~ /^#{SimpleCov.root}/)
7
+ !(src.filename =~ /^#{Regexp.escape(SimpleCov.root)}/)
8
8
  end
9
9
  end
10
10
 
@@ -47,6 +47,8 @@ at_exit do
47
47
  #otherwise set a non-zero status representing termination by some other exception
48
48
  #(see github issue 41)
49
49
  @exit_status = $!.is_a?(SystemExit) ? $!.status : SimpleCov::ExitCodes::EXCEPTION
50
+ else
51
+ @exit_status = 0
50
52
  end
51
53
 
52
54
  SimpleCov.at_exit.call
@@ -54,7 +56,7 @@ at_exit do
54
56
  if SimpleCov.result? # Result has been computed
55
57
  covered_percent = SimpleCov.result.covered_percent.round(2)
56
58
 
57
- if @exit_status.to_i == 0 # No other errors
59
+ if @exit_status == 0 # No other errors
58
60
  @exit_status = if covered_percent < SimpleCov.minimum_coverage
59
61
  $stderr.puts "Coverage (%.2f%%) is below the expected minimum coverage (%.2f%%)." % \
60
62
  [covered_percent, SimpleCov.minimum_coverage]
@@ -1,3 +1,3 @@
1
1
  module SimpleCov
2
- VERSION = "0.8.0.pre"
2
+ VERSION = "0.8.0.pre2"
3
3
  end
@@ -14,7 +14,9 @@ Gem::Specification.new do |gem|
14
14
  gem.license = "MIT"
15
15
 
16
16
  gem.add_dependency 'multi_json'
17
+ gem.add_dependency 'lockfile', '>= 2.1.0'
17
18
  gem.add_dependency 'simplecov-html', '~> 0.7.1'
19
+ gem.add_dependency 'docile', '~> 1.1.0'
18
20
 
19
21
  gem.add_development_dependency 'appraisal', '~> 0.5.1'
20
22
  gem.add_development_dependency 'rake', '~> 10.0.3'
metadata CHANGED
@@ -1,36 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplecov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0.pre
5
- prerelease: 6
4
+ version: 0.8.0.pre2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Christoph Olszowka
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-05 00:00:00.000000000 Z
11
+ date: 2013-09-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: multi_json
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: lockfile
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 2.1.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 2.1.0
30
41
  - !ruby/object:Gem::Dependency
31
42
  name: simplecov-html
32
43
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
44
  requirements:
35
45
  - - ~>
36
46
  - !ruby/object:Gem::Version
@@ -38,15 +48,27 @@ dependencies:
38
48
  type: :runtime
39
49
  prerelease: false
40
50
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
51
  requirements:
43
52
  - - ~>
44
53
  - !ruby/object:Gem::Version
45
54
  version: 0.7.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: docile
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 1.1.0
46
69
  - !ruby/object:Gem::Dependency
47
70
  name: appraisal
48
71
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
72
  requirements:
51
73
  - - ~>
52
74
  - !ruby/object:Gem::Version
@@ -54,7 +76,6 @@ dependencies:
54
76
  type: :development
55
77
  prerelease: false
56
78
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
79
  requirements:
59
80
  - - ~>
60
81
  - !ruby/object:Gem::Version
@@ -62,7 +83,6 @@ dependencies:
62
83
  - !ruby/object:Gem::Dependency
63
84
  name: rake
64
85
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
86
  requirements:
67
87
  - - ~>
68
88
  - !ruby/object:Gem::Version
@@ -70,7 +90,6 @@ dependencies:
70
90
  type: :development
71
91
  prerelease: false
72
92
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
93
  requirements:
75
94
  - - ~>
76
95
  - !ruby/object:Gem::Version
@@ -78,7 +97,6 @@ dependencies:
78
97
  - !ruby/object:Gem::Dependency
79
98
  name: rspec
80
99
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
100
  requirements:
83
101
  - - ~>
84
102
  - !ruby/object:Gem::Version
@@ -86,7 +104,6 @@ dependencies:
86
104
  type: :development
87
105
  prerelease: false
88
106
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
107
  requirements:
91
108
  - - ~>
92
109
  - !ruby/object:Gem::Version
@@ -94,7 +111,6 @@ dependencies:
94
111
  - !ruby/object:Gem::Dependency
95
112
  name: shoulda
96
113
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
114
  requirements:
99
115
  - - ~>
100
116
  - !ruby/object:Gem::Version
@@ -102,7 +118,6 @@ dependencies:
102
118
  type: :development
103
119
  prerelease: false
104
120
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
121
  requirements:
107
122
  - - ~>
108
123
  - !ruby/object:Gem::Version
@@ -229,30 +244,26 @@ files:
229
244
  homepage: http://github.com/colszowka/simplecov
230
245
  licenses:
231
246
  - MIT
247
+ metadata: {}
232
248
  post_install_message:
233
249
  rdoc_options: []
234
250
  require_paths:
235
251
  - lib
236
252
  required_ruby_version: !ruby/object:Gem::Requirement
237
- none: false
238
253
  requirements:
239
- - - ! '>='
254
+ - - '>='
240
255
  - !ruby/object:Gem::Version
241
256
  version: '0'
242
- segments:
243
- - 0
244
- hash: -263830053031088353
245
257
  required_rubygems_version: !ruby/object:Gem::Requirement
246
- none: false
247
258
  requirements:
248
- - - ! '>'
259
+ - - '>'
249
260
  - !ruby/object:Gem::Version
250
261
  version: 1.3.1
251
262
  requirements: []
252
263
  rubyforge_project:
253
- rubygems_version: 1.8.25
264
+ rubygems_version: 2.0.3
254
265
  signing_key:
255
- specification_version: 3
266
+ specification_version: 4
256
267
  summary: Code coverage for Ruby 1.9+ with a powerful configuration library and automatic
257
268
  merging of coverage across test suites
258
269
  test_files: []