summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer.json26
-rw-r--r--php-stack-builder.spec70
2 files changed, 69 insertions, 27 deletions
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..0af2722
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,26 @@
+{
+ "name": "stack/builder",
+ "description": "Builder for stack middlewares based on HttpKernelInterface.",
+ "keywords": ["stack"],
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Igor Wiedler",
+ "email": "igor@wiedler.ch"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.0",
+ "symfony/http-foundation": "~2.1|~3.0",
+ "symfony/http-kernel": "~2.1|~3.0"
+ },
+ "require-dev": {
+ "silex/silex": "~1.0"
+ },
+ "autoload": {
+ "psr-0": { "Stack": "src" }
+ },
+ "extra": {
+ "branch-alias": { "dev-master": "1.0-dev" }
+ }
+}
diff --git a/php-stack-builder.spec b/php-stack-builder.spec
index 92a6e7e..2eadbac 100644
--- a/php-stack-builder.spec
+++ b/php-stack-builder.spec
@@ -1,8 +1,8 @@
# remirepo spec file for php-stack-builder, from Fedora:
#
-# RPM spec file for php-stack-builder
+# Fedora spec file for php-stack-builder
#
-# Copyright (c) 2015 Shawn Iwinski <shawn.iwinski@gmail.com>
+# Copyright (c) 2015-2016 Shawn Iwinski <shawn.iwinski@gmail.com>
#
# License: MIT
# http://opensource.org/licenses/MIT
@@ -12,20 +12,22 @@
%global github_owner stackphp
%global github_name builder
-%global github_version 1.0.3
-%global github_commit c1f8a4693b55c563405024f708a76ef576c3b276
+%global github_version 1.0.4
+%global github_commit 59fcc9b448a8ce5e338a04c4e2e4aca893e83425
%global composer_vendor stack
%global composer_project builder
-# "php": ">= 5.3.0"
-%global php_min_ver 5.3.3
+# "php": ">=5.3.0"
+%global php_min_ver 5.3.0
# "silex/silex": "~1.0"
%global silex_min_ver 1.0
%global silex_max_ver 2.0
-# "symfony/*": "~2.1"
-%global symfony_min_ver 2.1
-%global symfony_max_ver 3.0
+# "symfony/http-foundation": "~2.1|~3.0"
+# "symfony/http-kernel": "~2.1|~3.0"
+# NOTE: Min version not 2.1 because autoloader required
+%global symfony_min_ver 2.7.1
+%global symfony_max_ver 4.0
# Build using "--without tests" to disable tests
%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
@@ -44,20 +46,19 @@ Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{githu
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-# For autoload generation
+# Autoloader
BuildRequires: %{_bindir}/phpab
-# For tests
+# Tests
%if %{with_tests}
-BuildRequires: %{_bindir}/phpunit
+BuildRequires: php-composer(phpunit/phpunit)
## composer.json
BuildRequires: php(language) >= %{php_min_ver}
BuildRequires: php-composer(silex/silex) >= %{silex_min_ver}
-BuildRequires: php-composer(silex/silex) < %{silex_max_ver}
BuildRequires: php-composer(symfony/http-foundation) >= %{symfony_min_ver}
BuildRequires: php-composer(symfony/http-foundation) < %{symfony_max_ver}
BuildRequires: php-composer(symfony/http-kernel) >= %{symfony_min_ver}
BuildRequires: php-composer(symfony/http-kernel) < %{symfony_max_ver}
-## phpcompatinfo (computed from version 1.0.3)
+## phpcompatinfo (computed from version 1.0.4)
BuildRequires: php-reflection
BuildRequires: php-spl
%endif
@@ -68,7 +69,7 @@ Requires: php-composer(symfony/http-foundation) >= %{symfony_min_ver}
Requires: php-composer(symfony/http-foundation) < %{symfony_max_ver}
Requires: php-composer(symfony/http-kernel) >= %{symfony_min_ver}
Requires: php-composer(symfony/http-kernel) < %{symfony_max_ver}
-# phpcompatinfo (computed from version 1.0.3)
+# phpcompatinfo (computed from version 1.0.4)
Requires: php-reflection
Requires: php-spl
@@ -81,6 +82,8 @@ Builder for stack middlewares based on HttpKernelInterface.
Stack/Builder is a small library that helps you construct a nested
HttpKernelInterface decorator tree. It models it as a stack of middlewares.
+Autoloader: %{phpdir}/Stack/autoload-builder.php
+
%prep
%setup -qn %{github_name}-%{github_commit}
@@ -90,15 +93,11 @@ HttpKernelInterface decorator tree. It models it as a stack of middlewares.
: Generate autoloader
%{_bindir}/phpab --nolower --output src/Stack/autoload-builder.php src/Stack
-cat >> src/Stack/autoload-builder.php <<'AUTOLOAD'
+cat <<'AUTOLOAD' | tee -a src/Stack/autoload-builder.php
-// TODO: Add Symfony autoloaders from their packages when they are available
-spl_autoload_register(function ($class) {
- if (0 === strpos($class, 'Symfony\\')) {
- $src = str_replace('\\', '/', $class) . '.php';
- @include_once $src;
- }
-});
+// Required dependencies
+require_once '%{phpdir}/Symfony/Component/HttpFoundation/autoload.php';
+require_once '%{phpdir}/Symfony/Component/HttpKernel/autoload.php';
AUTOLOAD
@@ -111,14 +110,27 @@ cp -rp src/* %{buildroot}%{phpdir}/
%check
%if %{with_tests}
-# Create bootstrap
-cat > bootstrap.php <<'BOOTSTRAP'
+: Create tests bootstrap
+cat <<'BOOTSTRAP' | tee bootstrap.php
<?php
-require '%{buildroot}%{phpdir}/Stack/autoload-builder.php';
-require '%{phpdir}/Silex/autoload.php';
+require_once '%{buildroot}%{phpdir}/Stack/autoload-builder.php';
+require_once '%{phpdir}/Silex/autoload.php';
BOOTSTRAP
+run=0
+ret=0
+if which php56; then
+ php56 %{_bindir}/phpunit --bootstrap bootstrap.php || ret=1
+ run=1
+fi
+if which php71; then
+ php71 %{_bindir}/phpunit --bootstrap bootstrap.php || ret=1
+ run=1
+fi
+if [ $run -eq 0 ]; then
%{_bindir}/phpunit --bootstrap bootstrap.php
+fi
+exit $ret
%else
: Tests skipped
%endif
@@ -141,6 +153,10 @@ rm -rf %{buildroot}
%changelog
+* Sun Jul 24 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.0.4-1
+- Update to 1.0.4 (RHBZ #1342093)
+- Update autoloader to use dependencies' autoloaders
+
* Wed Jun 17 2015 Remi Collet <remi@remirepo.net> - 1.0.3-1
- add backport stuff for remirepo