summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore7
-rw-r--r--composer.json24
-rwxr-xr-xphp-gliph-get-source.sh4
-rw-r--r--php-gliph.spec70
4 files changed, 64 insertions, 41 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/composer.json b/composer.json
new file mode 100644
index 0000000..0c8c84f
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,24 @@
+{
+ "name": "sdboyer/gliph",
+ "description": "A graph library for PHP.",
+ "license": "MIT",
+ "keywords": ["gliph", "library", "php", "spl", "graph"],
+ "homepage": "http://github.com/sdboyer/gliph",
+ "type": "library",
+ "authors": [
+ {
+ "name": "Sam Boyer",
+ "email": "tech@samboyer.org"
+ }
+ ],
+ "require": {
+ "php": ">=5.3"
+ },
+ "require-dev": {
+ "satooshi/php-coveralls": "0.6.*",
+ "phpunit/phpunit": "3.7.*"
+ },
+ "autoload": {
+ "psr-0": { "Gliph": "src/" }
+ }
+}
diff --git a/php-gliph-get-source.sh b/php-gliph-get-source.sh
index ba71f5d..4ad1051 100755
--- a/php-gliph-get-source.sh
+++ b/php-gliph-get-source.sh
@@ -43,6 +43,8 @@ print "GIT_REPO = $GIT_REPO"
print "GIT_DIR = $GIT_DIR"
TEMP_DIR=$(mktemp --dir)
+TAR_FILE=$PWD/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz
+CMP_FILE=$PWD/composer.json
pushd $TEMP_DIR
print "Cloning git repo..."
@@ -51,6 +53,7 @@ pushd $TEMP_DIR
pushd $GIT_DIR
print "Checking out commit..."
$GIT checkout $GIT_COMMIT
+ cp composer.json $CMP_FILE
popd
TAR_DIR=${GIT_NAME}-${GIT_COMMIT}
@@ -58,7 +61,6 @@ pushd $TEMP_DIR
mv $GIT_DIR $TAR_DIR
- TAR_FILE=`$RPM --eval='%{_sourcedir}'`/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz
print "TAR_FILE = $TAR_FILE"
[ -e $TAR_FILE ] && rm -f $TAR_FILE
diff --git a/php-gliph.spec b/php-gliph.spec
index b03eebe..8918302 100644
--- a/php-gliph.spec
+++ b/php-gliph.spec
@@ -1,8 +1,8 @@
# remirepo spec file for php-gliph, from Fedora:
#
-# RPM spec file for php-gliph
+# Fedora spec file for php-gliph
#
-# Copyright (c) 2013-2014 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_project}
Version: %{github_version}
-Release: 4%{?github_release}%{?dist}
+Release: 7%{?github_release}%{?dist}
Summary: A graph library for PHP
Group: Development/Libraries
@@ -39,18 +39,17 @@ URL: https://github.com/%{github_owner}/%{github_name}
Source0: %{name}-%{version}-%{github_commit}.tar.gz
Source1: %{name}-get-source.sh
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
# Tests
%if %{with_tests}
-BuildRequires: %{_bindir}/phpunit
+BuildRequires: php-composer(phpunit/phpunit)
## composer.json
BuildRequires: php(language) >= %{php_min_ver}
## phpcompatinfo (computed from version 0.1.8)
BuildRequires: php-reflection
BuildRequires: php-spl
## Autoloader
-BuildRequires: php-composer(symfony/class-loader)
+BuildRequires: php-composer(fedora/autoloader)
%endif
# composer.json
@@ -58,7 +57,7 @@ Requires: php(language) >= %{php_min_ver}
# phpcompatinfo (computed from version 0.1.8)
Requires: php-spl
# Autoloader
-Requires: php-composer(symfony/class-loader)
+Requires: php-composer(fedora/autoloader)
# Standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming
Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release}
@@ -71,42 +70,29 @@ data structures for use by other PHP applications. It is (currently) designed
for use with in-memory graphs, not for interaction with a graph database like
Neo4J (http://neo4j.org/).
+Autoloader: %{phpdir}/Gliph/autoload.php
+
%prep
%setup -qn %{github_name}-%{github_commit}
+
+%build
+
: Create autoloader
cat <<'AUTOLOAD' | tee src/Gliph/autoload.php
<?php
/**
* Autoloader for %{name} and its' dependencies
- *
- * Created by %{name}-%{version}-%{release}
- *
- * @return \Symfony\Component\ClassLoader\ClassLoader
+ * (created by %{name}-%{version}-%{release}).
*/
+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 'Symfony/Component/ClassLoader/ClassLoader.php';
- }
-
- $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
- $fedoraClassLoader->register();
-}
-
-$fedoraClassLoader->addPrefix('Gliph\\', dirname(__DIR__));
-
-return $fedoraClassLoader;
+\Fedora\Autoloader\Autoload::addPsr4('Gliph\\', __DIR__);
AUTOLOAD
-%build
-# Empty build section, nothing to build
-
-
%install
-rm -rf %{buildroot}
mkdir -p %{buildroot}%{phpdir}
cp -rp src/* %{buildroot}%{phpdir}/
@@ -116,26 +102,26 @@ cp -rp src/* %{buildroot}%{phpdir}/
: Create tests bootstrap
cat <<'BOOTSTRAP' | tee bootstrap.php
<?php
-
-$fedoraClassLoader =
- require_once '%{buildroot}%{phpdir}/Gliph/autoload.php';
-
-$fedoraClassLoader->addPrefix(null, __DIR__ . '/tests');
+require_once '%{buildroot}%{phpdir}/Gliph/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr0('Gliph', __DIR__.'/tests');
BOOTSTRAP
-: Run tests
-%{_bindir}/phpunit --verbose --bootstrap ./bootstrap.php .
+: 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 +130,10 @@ rm -rf %{buildroot}
%changelog
+* Sun May 14 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 0.1.8-7
+- Switch autoloader to php-composer(fedora/autoloader)
+- Test with SCLs if available
+
* Sat Jul 11 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 0.1.8-4
- Added missing autoloader require