diff options
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | php-doctrine-inflector.spec | 72 |
2 files changed, 35 insertions, 44 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ab5c4f --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/php-doctrine-inflector.spec b/php-doctrine-inflector.spec index 68ef7a5..44837cc 100644 --- a/php-doctrine-inflector.spec +++ b/php-doctrine-inflector.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-doctrine-inflector # -# Copyright (c) 2013-2016 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2013-2017 Shawn Iwinski <shawn.iwinski@gmail.com> # # License: MIT # http://opensource.org/licenses/MIT @@ -28,7 +28,7 @@ Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 1%{?github_release}%{?dist} +Release: 4%{?github_release}%{?dist} Summary: Common string manipulations with regard to casing and singular/plural rules Group: Development/Libraries @@ -36,7 +36,6 @@ License: MIT URL: https://github.com/%{github_owner}/%{github_name} Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch # Tests %if %{with_tests} @@ -47,7 +46,7 @@ BuildRequires: php(language) >= %{php_min_ver} BuildRequires: php-pcre BuildRequires: php-spl # Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif # composer.json @@ -55,7 +54,7 @@ Requires: php(language) >= %{php_min_ver} # phpcompatinfo (computed from version 1.1.0) Requires: php-pcre # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -70,70 +69,51 @@ Autoloader: %{phpdir}/Doctrine/Common/Inflector/autoload.php %prep %setup -qn %{github_name}-%{github_commit} + +%build : Create autoloader cat <<'AUTOLOAD' | tee lib/Doctrine/Common/Inflector/autoload.php <?php /** * Autoloader for %{name} and its' dependencies * (created by %{name}-%{version}-%{release}). - * - * @return \Symfony\Component\ClassLoader\ClassLoader */ +require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; -if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) { - if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) { - require_once '%{phpdir}/Symfony/Component/ClassLoader/ClassLoader.php'; - } - - $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader(); - $fedoraClassLoader->register(); -} - -$fedoraClassLoader->addPrefix('Doctrine\\Common\\Inflector\\', dirname(dirname(dirname(__DIR__)))); - -return $fedoraClassLoader; +\Fedora\Autoloader\Autoload::addPsr4('Doctrine\\Common\\Inflector\\', __DIR__); AUTOLOAD -%build -# Empty build section, nothing required - - %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{phpdir} cp -rp lib/* %{buildroot}%{phpdir}/ %check %if %{with_tests} -: Create tests autoloader -cat <<'AUTOLOAD' | tee autoload.php +: Create tests bootstrap +cat <<'BOOTSTRAP' | tee bootstrap.php <?php - -$fedoraClassLoader = - require_once '%{buildroot}%{phpdir}/Doctrine/Common/Inflector/autoload.php'; - -$fedoraClassLoader->addPrefix('Doctrine\\Tests', __DIR__ . '/tests'); -AUTOLOAD - -: Run tests -%{_bindir}/phpunit -v --bootstrap autoload.php - -if which php70; then - php70 %{_bindir}/phpunit -v --bootstrap autoload.php -fi +require_once '%{buildroot}%{phpdir}/Doctrine/Common/Inflector/autoload.php'; +\Fedora\Autoloader\Autoload::addPsr0('Doctrine\\Tests', __DIR__.'/tests'); +BOOTSTRAP + +: Upstream tests +RETURN_CODE=0 +PHPUNIT=$(which phpunit) +for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71 php72; do + if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then + $PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php \ + || RETURN_CODE=1 + fi +done +exit $RETURN_CODE %else : Tests skipped %endif -%clean -rm -rf %{buildroot} - - %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE %doc *.md @@ -144,6 +124,10 @@ rm -rf %{buildroot} %changelog +* Sat May 13 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.1.0-4 +- Switch autoloader to php-composer(fedora/autoloader) +- Test with SCLs if available + * Sun Jan 03 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.1.0-1 - Updated to 1.1.0 (RHBZ #1279884) |