Add proof-of-concept dev-php/PHP_CodeSniffer ebuild.
[mjo-overlay.git] / dev-php / PHP_CodeSniffer / PHP_CodeSniffer-2.5.1.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=6
6
7 DESCRIPTION="Detect violations of PHP code standards"
8 HOMEPAGE="https://github.com/squizlabs/PHP_CodeSniffer"
9 SRC_URI="https://github.com/squizlabs/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
10
11 LICENSE="BSD"
12 SLOT="0"
13 KEYWORDS="~amd64 ~x86"
14 IUSE="test"
15
16 DEPEND="test? ( >=dev-php/phpunit-4 )"
17 RDEPEND="dev-lang/php:*[cli,tokenizer,xmlwriter]"
18
19 DOCS=( CONTRIBUTING.md README.md )
20 src_install() {
21 insinto "/usr/share/${PN}"
22 doins -r CodeSniffer CodeSniffer.php
23
24 # These load code via relative paths, so they have to be symlinked
25 # and not dobin'd.
26 exeinto "/usr/share/${PN}/scripts"
27 for script in phpcbf phpcs; do
28 doexe "scripts/${script}"
29 dosym "/usr/share/${PN}/scripts/${script}" "/usr/bin/${script}"
30 done
31
32 einstalldocs
33 }
34
35 # The test suite isn't part of the tarball at the moment, keep an eye on
36 # https://github.com/squizlabs/PHP_CodeSniffer/issues/548
37 RESTRICT=test
38 src_test() {
39 phpunit || die "test suite failed"
40 }