summaryrefslogtreecommitdiff
blob: 22e7cc4d013007531da04c2c6daf34abd9080e06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

USE_RUBY="ruby27 ruby30 ruby31 ruby32"

RUBY_FAKEGEM_EXTRADOC="CHANGELOG.md README.md"

RUBY_FAKEGEM_DOCDIR="doc"
RUBY_FAKEGEM_RECIPE_DOC="none"

RUBY_FAKEGEM_GEMSPEC="simplecov.gemspec"

inherit ruby-fakegem

DESCRIPTION="Code coverage with a configuration library and merging across test suites"
HOMEPAGE="https://github.com/simplecov-ruby/simplecov"
SRC_URI="https://github.com/simplecov-ruby/simplecov/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"

KEYWORDS="~amd64 ~riscv"
SLOT="0.8"
IUSE="doc"

ruby_add_rdepend "
	dev-ruby/simplecov-html:0.12
	>=dev-ruby/simplecov_json_formatter-0.1:0
	>=dev-ruby/docile-1.1:0"

ruby_add_bdepend "test? (
	dev-ruby/bundler
	dev-ruby/rspec:3
	dev-ruby/test-unit:2
)"

# There are also cucumber tests that require poltergeist and unpackaged phantomjs gem.

PATCHES=(
	"${FILESDIR}"/${PN}-0.22.0-ruby32-gentoo.patch
)

all_ruby_prepare() {
	# Avoid test depending on spawning ruby and having timing issues
	sed -i -e '/blocks other processes/askip "gentoo"' spec/result_merger_spec.rb || die

	sed -i -e '5i require "bundler"' spec/helper.rb || die

	sed -e '/start_coverage_measurement/,/^  end/ s|with(lines: true)|with({lines: true})|' \
		-e '/start_coverage_measurement/,/^  end/ s|with(lines: true, branches: true)|with({lines: true, branches: true})|' \
		-i spec/simplecov_spec.rb || die
}

each_ruby_test() {
	sed -i -e "s:@GENTOO_RUBY@:${RUBY}:" spec/coverage_for_eval_spec.rb || die
	RSPEC_VERSION=3 ruby-ng_rspec spec/ || die
}