Skip to content

Commit

Permalink
Fixing Coveralls for testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
halostatue committed Jan 11, 2017
1 parent ff796c2 commit 32727d6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 32 deletions.
6 changes: 2 additions & 4 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ home :: https://github.com/halostatue/diff-lcs
code :: https://github.com/halostatue/diff-lcs
bugs :: https://github.com/halostatue/diff-lcs/issues
rdoc :: http://rubydoc.info/github/halostatue/diff-lcs
continuous integration :: {<img src="https://travis-ci.org/halostatue/diff-lcs.png" />}[https://travis-ci.org/halostatue/diff-lcs]
test coverage :: {<img src="https://coveralls.io/repos/halostatue/diff-lcs/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/halostatue/diff-lcs]

== Description

Expand Down Expand Up @@ -76,10 +78,6 @@ Mario I. Wolczko's {Smalltalk version 1.2}[ftp://st.cs.uiuc.edu/pub/Smalltalk/MA
This library is called Diff::LCS because of an early version of Algorithm::Diff
which was restrictively licensed.

== Continuous Integration Status

{<img src="https://travis-ci.org/halostatue/diff-lcs.png" />}[https://travis-ci.org/halostatue/diff-lcs]

:include: Contributing.rdoc

:include: License.rdoc
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if RUBY_VERSION >= '1.9'
namespace :spec do
desc "Submit test coverage to Coveralls"
task :coveralls do
ENV['COVERAGE'] = ENV['COVERALLS'] = 'yes'
ENV['COVERALLS'] = 'yes'
end

desc "Runs test coverage. Only works Ruby 1.9+ and assumes 'simplecov' is installed."
Expand Down
48 changes: 21 additions & 27 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,33 @@
require 'pathname'
require 'psych'

if ENV['COVERAGE']
if ENV['COVERALLS']
require 'coveralls'
Coveralls.wear!
elsif ENV['COVERAGE']
require 'simplecov'

if ENV['COVERALLS']
require 'coveralls'
formatters = Coveralls::SimpleCov::Formatter
else
def try_require(resource, &block)
require resource
block.call
rescue LoadError
nil
end

formatters = [ SimpleCov::Formatter::HTMLFormatter ]
def require_do(resource, &block)
require resource
block.call
rescue LoadError
nil
end

try_require('simplecov-rcov') { formatters << SimpleCov::Formatter::RcovFormatter }
try_require('simplecov-vim/formatter') {
formatters << SimpleCov::Formatter::VimFormatter
}
try_require('simplecov-sublime-ruby-coverage') {
formatters << SimpleCov::Formatter::SublimeRubyCoverageFormatter
}
formatters = [ SimpleCov::Formatter::HTMLFormatter ]

formatters = if formatters.size == 1
formatters.first
else
SimpleCov::Formatter::MultiFormatter[*formatters]
end
end
require_do('simplecov-rcov') {
formatters << SimpleCov::Formatter::RcovFormatter
}
require_do('simplecov-vim/formatter') {
formatters << SimpleCov::Formatter::VimFormatter
}
require_do('simplecov-sublime-ruby-coverage') {
formatters << SimpleCov::Formatter::SublimeRubyCoverageFormatter
}

SimpleCov.start do
formatter formatters
formatter SimpleCov::Formatter::MultiFormatter[*formatters]
end
end

Expand Down

0 comments on commit 32727d6

Please sign in to comment.