icingaweb2/test/setup_vendor.sh

74 lines
2.1 KiB
Bash
Raw Normal View History

2017-02-08 15:59:12 +01:00
#!/bin/bash
set -ex
ICINGAWEB_HOME=${ICINGAWEB_HOME:="$(dirname "$(readlink -f "$(dirname "$0")")")"}
PHPCS_VERSION=${PHPCS_VERSION:=3.5.3}
2017-02-08 15:59:12 +01:00
MOCKERY_VERSION=${MOCKERY_VERSION:=0.9.9}
HAMCREST_VERSION=${HAMCREST_VERSION:=2.0.0}
2018-05-08 09:16:47 +02:00
PHPUNIT_VERSION=${PHPUNIT_VERSION:=5.7}
2017-02-08 15:59:12 +01:00
cd "${ICINGAWEB_HOME}"
2017-02-08 15:59:12 +01:00
test -d vendor || mkdir vendor
2018-12-05 14:05:46 +01:00
cd vendor/
del_old_link() {
if [ -L "$1" ]; then
rm "$1"
fi
}
2017-02-08 15:59:12 +01:00
# phpunit
2018-12-05 14:05:46 +01:00
phpunit_path="phpunit-${PHPUNIT_VERSION}"
2017-02-08 15:59:12 +01:00
if [ ! -e "${phpunit_path}".phar ]; then
wget -O "${phpunit_path}".phar https://phar.phpunit.de/phpunit-${PHPUNIT_VERSION}.phar
fi
ln -svf "${phpunit_path}".phar phpunit.phar
2018-12-05 14:05:46 +01:00
del_old_link ../phpunit.phar
2017-02-08 15:59:12 +01:00
# phpcs
2018-12-05 14:05:46 +01:00
phpcs_path="phpcs-${PHPCS_VERSION}"
2017-02-08 15:59:12 +01:00
if [ ! -e "${phpcs_path}".phar ]; then
wget -O "${phpcs_path}".phar \
https://github.com/squizlabs/PHP_CodeSniffer/releases/download/${PHPCS_VERSION}/phpcs.phar
fi
ln -svf "${phpcs_path}".phar phpcs.phar
2018-12-05 14:05:46 +01:00
del_old_link ../phpcs.phar
phpcbf_path="phpcbf-${PHPCS_VERSION}"
if [ ! -e "${phpcbf_path}".phar ]; then
wget -O "${phpcbf_path}".phar \
https://github.com/squizlabs/PHP_CodeSniffer/releases/download/${PHPCS_VERSION}/phpcbf.phar
fi
ln -svf "${phpcbf_path}".phar phpcbf.phar
2018-12-05 14:05:46 +01:00
del_old_link ../phpcbf.phar
2017-02-08 15:59:12 +01:00
# mockery
2018-12-05 14:05:46 +01:00
mockery_path="mockery-${MOCKERY_VERSION}"
2017-02-08 15:59:12 +01:00
if [ ! -e "${mockery_path}".tar.gz ]; then
wget -O "${mockery_path}".tar.gz \
https://github.com/mockery/mockery/archive/${MOCKERY_VERSION}.tar.gz
fi
if [ ! -d "${mockery_path}" ]; then
2018-12-05 14:05:46 +01:00
tar xf "${mockery_path}".tar.gz
2017-02-08 15:59:12 +01:00
fi
ln -svf "${mockery_path}"/library/Mockery Mockery
ln -svf "${mockery_path}"/library/Mockery.php Mockery.php
2018-12-05 14:05:46 +01:00
del_old_link ../Mockery
del_old_link ../Mockery.php
2017-02-08 15:59:12 +01:00
# hamcrest
2018-12-05 14:05:46 +01:00
hamcrest_path="hamcrest-php-${HAMCREST_VERSION}"
2017-02-08 15:59:12 +01:00
if [ ! -e "${hamcrest_path}".tar.gz ]; then
wget -O "${hamcrest_path}".tar.gz \
https://github.com/hamcrest/hamcrest-php/archive/v${HAMCREST_VERSION}.tar.gz
fi
if [ ! -d "${hamcrest_path}" ]; then
2018-12-05 14:05:46 +01:00
tar xf "${hamcrest_path}".tar.gz
2017-02-08 15:59:12 +01:00
fi
ln -svf "${hamcrest_path}"/hamcrest/Hamcrest Hamcrest
ln -svf "${hamcrest_path}"/hamcrest/Hamcrest.php Hamcrest.php
2018-12-05 14:05:46 +01:00
del_old_link ../Hamcrest
del_old_link ../Hamcrest.php