summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-07-21 17:52:35 +0200
committerRemi Collet <fedora@famillecollet.com>2016-07-21 17:52:35 +0200
commit53b8614cc88e0f37aca75d595b91743f594d8730 (patch)
tree0097ac1bc9a8d5bf31a68b49dd6db07ede3af8ff
php-jakub-onderka-php-console-color: import from Fedora
-rw-r--r--php-jakub-onderka-php-console-color-pr8-add-license.patch43
-rw-r--r--php-jakub-onderka-php-console-color.spec137
2 files changed, 180 insertions, 0 deletions
diff --git a/php-jakub-onderka-php-console-color-pr8-add-license.patch b/php-jakub-onderka-php-console-color-pr8-add-license.patch
new file mode 100644
index 0000000..fe445df
--- /dev/null
+++ b/php-jakub-onderka-php-console-color-pr8-add-license.patch
@@ -0,0 +1,43 @@
+From 7fbfb97ccad59972f890b3570644f3d2ae351300 Mon Sep 17 00:00:00 2001
+From: Shawn Iwinski <siwinski@redhat.com>
+Date: Fri, 15 Jul 2016 08:35:17 -0400
+Subject: [PATCH] Add LICENSE file
+
+---
+ LICENSE | 27 +++++++++++++++++++++++++++
+ 1 file changed, 27 insertions(+)
+ create mode 100644 LICENSE
+
+diff --git a/LICENSE b/LICENSE
+new file mode 100644
+index 0000000..aa36c13
+--- /dev/null
++++ b/LICENSE
+@@ -0,0 +1,27 @@
++Copyright (c) 2014-2016, Jakub Onderka
++All rights reserved.
++
++Redistribution and use in source and binary forms, with or without
++modification, are permitted provided that the following conditions
++are met:
++
++ * Redistributions of source code must retain the above copyright
++ notice, this list of conditions and the following disclaimer.
++
++ * Redistributions in binary form must reproduce the above copyright
++ notice, this list of conditions and the following disclaimer in
++ the documentation and/or other materials provided with the
++ distribution.
++
++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
++LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
++FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
++COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
++INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
++BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
++CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
++ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++POSSIBILITY OF SUCH DAMAGE.
diff --git a/php-jakub-onderka-php-console-color.spec b/php-jakub-onderka-php-console-color.spec
new file mode 100644
index 0000000..b1d0f03
--- /dev/null
+++ b/php-jakub-onderka-php-console-color.spec
@@ -0,0 +1,137 @@
+#
+# Fedora spec file for php-jakub-onderka-php-console-color
+#
+# Copyright (c) 2016 Shawn Iwinski <shawn@iwin.ski>
+#
+# License: MIT
+# http://opensource.org/licenses/MIT
+#
+# Please preserve changelog entries
+#
+
+%global github_owner JakubOnderka
+%global github_name PHP-Console-Color
+%global github_version 0.1
+%global github_commit e0b393dacf7703fc36a4efc3df1435485197e6c1
+
+%global composer_vendor jakub-onderka
+%global composer_project php-console-color
+
+# "php": ">=5.3.2"
+%global php_min_ver 5.3.2
+
+# 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: Simple library for creating colored console ouput
+
+Group: Development/Libraries
+License: BSD
+URL: https://github.com/%{github_owner}/%{github_name}
+Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
+
+# Add LICENSE file
+# https://github.com/JakubOnderka/PHP-Console-Color/pull/8
+# https://patch-diff.githubusercontent.com/raw/JakubOnderka/PHP-Console-Color/pull/8.patch
+Patch0: %{name}-pr8-add-license.patch
+
+BuildArch: noarch
+# Tests
+%if %{with_tests}
+## composer.json
+BuildRequires: php(language) >= %{php_min_ver}
+BuildRequires: php-composer(phpunit/phpunit)
+## phpcompatinfo (computed from version 0.1)
+BuildRequires: php-pcre
+BuildRequires: php-posix
+BuildRequires: php-spl
+## Autoloader
+BuildRequires: php-composer(symfony/class-loader)
+%endif
+
+# composer.json
+Requires: php(language) >= %{php_min_ver}
+# phpcompatinfo (computed from version 0.1)
+Requires: php-pcre
+Requires: php-posix
+Requires: php-spl
+# Autoloader
+Requires: php-composer(symfony/class-loader)
+
+# Composer
+Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
+
+%description
+%{summary}.
+
+Autoloader: %{phpdir}/JakubOnderka/PhpConsoleColor/autoload.php
+
+
+%prep
+%setup -qn %{github_name}-%{github_commit}
+
+: Add LICENSE file
+%patch0 -p1
+
+: Modify example.php to use generated autoloader
+sed "/require_once/s#.*#require_once '%{phpdir}/JakubOnderka/PhpConsoleColor/autoload.php';#" \
+ -i example.php
+
+
+%build
+: Create autoloader
+cat <<'AUTOLOAD' | tee src/JakubOnderka/PhpConsoleColor/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('JakubOnderka\\PhpConsoleColor\\', dirname(dirname(__DIR__)));
+
+return $fedoraClassLoader;
+AUTOLOAD
+
+
+%install
+mkdir -p %{buildroot}%{phpdir}
+cp -rp src/* %{buildroot}%{phpdir}/
+
+
+%check
+%if %{with_tests}
+%{_bindir}/phpunit --verbose \
+ --bootstrap %{buildroot}%{phpdir}/JakubOnderka/PhpConsoleColor/autoload.php
+%else
+: Tests skipped
+%endif
+
+
+%files
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc composer.json
+%doc example.php
+%dir %{phpdir}/JakubOnderka
+ %{phpdir}/JakubOnderka/PhpConsoleColor
+
+
+%changelog
+* Fri Jul 15 2016 Shawn Iwinski <shawn@iwin.ski> - 0.1-1
+- Initial package