commit rubygem-simplecov for openSUSE:Factory
Hello community, here is the log from the commit of package rubygem-simplecov for openSUSE:Factory checked in at 2014-10-18 09:09:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-simplecov (Old) and /work/SRC/openSUSE:Factory/.rubygem-simplecov.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "rubygem-simplecov" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-simplecov/rubygem-simplecov.changes 2014-10-14 07:12:42.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-simplecov.new/rubygem-simplecov.changes 2014-10-18 09:10:13.000000000 +0200 @@ -1,0 +2,47 @@ +Wed Oct 15 11:41:19 UTC 2014 - coolo@suse.com + +- updated to version 0.9.1 + ## Bugfixes + + * In 0.9.0, we introduced a regression that made SimpleCov no-op mode fail on Ruby 1.8, while + dropping 1.8 support altogether is announced only for v1.0. This has been fixed. + See [#333](https://github.com/colszowka/simplecov/issues/333) (thanks (@sferik) + + + 0.9.0, 2014-07-17 ([changes](https://github.com/colszowka/simplecov/compare/v0.8.2...v0.9.0)) + ==================== + + **A warm welcome and big thank you to the new contributors [@xaviershay](https://github.com/xaviershay), [@sferik](https://github.com/sferik) and especially [@bf4](https://github.com/bf4) for tackling a whole lot of issues and pull requests for this release!** + + ## Enhancements + + * New interface to specify multiple formatters. + See [#317](https://github.com/colszowka/simplecov/pull/317) (thanks @sferik) + * Document in the README how to exclude code from coverage reports, + and that the feature shouldn't be abused for skipping untested + private code. + See [#304](https://github.com/colszowka/simplecov/issues/304) + * Clarify Ruby version support. + See [#279](https://github.com/colszowka/simplecov/pull/279) (thanks @deivid-rodriguez) + + ## Bugfixes + + * Ensure calculations return Floats, not Fixnum or Rational. Fixes segfaults with mathn. + See [#245](https://github.com/colszowka/simplecov/pull/245) (thanks to @bf4) + * Using `Kernel.exit` instead of exit to avoid uncaught throw :IRB_EXIT when + exiting irb sessions. + See [#287](https://github.com/colszowka/simplecov/pull/287) (thanks @wless1) + See [#285](https://github.com/colszowka/simplecov/issues/285) + * Does not look for .simplecov in ~/ when $HOME is not set. + See [#311](https://github.com/colszowka/simplecov/pull/311) (thanks @lasseebert) + * Exit with code only if it's Numeric > 0. + See [#302](https://github.com/colszowka/simplecov/pull/303)(thanks @hajder) + * Make default filter case insensitive. + See [#280](https://github.com/colszowka/simplecov/pull/280) (thanks @ryanatball) + * Improve regexp that matches functional tests. + See [#276](https://github.com/colszowka/simplecov/pull/276) (thanks @sferik) + * Fix TravisCI [#272](https://github.com/colszowka/simplecov/pull/272) [#278](https://github.com/colszowka/simplecov/pull/278), [#302](https://github.com/colszowka/simplecov/pull/302) + * Fix global config load. + See [#311](https://github.com/colszowka/simplecov/pull/311) (thanks @lasseebert) + +------------------------------------------------------------------- Old: ---- simplecov-0.8.2.gem New: ---- gem2rpm.yml simplecov-0.9.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-simplecov.spec ++++++ --- /var/tmp/diff_new_pack.LPUmSJ/_old 2014-10-18 09:10:14.000000000 +0200 +++ /var/tmp/diff_new_pack.LPUmSJ/_new 2014-10-18 09:10:14.000000000 +0200 @@ -16,23 +16,32 @@ # +# +# This file was generated with a gem2rpm.yml and not just plain gem2rpm. +# All sections marked as MANUAL, license headers, summaries and descriptions +# can be maintained in that file. Please consult this file before editing any +# of those fields +# + Name: rubygem-simplecov -Version: 0.8.2 +Version: 0.9.1 Release: 0 %define mod_name simplecov %define mod_full_name %{mod_name}-%{version} - BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: %{rubygem gem2rpm} +BuildRequires: %{ruby} BuildRequires: ruby-macros >= 5 Url: http://github.com/colszowka/simplecov Source: http://rubygems.org/gems/%{mod_full_name}.gem +Source1: gem2rpm.yml Summary: Code coverage for Ruby 1.9+ with a powerful configuration library License: MIT Group: Development/Languages/Ruby %description Code coverage for Ruby 1.9+ with a powerful configuration library and -automatic merging of coverage across test suites +automatic merging of coverage across test suites. %prep @@ -40,7 +49,6 @@ %install %gem_install \ - --symlink-binaries \ --doc-files="CHANGELOG.md MIT-LICENSE README.md" \ -f ++++++ gem2rpm.yml ++++++ # --- # ## used by gem2rpm # :summary: this is a custom summary # ## used by gem2rpm # :description: |- # this is a custom description # # it can be multiline # ## used by gem2rpm # :license: MIT or Ruby # ## used by gem2rpm and gem_packages # :version_suffix: -x_y # ## used by gem2rpm and gem_packages # :disable_docs: true # ## used by gem2rpm # :disable_automatic_rdoc_dep: true # ## used by gem2rpm # :preamble: |- # BuildRequires: foobar # Requires: foobar # ## used by gem2rpm # :patches: # foo.patch: -p1 # bar.patch: # ## used by gem2rpm :sources: # - foo.desktop # - bar.desktop # :gem_install_args: '....' # ## used by gem2rpm # :pre_install: |- # %if 0%{?use_system_libev} # export USE_VENDORED_LIBEV="no" # %endif # ## used by gem2rpm # :post_install: |- # # delete custom files here or do other fancy stuff # install -D -m 0644 %{S:1} %{buildroot}%{_bindir}/gem2rpm-opensuse # ## used by gem2rpm # :testsuite_command: |- # (pushd %{buildroot}%{gem_base}/gems/%{mod_full_name} && rake test) # ## used by gem2rpm # :filelist: |- # /usr/bin/gem2rpm-opensuse # ## used by gem2rpm # :scripts: # :post: |- # /bin/echo foo # ## used by gem_packages # :main: # :preamble: |- # Requires: util-linux # Recommends: pwgen # :filelist: |- # /usr/bin/gem2rpm-opensuse # ## used by gem_packages # :custom: # apache: # :preamble: |- # Requires: ..... # :filelist: |- # /etc/apache2/conf.d/passenger.conf # :summary: Custom summary is optional # :description: |- # Custom description is optional # # bar # :post: |- # /bin/echo foo # ++++++ simplecov-0.8.2.gem -> simplecov-0.9.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.rspec new/.rspec --- old/.rspec 1970-01-01 01:00:00.000000000 +0100 +++ new/.rspec 2014-09-21 13:52:55.000000000 +0200 @@ -0,0 +1 @@ +--require rspec/legacy_formatters diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.travis.yml new/.travis.yml --- old/.travis.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/.travis.yml 2014-09-21 13:52:55.000000000 +0200 @@ -1,28 +1,15 @@ -before_install: - - echo "yes" | gem uninstall json -script: - - bundle - - rake appraisal:install - - rake appraisal +language: ruby rvm: - - ree - 1.8.7 - - 1.9.2 - 1.9.3 - 2.0.0 - - rbx-18mode - - rbx-19mode -# - jruby-18mode -# - jruby-19mode -# - jruby-head + - 2.1 - ruby-head + - jruby + - rbx-2 matrix: allow_failures: - rvm: ruby-head - - rvm: jruby-head - - rvm: jruby-19mode - - rvm: rbx-19mode -notifications: - email: - on_success: always - on_failure: always + - rvm: jruby + - rvm: rbx-2 + fast_finish: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Appraisals new/Appraisals --- old/Appraisals 1970-01-01 01:00:00.000000000 +0100 +++ new/Appraisals 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ -# See https://github.com/colszowka/simplecov/issues/132 -appraise "multi_json-new" do - gem "multi_json", ">= 1.3.4" -end - -appraise "multi_json-legacy" do - gem "multi_json", "~> 1.0.0" -end \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 1970-01-01 01:00:00.000000000 +0100 +++ new/CHANGELOG.md 2014-09-21 13:52:55.000000000 +0200 @@ -1,15 +1,66 @@ -Unreleased ([changes](https://github.com/colszowka/simplecov/compare/v0.8.2...master)) +Unreleased ([changes](https://github.com/colszowka/simplecov/compare/v0.9.1...master)) ==================== +## Enhancements + +## Bugfixes + + +0.9.1, 2014-09-21 ([changes](https://github.com/colszowka/simplecov/compare/v0.9.0...v0.9.1)) +==================== + +## Bugfixes + + * In 0.9.0, we introduced a regression that made SimpleCov no-op mode fail on Ruby 1.8, while + dropping 1.8 support altogether is announced only for v1.0. This has been fixed. + See [#333](https://github.com/colszowka/simplecov/issues/333) (thanks (@sferik) + + +0.9.0, 2014-07-17 ([changes](https://github.com/colszowka/simplecov/compare/v0.8.2...v0.9.0)) +==================== + +**A warm welcome and big thank you to the new contributors [@xaviershay](https://github.com/xaviershay), [@sferik](https://github.com/sferik) and especially [@bf4](https://github.com/bf4) for tackling a whole lot of issues and pull requests for this release!** + +## Enhancements + + * New interface to specify multiple formatters. + See [#317](https://github.com/colszowka/simplecov/pull/317) (thanks @sferik) + * Document in the README how to exclude code from coverage reports, + and that the feature shouldn't be abused for skipping untested + private code. + See [#304](https://github.com/colszowka/simplecov/issues/304) + * Clarify Ruby version support. + See [#279](https://github.com/colszowka/simplecov/pull/279) (thanks @deivid-rodriguez) + +## Bugfixes + + * Ensure calculations return Floats, not Fixnum or Rational. Fixes segfaults with mathn. + See [#245](https://github.com/colszowka/simplecov/pull/245) (thanks to @bf4) + * Using `Kernel.exit` instead of exit to avoid uncaught throw :IRB_EXIT when + exiting irb sessions. + See [#287](https://github.com/colszowka/simplecov/pull/287) (thanks @wless1) + See [#285](https://github.com/colszowka/simplecov/issues/285) + * Does not look for .simplecov in ~/ when $HOME is not set. + See [#311](https://github.com/colszowka/simplecov/pull/311) (thanks @lasseebert) + * Exit with code only if it's Numeric > 0. + See [#302](https://github.com/colszowka/simplecov/pull/303)(thanks @hajder) + * Make default filter case insensitive. + See [#280](https://github.com/colszowka/simplecov/pull/280) (thanks @ryanatball) + * Improve regexp that matches functional tests. + See [#276](https://github.com/colszowka/simplecov/pull/276) (thanks @sferik) + * Fix TravisCI [#272](https://github.com/colszowka/simplecov/pull/272) [#278](https://github.com/colszowka/simplecov/pull/278), [#302](https://github.com/colszowka/simplecov/pull/302) + * Fix global config load. + See [#311](https://github.com/colszowka/simplecov/pull/311) (thanks @lasseebert) + v0.8.2, 2013-11-20 ([changes](https://github.com/colszowka/simplecov/compare/v0.8.1...v0.8.2)) ===================== ## Bugfixes - * Replaced the locking behaviour [via lockfile gem](https://github.com/colszowka/simplecov/pull/185) with - plain Ruby explicit file locking when merging results. This should make simplecov merging to behave well - on Windows again. - See [#258](https://github.com/colszowka/simplecov/issues/258) and + * Replaced the locking behaviour [via lockfile gem](https://github.com/colszowka/simplecov/pull/185) with + plain Ruby explicit file locking when merging results. This should make simplecov merging to behave well + on Windows again. + See [#258](https://github.com/colszowka/simplecov/issues/258) and [#223](https://github.com/colszowka/simplecov/pull/223) (thanks to @tomykaira) v0.8.1, 2013-11-10 ([changes](https://github.com/colszowka/simplecov/compare/v0.8.0...v0.8.1)) @@ -32,7 +83,7 @@ (especially when working with parallel_tests), the configuration, source file encodings, and command name guessing. The 0.8 line is the last one to cooperate with Ruby < 1.9. Starting with 0.9, SimpleCov will assume to be running in -Ruby 1.9+, and will not try to detect or bail silently on older Ruby versions. An appropriate deprecation warning +Ruby 1.9+, and will not try to detect or bail silently on older Ruby versions. An appropriate deprecation warning has been added. ## Features @@ -41,11 +92,11 @@ See [#238](https://github.com/colszowka/simplecov/pull/238) (thanks to @ms-tg) * You can now have a global `~/.simplecov` configuration file. See [#195](https://github.com/colszowka/simplecov/pull/195) (thanks to @spagalloco) - * simplecov-html now uses the MIT-licensed colorbox plugin. Some adjustments when viewing source files, + * simplecov-html now uses the MIT-licensed colorbox plugin. Some adjustments when viewing source files, including retaining the currently open file on refresh have been added. See [simplecov-html #15](https://github.com/colszowka/simplecov-html/pull/15) (thanks to @chetan) * Adds support for Rails 4 command guessing, removes default group `vendor/plugins`. - See [#181](https://github.com/colszowka/simplecov/pull/181) and + See [#181](https://github.com/colszowka/simplecov/pull/181) and [#203](https://github.com/colszowka/simplecov/pull/203) (thanks to @semanticart and @phallstrom) * You can now load simplecov without the default settings by doing `require 'simplecov/no_defaults'` or setting `ENV['SIMPLECOV_NO_DEFAULTS']`. Check `simplecov/defaults` to see what preconfigurations are getting @@ -53,13 +104,13 @@ * The result set merging now uses the `lockfile` gem to avoid race conditions. See [#185](https://github.com/colszowka/simplecov/pull/185) (thanks to @jshraibman-mdsol). * Automatically detect the usage of parallel_tests and adjust the command name with the test env number accordingly, - See [#64](https://github.com/colszowka/simplecov/issues/64) and + See [#64](https://github.com/colszowka/simplecov/issues/64) and [#185](https://github.com/colszowka/simplecov/pull/185) (thanks to @jshraibman-mdsol). ## Enhancements * Rename adapters to "profiles" given that they are bundles of settings. The old adapter methods are - deprecated, but remain available for now. + deprecated, but remain available for now. See [#207](https://github.com/colszowka/simplecov/pull/207) (thanks to @mikerobe) * Tweaks to the automatic test suite naming. In particular, `rspec/features` should now be correctly attributed to RSpec, not Cucumber. @@ -67,7 +118,7 @@ * MiniTest should now be identified correctly by the command name guesser. See [#244](https://github.com/colszowka/simplecov/pull/244) (thanks to @envygeeks) * Makes SimpleCov resilient to inclusion of mathn library. - See [#175](https://github.com/colszowka/simplecov/pull/175) and + See [#175](https://github.com/colszowka/simplecov/pull/175) and [#140](https://github.com/colszowka/simplecov/issues/140) (thanks to @scotje) * Allow coverage_dir to be an absolute path. * See [#190](https://github.com/colszowka/simplecov/pull/190) (thanks to @jshraibman-mdsol) @@ -76,7 +127,7 @@ * Work-arounds for the Coverage library shipped in JRuby 1.6 to behave in line with MRI. See [#174](https://github.com/colszowka/simplecov/pull/174) (thanks to @grddev) * Fix warning: instance variable @exit_status not initialized. - See [#242](https://github.com/colszowka/simplecov/pull/242) and + See [#242](https://github.com/colszowka/simplecov/pull/242) and [#213](https://github.com/colszowka/simplecov/pull/213) (thanks to @sferik and @infertux) ## Bugfixes @@ -84,13 +135,13 @@ * Correct result calculations for people using :nocov: tags. See [#215](https://github.com/colszowka/simplecov/pull/215) (thanks to @aokolish) * Average hits per line for groups of files is now computed correctly. - See [#192](http://github.com/colszowka/simplecov/pull/192) and + See [#192](http://github.com/colszowka/simplecov/pull/192) and [#179](http://github.com/colszowka/simplecov/issues/179) (thanks to @graysonwright) * Compatability with BINARY internal encoding. - See [#194](https://github.com/colszowka/simplecov/pull/194) and + See [#194](https://github.com/colszowka/simplecov/pull/194) and [#127](https://github.com/colszowka/simplecov/issues/127) (thanks to @justfalter) * Special characters in `SimpleCov.root` are now correctly escaped before being used as a RegExp. - See [#204](https://github.com/colszowka/simplecov/issues/204) and + See [#204](https://github.com/colszowka/simplecov/issues/204) and [#237](https://github.com/colszowka/simplecov/pull/237) (thanks to @rli9) v0.7.1, 2012-10-12 ([changes](https://github.com/colszowka/simplecov/compare/v0.7.0...v0.7.1)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CONTRIBUTING.md new/CONTRIBUTING.md --- old/CONTRIBUTING.md 1970-01-01 01:00:00.000000000 +0100 +++ new/CONTRIBUTING.md 2014-09-21 13:52:55.000000000 +0200 @@ -2,16 +2,26 @@ You can report issues at https://github.com/colszowka/simplecov/issues - * Search existing issues for your problem, chances are someone else already reported it. - * Please make sure you are running the latest version of simplecov. If that is not possible, - please specify in your report why you can't update to the latest version. +Search existing issues for your problem, chances are someone else already reported it. + * Include the SimpleCov version you are running in your report. - * Include your `ruby -e "puts RUBY_DESCRIPTION"`. Please also specify the gem versions of - Rails and your testing framework, if applicable. - This is extremely important for narrowing down the cause of your problem. + * If you are not running the latest version (please check), and you cannot update it, + please specify in your report why you can't update to the latest version. + * Include your `ruby -e "puts RUBY_DESCRIPTION"`. + * Please also specify the gem versions of Rails (if applicable). + * Include any other coverage gems you may be using and their versions. + * Include how you run your tests and which testing framework or frameworks you are running. + - If running via rake, please ensure you are requiring SimpleCov at the top of your Rakefile + - Otherwise, please ensure you are requiring and starting SimpleCov before requiring any application code. + For example, if running via RSpec, this would be at the top of your spec_helper. + - Have you tried using a [`.simplecov` file](https://github.com/colszowka/simplecov#using-simplecov-for-centralized-confi... + +Include as much sample code as you can to help us reproduce the issue. (Inline, repo link, or gist, are fine. A failing test would help the most.) + +This is extremely important for narrowing down the cause of your problem. Thanks! - + ## Making Contributions To fetch & test the library for development, do: @@ -19,11 +29,7 @@ $ git clone https://github.com/colszowka/simplecov.git $ cd simplecov $ bundle - $ rake appraisal:install - $ rake appraisal - -For more information on the appraisal gem (for testing against multiple gem dependency versions), please see -https://github.com/thoughtbot/appraisal/ + $ bundle exec rake If you want to contribute, please: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Gemfile new/Gemfile --- old/Gemfile 1970-01-01 01:00:00.000000000 +0100 +++ new/Gemfile 2014-09-21 13:52:55.000000000 +0200 @@ -1,20 +1,27 @@ -source "https://rubygems.org" -gemspec - -if 'Integration test (cucumber) suite is 1.9+ only'.respond_to? :encoding - gem 'aruba', '~> 0.5.1' - gem 'capybara', '~> 2.0' - gem 'poltergeist', '~> 1.1.0' - gem 'phantomjs', '~> 1.8.1' - gem 'cucumber', '>= 1.1.0' -end - -# shoulda-matchers depends on rails >= 4, but that does not work with Ruby < 1.9. So, to allow CI builds on those versions, -# we gotta stick with the 3.x line. -gem 'activesupport', '~> 3.2.0' +source 'https://rubygems.org' # Uncomment this to use local copy of simplecov-html in development when checked out # gem 'simplecov-html', :path => ::File.dirname(__FILE__) + '/../simplecov-html' # Uncomment this to use development version of html formatter from github # gem 'simplecov-html', :github => 'colszowka/simplecov-html' + +gemspec + +gem 'rake', '>= 10.3' + +group :test do + gem 'activesupport', '~> 3.2.0' # Older version required for Ruby 1.8.7 support + gem 'rspec', '>= 3.0' + gem 'rspec-legacy_formatters', '>= 1.0' + gem 'shoulda', '>= 3.5' + gem 'shoulda-matchers', '~> 2.0.0' # Older version required for Ruby 1.8.7 support +end + +if 'Integration test (cucumber) suite is 1.9+ only'.respond_to?(:encoding) + gem 'aruba', '~> 0.6' + gem 'capybara', '~> 2.0.0' + gem 'poltergeist', '~> 1.1' + gem 'phantomjs', '~> 1.9' + gem 'cucumber', '~> 1.1' +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/README.md 2014-09-21 13:52:55.000000000 +0200 @@ -1,6 +1,6 @@ -SimpleCov [![Build Status](https://secure.travis-ci.org/colszowka/simplecov.png)][Continuous Integration] [![Dependency Status](https://gemnasium.com/colszowka/simplecov.png)][Dependencies] [![Code Climate](https://codeclimate.com/github/colszowka/simplecov.png)](https://codeclimate.com/github/colszowka/simplecov) +SimpleCov [![Build Status](https://secure.travis-ci.org/colszowka/simplecov.png)][Continuous Integration] [![Dependency Status](https://gemnasium.com/colszowka/simplecov.png)][Dependencies] [![Code Climate](https://codeclimate.com/github/colszowka/simplecov.png)](https://codeclimate.com/github/colszowka/simplecov) [![Inline docs](http://inch-ci.org/github/colszowka/simplecov.png)](http://inch-ci.org/github/colszowka/simplecov) ========= -**Code coverage for Ruby 1.9** +**Code coverage for Ruby** * [Source Code] * [API documentation] @@ -9,7 +9,9 @@ * [Mailing List] * [Continuous Integration] -[Coverage]: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/coverage/rdoc/Coverage.html "API doc for Ruby 1.9's Coverage library" +**Important Notice: There is a bug that affects exit code handling on the 0.8 line of SimpleCov, see [#281](https://github.com/colszowka/simplecov/issues/281). Please use versions `~> 0.7.1` or `~> 0.9.0` to avoid this.** + +[Coverage]: http://www.ruby-doc.org/stdlib-2.1.0/libdoc/coverage/rdoc/Coverage.html "API doc for Ruby's Coverage library" [Source Code]: https://github.com/colszowka/simplecov "Source Code @ GitHub" [API documentation]: http://rubydoc.info/gems/simplecov/frames "RDoc API Documentation at Rubydoc.info" [Configuration]: http://rubydoc.info/gems/simplecov/SimpleCov/Configuration "Configuration options API documentation" @@ -23,19 +25,29 @@ [![You can support the development of SimpleCov via Pledgie - thanks for your help](https://pledgie.com/campaigns/18379.png?skin_name=chrome)][Pledgie] -SimpleCov is a code coverage analysis tool for Ruby 1.9. It uses [1.9's built-in Coverage][Coverage] library to gather code -coverage data, but makes processing its results much easier by providing a clean API to filter, group, merge, format -and display those results, thus giving you a complete code coverage suite that can be set up with just a couple lines of +SimpleCov is a code coverage analysis tool for Ruby. It uses [Ruby's built-in Coverage][Coverage] library to gather code +coverage data, but makes processing its results much easier by providing a clean API to filter, group, merge, format, +and display those results, giving you a complete code coverage suite that can be set up with just a couple lines of code. -In most cases, you'll want overall coverage results for your projects, including all types of tests, cucumber features -etc. SimpleCov automatically takes care of this by caching and then merging results when generating reports, so your +In most cases, you'll want overall coverage results for your projects, including all types of tests, Cucumber features, +etc. SimpleCov automatically takes care of this by caching and merging results when generating reports, so your report actually includes coverage across your test suites and thereby gives you a better picture of blank spots. -The official formatter of SimpleCov is packaged as a separate gem called [simplecov-html] but will be installed and configured +The official formatter of SimpleCov is packaged as a separate gem called [simplecov-html], but will be installed and configured automatically when you launch SimpleCov. If you're curious, you can find it [on Github, too][simplecov-html]. +## Contact + +*Code and Bug Reports* + +* [Issue Tracker](https://github.com/colszowka/simplecov/issues) + * See [CONTRIBUTING](https://github.com/colszowka/simplecov/blob/master/CONTRIBUTING.md) for how to contribute along with some common problems to check out before creating an issue. + +*Questions, Problems, Suggestions, etc.* + +* [Mailing List]: https://groups.google.com/forum/#!forum/simplecov "Open mailing list for discussion and announcements on Google Groups" Getting started --------------- @@ -79,8 +91,8 @@ coverage -If you're making a Rails application, SimpleCov comes with a built-in configurations (see below for information on profiles) -which will get you started with groups for your Controllers, Views, Models and Helpers. To use it, the first two lines of +If you're making a Rails application, SimpleCov comes with built-in configurations (see below for information on profiles) +that will get you started with groups for your Controllers, Views, Models and Helpers. To use it, the first two lines of your test_helper should be like this: ```ruby @@ -103,7 +115,7 @@ ## Use it with any framework! -Similarily to the usage with Test::Unit described above, the only thing you have to do is to add the simplecov +Similarly to the usage with Test::Unit described above, the only thing you have to do is to add the SimpleCov config to the very top of your Cucumber/RSpec/whatever setup file. Add the setup code to the **top** of `features/support/env.rb` (for Cucumber) or `spec/spec_helper.rb` (for RSpec). @@ -115,7 +127,7 @@ ``` You could even track what kind of code your UI testers are touching if you want to go overboard with things. SimpleCov does not -care what kind of framework it is running in, it just looks at what code is being executed and generates a report about it. +care what kind of framework it is running in; it just looks at what code is being executed and generates a report about it. ### Notes on specific frameworks and test utilities @@ -129,7 +141,7 @@ <b>Test/Unit 2</b> </td> <td> - Test Unit 2 used to mess with ARGV, leading to failure to detect the test process name in SimpleCov. + Test Unit 2 used to mess with ARGV, leading to a failure to detect the test process name in SimpleCov. <code>test-unit</code> releases 2.4.3+ (Dec 11th, 2011) should have this problem resolved. </td> <td> @@ -142,8 +154,8 @@ <b>Spork</b> </td> <td> - Because of the how Spork works internally (using preforking) there used to be trouble when using SimpleCov - with it, but that apparently has been resolved with a specific configuration strategy. See + Because of how Spork works internally (using preforking), there used to be trouble when using SimpleCov + with it, but that has apparently been resolved with a specific configuration strategy. See <a href="https://github.com/colszowka/simplecov/issues/42#issuecomment-4440284">this</a> comment. </td> <td> @@ -170,7 +182,7 @@ </td> <td> A user has reported problems with the coverage report using the riot framework. If you experience - similar trouble please follow up on the related Github issue. + similar trouble please follow up on the related GitHub issue. </td> <td> <a href="https://github.com/colszowka/simplecov/issues/80">SimpleCov #80</a> @@ -243,10 +255,10 @@ ## Filters Filters can be used to remove selected files from your coverage data. By default, a filter is applied that removes all files -OUTSIDE of your project's root directory - otherwise you'd end up with a billion of coverage reports for source files in the +OUTSIDE of your project's root directory - otherwise you'd end up with billions of coverage reports for source files in the gems you are using. -Of course you can define your own to remove things like configuration files, tests or whatever you don't need in your coverage +You can define your own to remove things like configuration files, tests or whatever you don't need in your coverage report. ### Defining custom filters @@ -276,7 +288,7 @@ Block filters receive a SimpleCov::SourceFile instance and expect your block to return either true (if the file is to be removed from the result) or false (if the result should be kept). Please check out the RDoc for SimpleCov::SourceFile to learn about the -methods available to you. In the above example, the filter will remove all files that have less then 5 lines of code. +methods available to you. In the above example, the filter will remove all files that have less than 5 lines of code. #### Custom filter class @@ -294,6 +306,23 @@ the filter, a true return value from this method will result in the removal of the given source_file. The filter_argument method is being set in the SimpleCov::Filter initialize method and thus is set to 5 in this example. +#### Ignoring/skipping code + +You can exclude code from the coverage report by wrapping it in `# :nocov:`. + +```ruby +# :nocov: +def skip_this_method + never_reached +end +# :nocov: +``` + +The name of the token can be changed to your liking. [Learn more about the nocov feature.][nocov] +[nocov]: https://github.com/colszowka/simplecov/blob/master/features/config_nocov_tok... + +**Note:** You shouldn't have to use the nocov token to skip private methods that are being included in your coverage. If you appropriately test the public interface of your classes and objects you should automatically get full coverage of your private methods. + ## Default root filter and coverage for things outside of it By default, SimpleCov filters everything outside of the `SimpleCov.root` directory. However, sometimes you may want @@ -313,8 +342,8 @@ ## Groups -You can separate your source files into groups. For example, in a rails app, you'll want to have separate listings for -Models, Controllers, Helpers, and Libs. Group definition works similar to Filters (and indeed also accepts custom +You can separate your source files into groups. For example, in a Rails app, you'll want to have separate listings for +Models, Controllers, Helpers, and Libs. Group definition works similarly to Filters (and also accepts custom filter classes), but source files end up in a group when the filter passes (returns true), as opposed to filtering results, which exclude files from results when the filter results in a true value. @@ -333,10 +362,10 @@ ## Merging results -Normally, you want to have your coverage analyzed across ALL of your test suites, right? +You normally want to have your coverage analyzed across ALL of your test suites, right? Simplecov automatically caches coverage results in your (coverage_path)/.resultset.json. Those results will then -be automatically merged when generating the result, so when coverage is set up properly for cucumber and your +be automatically merged when generating the result, so when coverage is set up properly for Cucumber and your unit / functional / integration tests, all of those test suites will be taken into account when building the coverage report. @@ -344,15 +373,15 @@ ### Test suite names -Simplecov tries to guess the name of the currently running test suite based upon the shell command the tests are running -on. This should work fine for Unit Tests, RSpec and Cucumber. If it fails, it will use the shell command +SimpleCov tries to guess the name of the currently running test suite based upon the shell command the tests are running +on. This should work fine for Unit Tests, RSpec, and Cucumber. If it fails, it will use the shell command that invoked the test suite as a command name. -If you have some non-standard setup and still want nicely labeled test suites, you have to give Simplecov a cue what the +If you have some non-standard setup and still want nicely labeled test suites, you have to give Simplecov a cue as to what the name of the currently running test suite is. You can do so by specifying SimpleCov.command_name in one test file that is part of your specific suite. -So, to customize the suite names on a Rails app (yeah, sorry for being Rails biased, but everyone knows what +To customize the suite names on a Rails app (yeah, sorry for being Rails-biased, but everyone knows what the structure of those projects is. You can apply this accordingly to the RSpecs in your Outlook-WebDAV-Calendar-Sync gem), you could do something like this: @@ -370,8 +399,8 @@ SimpleCov.command_name "features" ``` -Note that this has only to be invoked ONCE PER TEST SUITE, so even if you have 200 unit test files, specifying it in -some_test.rb is fair enough. +Note that this only has to be invoked ONCE PER TEST SUITE, so even if you have 200 unit test files, specifying it in +some_test.rb is enough. [simplecov-html] prints the used test suites in the footer of the generated coverage report. @@ -393,7 +422,7 @@ Because of this, SimpleCov has no explicit built-in mechanism to run coverage only on demand. -However, you can still accomplish this very easily by introducing a ENV variable conditional into your SimpleCov setup block, like this: +However, you can still accomplish this very easily by introducing an ENV variable conditional into your SimpleCov setup block, like this: ```ruby SimpleCov.start if ENV["COVERAGE"] @@ -408,8 +437,8 @@ ## Profiles -By default, Simplecov's only config assumption is that you only want coverage reports for files inside your project -root. To save you from repetitive configuration, you can use predefined blocks of configuration, called 'profiles', +By default, SimpleCov's only config assumption is that you only want coverage reports for files inside your project +root. To save yourself from repetitive configuration, you can use predefined blocks of configuration, called 'profiles', or define your own. You can then pass the name of the profile to be used as the first argument to SimpleCov.start. For example, simplecov @@ -427,7 +456,7 @@ end ``` -As you can see, it's just a SimpleCov.configure block. In your test_helper.rb, launch simplecov with: +As you can see, it's just a SimpleCov.configure block. In your test_helper.rb, launch SimpleCov with: ```ruby SimpleCov.start 'rails' @@ -444,7 +473,7 @@ ### Custom profiles You can load additional profiles with the SimpleCov.load_profile('xyz') method. This allows you to build upon an existing -profile and customize it so you can reuse it in unit tests and cucumber features, for example. +profile and customize it so you can reuse it in unit tests and Cucumber features. For example: ```ruby # lib/simplecov_custom_profile.rb @@ -466,7 +495,7 @@ ## Customizing exit behaviour -You can define what simplecov should do when your test suite finishes by customizing the at_exit hook: +You can define what SimpleCov should do when your test suite finishes by customizing the at_exit hook: ```ruby SimpleCov.at_exit do @@ -514,10 +543,10 @@ ## Using multiple formatters -If you want to use multiple result formats, as of SimpleCov 0.7.0 you can use the built-in MultiFormatter: +As for SimpleCov 0.9.0, you can specify multiple result formats: ```ruby -SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ +SimpleCov.formatters = [ SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::CSVFormatter, ] @@ -536,7 +565,7 @@ #### [simplecov-csv](https://github.com/fguillen/simplecov-csv) *by Fernando Guillen* -CSV formatter for SimpleCov code coverage tool for ruby 1.9+ +CSV formatter for SimpleCov #### [cadre](https://github.com/nyarly/cadre) *by Judson Lester* @@ -567,7 +596,11 @@ test suite crash right now. Whether SimpleCov will support JRuby/Rubinius in the future depends solely on whether those Ruby interpreters add the coverage library. -SimpleCov is built in [Continuous Integration] on 1.8.7, ree, 1.9.2, 1.9.3. +SimpleCov is built in [Continuous Integration] on 1.9.3, 2.0.0, 2.1.0 and ruby-head. + +## Want to find dead code in production? + +Try [coverband](https://github.com/danmayer/coverband). ## Contributing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Rakefile new/Rakefile --- old/Rakefile 1970-01-01 01:00:00.000000000 +0100 +++ new/Rakefile 2014-09-21 13:52:55.000000000 +0200 @@ -2,7 +2,6 @@ require 'rubygems' require 'bundler/setup' -require 'appraisal' Bundler::GemHelper.install_tasks # See https://github.com/colszowka/simplecov/issues/171 @@ -29,4 +28,3 @@ else task :default => [:test] end - Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/features/config_formatters.feature new/features/config_formatters.feature --- old/features/config_formatters.feature 1970-01-01 01:00:00.000000000 +0100 +++ new/features/config_formatters.feature 2014-09-21 13:52:55.000000000 +0200 @@ -50,3 +50,28 @@ When I successfully run `bundle exec rake test` Then the output should contain "lib/faked_project/meta_magic.rb (coverage: 100.0%)" And the output should match /Formatter [^\s]* failed with RuntimeError: Unable to format/ + + Scenario: With multiple formatters + Given SimpleCov for Test/Unit is configured with: + """ + require 'simplecov' + SimpleCov.formatters = [ + SimpleCov::Formatter::SimpleFormatter, + Class.new do + def format(result) + raise "Unable to format" + end + end + ] + + SimpleCov.at_exit do + puts SimpleCov.result.format!.join + end + SimpleCov.start do + add_group 'Libs', 'lib/faked_project/' + end + """ + + When I successfully run `bundle exec rake test` + Then the output should contain "lib/faked_project/meta_magic.rb (coverage: 100.0%)" + And the output should match /Formatter [^\s]* failed with RuntimeError: Unable to format/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/features/rspec_basic.feature new/features/rspec_basic.feature --- old/features/rspec_basic.feature 1970-01-01 01:00:00.000000000 +0100 +++ new/features/rspec_basic.feature 2014-09-21 13:52:55.000000000 +0200 @@ -14,7 +14,7 @@ When I open the coverage report generated with `bundle exec rspec spec` Then I should see the groups: | name | coverage | files | - | All Files | 90.74% | 6 | + | All Files | 91.23% | 6 | And I should see the source files: | name | coverage | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/features/rspec_groups_using_filter_class.feature new/features/rspec_groups_using_filter_class.feature --- old/features/rspec_groups_using_filter_class.feature 1970-01-01 01:00:00.000000000 +0100 +++ new/features/rspec_groups_using_filter_class.feature 2014-09-21 13:52:55.000000000 +0200 @@ -24,7 +24,7 @@ When I open the coverage report generated with `bundle exec rspec spec` Then I should see the groups: | name | coverage | files | - | All Files | 90.74% | 6 | + | All Files | 91.23% | 6 | | By filter class | 78.26% | 2 | | By string | 100.0% | 1 | | Ungrouped | 100.0% | 3 | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/features/step_definitions/html_steps.rb new/features/step_definitions/html_steps.rb --- old/features/step_definitions/html_steps.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/features/step_definitions/html_steps.rb 2014-09-21 13:52:55.000000000 +0200 @@ -13,18 +13,18 @@ Then /^I should see the groups:$/ do |table| expected_groups = table.hashes # Given group names should be the same number than those rendered in report - expected_groups.count.should == available_groups.count + expect(expected_groups.count).to eq(available_groups.count) # Verify each of the expected groups has a file list container and corresponding title and coverage number # as well as the correct number of links to files. expected_groups.each do |group| with_scope "#content ##{group["name"].gsub(/[^a-z]/i, '')}.file_list_container" do file_count_in_group = page.all('a.src_link').count - file_count_in_group.should == group["files"].to_i + expect(file_count_in_group).to eq(group["files"].to_i) with_scope "h2" do - page.should have_content(group["name"]) - page.should have_content(group["coverage"]) + expect(page).to have_content(group["name"]) + expect(page).to have_content(group["coverage"]) end end end @@ -32,14 +32,14 @@ Then /^I should see the source files:$/ do |table| expected_files = table.hashes - expected_files.length.should == available_source_files.count + expect(expected_files.length).to eq(available_source_files.count) # Find all filenames and their coverage present in coverage report files = available_source_files.map {|f| {"name" => f.find('h3').text, "coverage" => f.find('h4 > span').text} } - files.sort_by {|hsh| hsh["name"] }.should == expected_files.sort_by {|hsh| hsh["name"] } + expect(files.sort_by {|hsh| hsh["name"] }).to eq(expected_files.sort_by {|hsh| hsh["name"] }) end Then /^there should be (\d+) skipped lines in the source files$/ do |expected_count| - all(".source_table ol li.skipped").count.should == expected_count.to_i + expect(all(".source_table ol li.skipped").count).to eq(expected_count.to_i) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/features/step_definitions/web_steps.rb new/features/step_definitions/web_steps.rb --- old/features/step_definitions/web_steps.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/features/step_definitions/web_steps.rb 2014-09-21 13:52:55.000000000 +0200 @@ -31,27 +31,27 @@ Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector| with_scope(selector) do - page.should have_content(text) + expect(page).to have_content(text) end end Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector| regexp = Regexp.new(regexp) with_scope(selector) do - page.should have_xpath('//*', :text => regexp) + expect(page).to have_xpath('//*', :text => regexp) end end Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector| with_scope(selector) do - page.should have_no_content(text) + expect(page).to have_no_content(text) end end Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector| regexp = Regexp.new(regexp) with_scope(selector) do - page.should have_no_xpath('//*', :text => regexp) + expect(page).to have_no_xpath('//*', :text => regexp) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gemfiles/multi_json_legacy.gemfile new/gemfiles/multi_json_legacy.gemfile --- old/gemfiles/multi_json_legacy.gemfile 1970-01-01 01:00:00.000000000 +0100 +++ new/gemfiles/multi_json_legacy.gemfile 1970-01-01 01:00:00.000000000 +0100 @@ -1,13 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "aruba", "~> 0.5.1" -gem "capybara", "~> 2.0" -gem "poltergeist", "~> 1.1.0" -gem "phantomjs", "~> 1.8.1" -gem "cucumber", ">= 1.1.0" -gem "activesupport", "~> 3.2.0" -gem "multi_json", "~> 1.0.0" - -gemspec :path=>"../" \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gemfiles/multi_json_new.gemfile new/gemfiles/multi_json_new.gemfile --- old/gemfiles/multi_json_new.gemfile 1970-01-01 01:00:00.000000000 +0100 +++ new/gemfiles/multi_json_new.gemfile 1970-01-01 01:00:00.000000000 +0100 @@ -1,13 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "aruba", "~> 0.5.1" -gem "capybara", "~> 2.0" -gem "poltergeist", "~> 1.1.0" -gem "phantomjs", "~> 1.8.1" -gem "cucumber", ">= 1.1.0" -gem "activesupport", "~> 3.2.0" -gem "multi_json", ">= 1.3.4" - -gemspec :path=>"../" \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/simplecov/command_guesser.rb new/lib/simplecov/command_guesser.rb --- old/lib/simplecov/command_guesser.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/simplecov/command_guesser.rb 2014-09-21 13:52:55.000000000 +0200 @@ -9,11 +9,11 @@ # between rails unit/functional/integration tests impossible without this cached # item. attr_accessor :original_run_command - + def guess from_env || from_command_line_options || from_defined_constants end - + private def from_env @@ -24,10 +24,10 @@ "(#{number}/#{ENV['PARALLEL_TEST_GROUPS']})" end end - + def from_command_line_options case original_run_command - when /test\/functional\//, /test\/{.*?functional.*?}\// + when /test\/functional\//, /test\/\{.*functional.*\}\// "Functional Tests" when /test\/integration\// "Integration Tests" @@ -41,7 +41,7 @@ nil end end - + def from_defined_constants # If the command regexps fail, let's try checking defined constants. if defined?(RSpec) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/simplecov/configuration.rb new/lib/simplecov/configuration.rb --- old/lib/simplecov/configuration.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/simplecov/configuration.rb 2014-09-21 13:52:55.000000000 +0200 @@ -1,5 +1,6 @@ require 'fileutils' require 'docile' +require 'simplecov/formatter/multi_formatter' # # Bundles the configuration options used for SimpleCov. All methods # defined here are usable from SimpleCov directly. Please check out @@ -75,6 +76,24 @@ end # + # Sets the configured formatters. + # + def formatters=(formatters) + @formatter = SimpleCov::Formatter::MultiFormatter[*formatters] + end + + # + # Gets the configured formatters. + # + def formatters + if @formatter.is_a?(SimpleCov::Formatter::MultiFormatter) + @formatter.formatters + else + Array(formatter) + end + end + + # # Certain code blocks (i.e. Ruby-implementation specific code) can be excluded from # the coverage metrics by wrapping it inside # :nocov: comment blocks. The nocov token # can be configured to be any other string using this. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/simplecov/defaults.rb new/lib/simplecov/defaults.rb --- old/lib/simplecov/defaults.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/simplecov/defaults.rb 2014-09-21 13:52:55.000000000 +0200 @@ -4,7 +4,7 @@ SimpleCov.profiles.define 'root_filter' do # Exclude all files outside of simplecov root add_filter do |src| - !(src.filename =~ /^#{Regexp.escape(SimpleCov.root)}/) + !(src.filename =~ /^#{Regexp.escape(SimpleCov.root)}/i) end end @@ -77,12 +77,18 @@ SimpleCov::LastRun.write(:result => {:covered_percent => covered_percent}) end - exit @exit_status # Force exit with stored status (see github issue #5) + # Force exit with stored status (see github issue #5) + # unless it's nil or 0 (see github issue #281) + Kernel.exit @exit_status if @exit_status && @exit_status > 0 end # Autoload config from ~/.simplecov if present -global_config_path = File.join(File.expand_path("~"), '.simplecov') -load global_config_path if File.exist?(global_config_path) +require 'etc' +home_dir = File.expand_path('~') || Etc.getpwuid.dir || (user = ENV["USER"] && File.expand_path("~#{user}")) +if home_dir + global_config_path = File.join(home_dir, '.simplecov') + load global_config_path if File.exist?(global_config_path) +end # Autoload config from .simplecov if present config_path = File.join(SimpleCov.root, '.simplecov') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/simplecov/file_list.rb new/lib/simplecov/file_list.rb --- old/lib/simplecov/file_list.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/simplecov/file_list.rb 2014-09-21 13:52:55.000000000 +0200 @@ -31,14 +31,16 @@ end # Computes the coverage based upon lines covered and lines missed + # @return [Float] def covered_percent return 100.0 if empty? or lines_of_code == 0 - covered_lines * 100.0 / lines_of_code + Float(covered_lines * 100.0 / lines_of_code) end # Computes the strength (hits / line) based upon lines covered and lines missed + # @return [Float] def covered_strength - return 0 if empty? or lines_of_code == 0 - map {|f| f.covered_strength * f.lines_of_code }.inject(&:+) / lines_of_code + return 0.0 if empty? or lines_of_code == 0 + Float(map {|f| f.covered_strength * f.lines_of_code }.inject(&:+) / lines_of_code) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/simplecov/formatter/multi_formatter.rb new/lib/simplecov/formatter/multi_formatter.rb --- old/lib/simplecov/formatter/multi_formatter.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/simplecov/formatter/multi_formatter.rb 2014-09-21 13:52:55.000000000 +0200 @@ -1,25 +1,28 @@ -class SimpleCov::Formatter::MultiFormatter - def self.[](*args) - Class.new(self) do - define_method :formatters do - @formatters ||= args +module SimpleCov + module Formatter + class MultiFormatter + def self.[](*args) + Class.new(self) do + define_method :formatters do + @formatters ||= args + end + end end - end - end - def format(result) - formatters.map do |formatter| - begin - formatter.new.format(result) - rescue => e - STDERR.puts("Formatter #{formatter} failed with #{e.class}: #{e.message} (#{e.backtrace.first})") - nil + def format(result) + formatters.map do |formatter| + begin + formatter.new.format(result) + rescue => e + STDERR.puts("Formatter #{formatter} failed with #{e.class}: #{e.message} (#{e.backtrace.first})") + nil + end + end end - end - end - def formatters - @formatters ||= [] + def formatters + @formatters ||= [] + end + end end - end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/simplecov/formatter/simple_formatter.rb new/lib/simplecov/formatter/simple_formatter.rb --- old/lib/simplecov/formatter/simple_formatter.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/simplecov/formatter/simple_formatter.rb 2014-09-21 13:52:55.000000000 +0200 @@ -1,19 +1,23 @@ # # A ridiculously simple formatter for SimpleCov results. # -class SimpleCov::Formatter::SimpleFormatter - # Takes a SimpleCov::Result and generates a string out of it - def format(result) - output = "" - result.groups.each do |name, files| - output << "Group: #{name}\n" - output << "="*40 - output << "\n" - files.each do |file| - output << "#{file.filename} (coverage: #{file.covered_percent.round(2)}%)\n" +module SimpleCov + module Formatter + class SimpleFormatter + # Takes a SimpleCov::Result and generates a string out of it + def format(result) + output = "" + result.groups.each do |name, files| + output << "Group: #{name}\n" + output << "="*40 + output << "\n" + files.each do |file| + output << "#{file.filename} (coverage: #{file.covered_percent.round(2)}%)\n" + end + output << "\n" + end + output end - output << "\n" end - output end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/simplecov/result_merger.rb new/lib/simplecov/result_merger.rb --- old/lib/simplecov/result_merger.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/simplecov/result_merger.rb 2014-09-21 13:52:55.000000000 +0200 @@ -10,6 +10,10 @@ File.join(SimpleCov.coverage_path, '.resultset.json') end + def resultset_writelock + File.join(SimpleCov.coverage_path, '.resultset.json.lock') + end + # Loads the cached resultset from YAML and returns it as a Hash def resultset if stored_data @@ -66,12 +70,14 @@ # Saves the given SimpleCov::Result in the resultset cache def store_result(result) - new_set = resultset - command_name, data = result.to_hash.first - new_set[command_name] = data - File.open(resultset_path, "w+") do |f| + File.open(resultset_writelock, "w+") do |f| f.flock(File::LOCK_EX) - f.puts SimpleCov::JSON.dump(new_set) + new_set = resultset + command_name, data = result.to_hash.first + new_set[command_name] = data + File.open(resultset_path, "w+") do |f_| + f_.puts SimpleCov::JSON.dump(new_set) + end end true end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/simplecov/source_file.rb new/lib/simplecov/source_file.rb --- old/lib/simplecov/source_file.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/simplecov/source_file.rb 2014-09-21 13:52:55.000000000 +0200 @@ -111,24 +111,24 @@ return 100.0 if lines.length == 0 or lines.length == never_lines.count relevant_lines = lines.count - never_lines.count - skipped_lines.count if relevant_lines == 0 - 0 + 0.0 else - (covered_lines.count) * 100.0 / relevant_lines.to_f + Float((covered_lines.count) * 100.0 / relevant_lines.to_f) end end def covered_strength - return 0 if lines.length == 0 or lines.length == never_lines.count + return 0.0 if lines.length == 0 or lines.length == never_lines.count lines_strength = 0 lines.each do |c| lines_strength += c.coverage if c.coverage end - effective_lines_count = (lines.count - never_lines.count - skipped_lines.count).to_f + effective_lines_count = Float(lines.count - never_lines.count - skipped_lines.count) if effective_lines_count == 0 - 0 + 0.0 else strength = lines_strength / effective_lines_count round_float(strength, 1) @@ -178,9 +178,10 @@ private # ruby 1.9 could use Float#round(places) instead + # @return [Float] def round_float(float, places) - factor = (10 * places).to_f - (float * factor).round / factor + factor = Float(10 * places) + Float((float * factor).round / factor) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/simplecov/version.rb new/lib/simplecov/version.rb --- old/lib/simplecov/version.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/simplecov/version.rb 2014-09-21 13:52:55.000000000 +0200 @@ -1,3 +1,3 @@ module SimpleCov - VERSION = "0.8.2" -end \ No newline at end of file + VERSION = "0.9.1" +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 1970-01-01 01:00:00.000000000 +0100 +++ new/metadata 2014-09-21 13:52:55.000000000 +0200 @@ -1,113 +1,57 @@ --- !ruby/object:Gem::Specification name: simplecov version: !ruby/object:Gem::Version - version: 0.8.2 + version: 0.9.1 platform: ruby authors: - Christoph Olszowka autorequire: bindir: bin cert_chain: [] -date: 2013-11-20 00:00:00.000000000 Z +date: 2014-09-21 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: multi_json requirement: !ruby/object:Gem::Requirement requirements: - - - '>=' + - - "~>" - !ruby/object:Gem::Version - version: '0' + version: '1.0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - - '>=' + - - "~>" - !ruby/object:Gem::Version - version: '0' + version: '1.0' - !ruby/object:Gem::Dependency name: simplecov-html requirement: !ruby/object:Gem::Requirement requirements: - - - ~> + - - "~>" - !ruby/object:Gem::Version version: 0.8.0 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - - ~> + - - "~>" - !ruby/object:Gem::Version version: 0.8.0 - !ruby/object:Gem::Dependency name: docile requirement: !ruby/object:Gem::Requirement requirements: - - - ~> + - - "~>" - !ruby/object:Gem::Version version: 1.1.0 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - - ~> + - - "~>" - !ruby/object:Gem::Version version: 1.1.0 -- !ruby/object:Gem::Dependency - name: appraisal - requirement: !ruby/object:Gem::Requirement - requirements: - - - ~> - - !ruby/object:Gem::Version - version: 0.5.1 - type: :development - prerelease: false - version_requirements: !ruby/object:Gem::Requirement - requirements: - - - ~> - - !ruby/object:Gem::Version - version: 0.5.1 -- !ruby/object:Gem::Dependency - name: rake - requirement: !ruby/object:Gem::Requirement - requirements: - - - ~> - - !ruby/object:Gem::Version - version: 10.0.3 - type: :development - prerelease: false - version_requirements: !ruby/object:Gem::Requirement - requirements: - - - ~> - - !ruby/object:Gem::Version - version: 10.0.3 -- !ruby/object:Gem::Dependency - name: rspec - requirement: !ruby/object:Gem::Requirement - requirements: - - - ~> - - !ruby/object:Gem::Version - version: 2.13.0 - type: :development - prerelease: false - version_requirements: !ruby/object:Gem::Requirement - requirements: - - - ~> - - !ruby/object:Gem::Version - version: 2.13.0 -- !ruby/object:Gem::Dependency - name: shoulda - requirement: !ruby/object:Gem::Requirement - requirements: - - - ~> - - !ruby/object:Gem::Version - version: 3.4.0 - type: :development - prerelease: false - version_requirements: !ruby/object:Gem::Requirement - requirements: - - - ~> - - !ruby/object:Gem::Version - version: 3.4.0 description: Code coverage for Ruby 1.9+ with a powerful configuration library and automatic merging of coverage across test suites email: @@ -116,10 +60,10 @@ extensions: [] extra_rdoc_files: [] files: -- .gitignore -- .travis.yml -- .yardopts -- Appraisals +- ".gitignore" +- ".rspec" +- ".travis.yml" +- ".yardopts" - CHANGELOG.md - CONTRIBUTING.md - Gemfile @@ -160,8 +104,6 @@ - features/test_unit_groups_using_filter_class.feature - features/test_unit_without_simplecov.feature - features/unicode_compatiblity.feature -- gemfiles/multi_json_legacy.gemfile -- gemfiles/multi_json_new.gemfile - lib/simplecov.rb - lib/simplecov/command_guesser.rb - lib/simplecov/configuration.rb @@ -237,17 +179,17 @@ - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - - '>=' + - - ">=" - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - - '>=' + - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.0.3 +rubygems_version: 2.2.2 signing_key: specification_version: 4 summary: Code coverage for Ruby 1.9+ with a powerful configuration library and automatic diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/simplecov.gemspec new/simplecov.gemspec --- old/simplecov.gemspec 1970-01-01 01:00:00.000000000 +0100 +++ new/simplecov.gemspec 2014-09-21 13:52:55.000000000 +0200 @@ -13,15 +13,10 @@ gem.summary = gem.description gem.license = "MIT" - gem.add_dependency 'multi_json' + gem.add_dependency 'multi_json', '~> 1.0' gem.add_dependency 'simplecov-html', '~> 0.8.0' gem.add_dependency 'docile', '~> 1.1.0' - gem.add_development_dependency 'appraisal', '~> 0.5.1' - gem.add_development_dependency 'rake', '~> 10.0.3' - gem.add_development_dependency 'rspec', '~> 2.13.0' - gem.add_development_dependency 'shoulda', '~> 3.4.0' - gem.files = `git ls-files`.split("\n") gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/faked_project/features/step_definitions/my_steps.rb new/test/faked_project/features/step_definitions/my_steps.rb --- old/test/faked_project/features/step_definitions/my_steps.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/faked_project/features/step_definitions/my_steps.rb 2014-09-21 13:52:55.000000000 +0200 @@ -1,23 +1,23 @@ Given /^I want to keep stuff simple$/ do - 1.should == 1 + expect(1).to eq(1) end When /^I write my cukes for the fake project$/ do - 1.should == 1 + expect(1).to eq(1) end Then /^I make all neccessary tests in a single step$/ do - FakedProject.foo.should == 'bar' + expect(FakedProject.foo).to eq('bar') - FrameworkSpecific.cucumber.should == "Only tested in Cucumber" + expect(FrameworkSpecific.cucumber).to eq("Only tested in Cucumber") - FakedProject.a_class_method.should == "this is a mixed-in class method" + expect(FakedProject.a_class_method).to eq("this is a mixed-in class method") - FakedProject.new.an_instance_method.should == "this is a mixed-in instance method" - FakedProject.new.dynamic.should == "A dynamically defined instance method" + expect(FakedProject.new.an_instance_method).to eq("this is a mixed-in instance method") + expect(FakedProject.new.dynamic).to eq("A dynamically defined instance method") something = SomeClass.new("foo") - something.reverse.should == 'oof' - something.compare_with('foo').should be_true + expect(something.reverse).to eq('oof') + expect(something.compare_with('foo')).to be true end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/faked_project/spec/faked_spec.rb new/test/faked_project/spec/faked_spec.rb --- old/test/faked_project/spec/faked_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/faked_project/spec/faked_spec.rb 2014-09-21 13:52:55.000000000 +0200 @@ -2,10 +2,10 @@ describe FakedProject do it "should return proper foo" do - FakedProject.foo.should == 'bar' + expect(FakedProject.foo).to eq('bar') end it "should test it's framework specific method" do - FrameworkSpecific.rspec.should == "Only tested in RSpec" + expect(FrameworkSpecific.rspec).to eq("Only tested in RSpec") end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/faked_project/spec/meta_magic_spec.rb new/test/faked_project/spec/meta_magic_spec.rb --- old/test/faked_project/spec/meta_magic_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/faked_project/spec/meta_magic_spec.rb 2014-09-21 13:52:55.000000000 +0200 @@ -2,9 +2,14 @@ describe FakedProject do it "should have added a class method to FakedProject" do - FakedProject.a_class_method.should == "this is a mixed-in class method" + expect(FakedProject.a_class_method).to eq("this is a mixed-in class method") end - its(:an_instance_method) { should == "this is a mixed-in instance method" } - its(:dynamic) { should == "A dynamically defined instance method" } + it "should have added a mixed-in instance method to FakedProject" do + expect(subject.an_instance_method).to eq("this is a mixed-in instance method") + end + + it "should have added a dyntamically-defined instance method to FakedProject" do + expect(subject.dynamic).to eq("A dynamically defined instance method") + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/faked_project/spec/some_class_spec.rb new/test/faked_project/spec/some_class_spec.rb --- old/test/faked_project/spec/some_class_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/faked_project/spec/some_class_spec.rb 2014-09-21 13:52:55.000000000 +0200 @@ -3,8 +3,11 @@ describe SomeClass do subject { SomeClass.new("foo") } - its(:reverse) { should == 'oof' } + it "should be reversible" do + expect(subject.reverse).to eq('oof') + end + it "should compare with 'foo'" do - subject.compare_with('foo').should be_true + expect(subject.compare_with('foo')).to be true end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/fixtures/frameworks/rspec_bad.rb new/test/fixtures/frameworks/rspec_bad.rb --- old/test/fixtures/frameworks/rspec_bad.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/fixtures/frameworks/rspec_bad.rb 2014-09-21 13:52:55.000000000 +0200 @@ -4,6 +4,6 @@ SimpleCov.start describe 'exit status' do it "should exit with a non-zero exit status when assertion fails" do - 1.should == 2 + expect(1).to eq(2) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/fixtures/frameworks/rspec_good.rb new/test/fixtures/frameworks/rspec_good.rb --- old/test/fixtures/frameworks/rspec_good.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/fixtures/frameworks/rspec_good.rb 2014-09-21 13:52:55.000000000 +0200 @@ -4,6 +4,6 @@ SimpleCov.start describe 'exit status' do it "should exit with a zero exit status when assertion fails" do - 1.should == 1 + expect(1).to eq(1) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/helper.rb new/test/helper.rb --- old/test/helper.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/helper.rb 2014-09-21 13:52:55.000000000 +0200 @@ -9,10 +9,6 @@ def source_fixture(filename) File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', filename)) end - - # Keep 1.8-rubies from complaining about missing tests in each file that covers only 1.9 functionality - def default_test - end end require 'shoulda_macros' -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de