summaryrefslogtreecommitdiff
path: root/app-emacs/ert-runner/ert-runner-0.8.0-r1.ebuild
blob: 5c662491b421d06b83c6a866cd92fa2482e24a6a (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit elisp edo

DESCRIPTION="Opinionated Emacs Ert testing workflow"
HOMEPAGE="https://github.com/rejeep/ert-runner.el/"

if [[ "${PV}" == *9999* ]] ; then
	inherit git-r3

	EGIT_REPO_URI="https://github.com/rejeep/${PN}.el.git"
else
	SRC_URI="https://github.com/rejeep/${PN}.el/archive/v${PV}.tar.gz
		-> ${P}.tar.gz"
	S="${WORKDIR}/${PN}.el-${PV}"

	KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~riscv ~sparc ~x86"
fi

LICENSE="GPL-3+"
SLOT="0"
IUSE="test"
RESTRICT="!test? ( test )"

RDEPEND="
	app-emacs/ansi
	app-emacs/commander
	app-emacs/dash
	app-emacs/f
	app-emacs/dash
	app-emacs/shut-up
"
BDEPEND="
	${RDEPEND}
	test? (
		app-emacs/ecukes
	)
"

ELISP_REMOVE="
	Makefile
	features/reporter.feature
"
PATCHES=(
	"${FILESDIR}/${PN}-bin-launcher-fix.patch"
)

DOCS=( README.md )
SITEFILE="50${PN}-gentoo.el"

src_prepare() {
	elisp_src_prepare

	# There are two "ert-runner" launchers,
	# the one in "${S}" will be installed,
	# the one in ./bin/ert-runner will be used only for tests.

	# For later install.
	sed "./bin/${PN}" \
		-e "s|@SITELISP@|${EPREFIX}${SITELISP}/${PN}|" \
		> "./${PN}.bash" \
		|| die

	# For tests.
	sed -i "./bin/${PN}" -e "s|@SITELISP@|${S}|" || die
}

src_compile() {
	elisp_src_compile
	elisp-compile ./reporters/*.el
}

src_test() {
	# Set up fake Cask for tests.
	mkdir -p "${T}/bin" || die
	cat <<-EOF >> "${T}/bin/cask" || die
	#!/usr/bin/env bash
	set -e
	if [[ "\${1}" != exec ]] ; then echo "Not a exec call!" ; exit 1 ; fi
	shift
	"\${@}"
	EOF
	chmod +x "${T}/bin/cask" || die
	local -x PATH="${T}/bin:${PATH}" || die

	edo ecukes --debug --reporter spec --script --verbose ./features
}

src_install() {
	elisp_src_install
	elisp-install "${PN}/reporters" ./reporters/*.el{,c}

	exeinto /usr/bin
	newexe "./${PN}.bash" "${PN}"
}