diff options
-rw-r--r-- | php-composer-installers-pr226.patch | 23 | ||||
-rw-r--r-- | php-composer-installers.spec | 146 |
2 files changed, 169 insertions, 0 deletions
diff --git a/php-composer-installers-pr226.patch b/php-composer-installers-pr226.patch new file mode 100644 index 0000000..cd80d26 --- /dev/null +++ b/php-composer-installers-pr226.patch @@ -0,0 +1,23 @@ +From c1507c6d096bf513678fb62aa3e9fa2ad913b6f7 Mon Sep 17 00:00:00 2001 +From: Fabian Vogler <fabian@equivalence.ch> +Date: Wed, 18 Mar 2015 18:22:52 +0100 +Subject: [PATCH] Fix PHPUnit check in CakePHPInstallerTest + +Fix tests on Travis CI +--- + tests/Composer/Installers/Test/CakePHPInstallerTest.php | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/Composer/Installers/Test/CakePHPInstallerTest.php b/tests/Composer/Installers/Test/CakePHPInstallerTest.php +index 976bd9b..523e847 100644 +--- a/tests/Composer/Installers/Test/CakePHPInstallerTest.php ++++ b/tests/Composer/Installers/Test/CakePHPInstallerTest.php +@@ -100,7 +100,7 @@ public function testGetLocations() { + + $this->setCakephpVersion($rm, '~8.8'); + $result = $installer->getLocations(); +- $this->assertEquals('vendor/{$vendor}/{$name}/', $result['plugin']); ++ $this->assertContains('vendor/{$vendor}/{$name}/', $result['plugin']); + } + + protected function setCakephpVersion($rm, $version) { diff --git a/php-composer-installers.spec b/php-composer-installers.spec new file mode 100644 index 0000000..246c613 --- /dev/null +++ b/php-composer-installers.spec @@ -0,0 +1,146 @@ +# +# Fedora spec file for php-composer-installers +# +# Copyright (c) 2015 Shawn Iwinski <shawn.iwinski@gmail.com> +# +# License: MIT +# http://opensource.org/licenses/MIT +# +# Please preserve changelog entries +# + +%global github_owner composer +%global github_name installers +%global github_version 1.0.21 +%global github_commit d64e23fce42a4063d63262b19b8e7c0f3b5e4c45 + +%global composer_vendor composer +%global composer_project installers + +# Build using "--without tests" to disable tests +%global with_tests 0%{!?_without_tests:1} + +%{!?phpdir: %global phpdir %{_datadir}/php} + +Name: php-%{composer_vendor}-%{composer_project} +Version: %{github_version} +Release: 1%{?github_release}%{?dist} +Summary: A multi-framework Composer library installer + +Group: Development/Libraries +License: MIT +URL: https://github.com/%{github_owner}/%{github_name} +Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz + +# Fix PHPUnit check in CakePHPInstallerTest +# https://github.com/composer/installers/pull/226 +Patch0: %{name}-pr226.patch + +BuildArch: noarch +# Tests +%if %{with_tests} +## composer.json +BuildRequires: %{_bindir}/phpunit +BuildRequires: php-composer(composer/composer) +## phpcompatinfo (computed from version 1.0.21) +BuildRequires: php(language) >= 5.3.0 +BuildRequires: php-pcre +BuildRequires: php-spl +## Autoloader +BuildRequires: php-composer(symfony/class-loader) +%endif + +Requires: php-composer(composer/composer) +# phpcompatinfo (computed from version 1.0.21) +Requires: php(language) >= 5.3.0 +Requires: php-pcre +Requires: php-spl +# Autoloader +Requires: php-composer(symfony/class-loader) + +# Composer +Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} + +%description +This is for PHP package authors to require in their composer.json. It will +install their package to the correct location based on the specified package +type. + +The goal of installers is to be a simple package type to install path map. +Users can also customize the install path per package and package authors +can modify the package name upon installing. + +installers isn't intended on replacing all custom installers. If your package +requires special installation handling then by all means, create a custom +installer to handle it. + + +%prep +%setup -qn %{github_name}-%{github_commit} + +%patch0 -p1 + +: Create autoloader +cat <<'AUTOLOAD' | tee src/Composer/Installers/autoload.php +<?php +/** + * Autoloader for %{name} and its' dependencies + * + * Created by %{name}-%{version}-%{release} + * + * @return \Symfony\Component\ClassLoader\ClassLoader + */ + +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('Composer\\Installers\\', dirname(dirname(__DIR__))); + +require_once '%{phpdir}/Composer/autoload.php'; + +return $fedoraClassLoader; +AUTOLOAD + + +%build +# Empty build section, nothing to build + + +%install +mkdir -p %{buildroot}%{phpdir} +cp -rp src/Composer %{buildroot}%{phpdir}/ + + +%check +%if %{with_tests} +: Create tests bootstrap +cat <<'BOOTSTRAP' | tee bootstrap.php +<?php +require_once '%{buildroot}%{phpdir}/Composer/Installers/autoload.php'; +$fedoraClassLoader->addPrefix('Composer\\Installers\\Test\\', __DIR__ . '/tests'); +BOOTSTRAP + +: Run tests +%{_bindir}/phpunit --verbose --bootstrap bootstrap.php +%else +: Tests skipped +%endif + + +%files +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc *.md +%doc composer.json +%{phpdir}/Composer/Installers + + +%changelog +* Thu Aug 20 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.0.21-1 +- Initial package |