summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2015-06-30 13:33:10 +0200
committerRemi Collet <fedora@famillecollet.com>2015-06-30 13:33:10 +0200
commit3af42fe075f3333441d27c3dd2720efd0fe2ee1d (patch)
treee63e5941a2110d290e3b93dc6009cdf207091567
parent62204b19727f41203c3cd3a500b7ffa279bda68f (diff)
php-scssphp: 0.1.6 (backport from fedora)
-rw-r--r--php-scssphp-bin.patch20
-rw-r--r--php-scssphp-pre-0-1-0-compat.patch19
-rw-r--r--php-scssphp.spec91
3 files changed, 78 insertions, 52 deletions
diff --git a/php-scssphp-bin.patch b/php-scssphp-bin.patch
index a941334..1513f17 100644
--- a/php-scssphp-bin.patch
+++ b/php-scssphp-bin.patch
@@ -1,21 +1,13 @@
diff --git a/bin/pscss b/bin/pscss
-index 451f0fb..38f0a8e 100755
+index e986585..d68a875 100755
--- a/bin/pscss
+++ b/bin/pscss
-@@ -1,9 +1,14 @@
--#!/usr/bin/env php
-+#!/usr/bin/php
- <?php
+@@ -17,7 +17,7 @@ if (version_compare(PHP_VERSION, '5.3') < 0) {
+ die('Requires PHP 5.3 or above');
+ }
- error_reporting(E_ALL);
-
--include 'scss.inc.php';
-+spl_autoload_register(function ($class) {
-+ if (0 === strpos($class, 'Leafo\\ScssPhp\\')) {
-+ $src = str_replace('\\', '/', $class) . '.php';
-+ @include_once $src;
-+ }
-+});
+-include __DIR__ . '/../scss.inc.php';
++require_once '__PHPDIR__/Leafo/ScssPhp/autoload.php';
use Leafo\ScssPhp\Compiler;
use Leafo\ScssPhp\Parser;
diff --git a/php-scssphp-pre-0-1-0-compat.patch b/php-scssphp-pre-0-1-0-compat.patch
index 6fa8467..a853138 100644
--- a/php-scssphp-pre-0-1-0-compat.patch
+++ b/php-scssphp-pre-0-1-0-compat.patch
@@ -1,21 +1,14 @@
diff --git a/classmap.php b/classmap.php
-index 543efb9..717d80d 100644
+index 2746deb..2ad7588 100644
--- a/classmap.php
+++ b/classmap.php
-@@ -13,6 +13,16 @@
+@@ -12,6 +12,9 @@
+ * @link http://leafo.net/scssphp
*/
- /**
-+ * Autoload register
-+ */
-+spl_autoload_register(function ($class) {
-+ if (0 === strpos($class, 'Leafo\\ScssPhp\\')) {
-+ $src = str_replace('\\', '/', $class) . '.php';
-+ @include_once $src;
-+ }
-+});
++// Autoloader
++require_once dirname(__DIR__) . '/Leafo/ScssPhp/autoload.php';
+
-+/**
+ /**
* @deprecated since 0.1.0
*/
- class scssc extends \Leafo\ScssPhp\Compiler
diff --git a/php-scssphp.spec b/php-scssphp.spec
index 86b9fd8..d3d7cbe 100644
--- a/php-scssphp.spec
+++ b/php-scssphp.spec
@@ -1,7 +1,8 @@
+# remirepo spec file for php-scssphp, from:
#
-# RPM spec file for php-scssphp
+# Fedora spec file for php-scssphp
#
-# Copyright (c) 2012-2014 Shawn Iwinski <shawn.iwinski@gmail.com>
+# Copyright (c) 2012-2015 Shawn Iwinski <shawn.iwinski@gmail.com>
# Remi Collet <remi@fedoraproject.org>
#
# License: MIT
@@ -12,8 +13,8 @@
%global github_owner leafo
%global github_name scssphp
-%global github_version 0.1.1
-%global github_commit 8c08da585537e97efd528c7d278463d2b9396371
+%global github_version 0.1.6
+%global github_commit 22b369377e5db5a6a93cdb42485852fc652749c0
%global composer_vendor leafo
%global composer_project scssphp
@@ -22,10 +23,9 @@
%global php_min_ver 5.3.0
# Build using "--without tests" to disable tests
-%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
+%global with_tests 0%{!?_without_tests:1}
-%{!?phpdir: %global phpdir %{_datadir}/php}
-%{!?__phpunit: %global __phpunit %{_bindir}/phpunit}
+%{!?phpdir: %global phpdir %{_datadir}/php}
Name: php-%{github_name}
Version: %{github_version}
@@ -41,23 +41,32 @@ Patch1: %{name}-bin.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
+# Tests
%if %{with_tests}
-# composer.json
+## composer.json
+BuildRequires: %{_bindir}/phpunit
BuildRequires: php(language) >= %{php_min_ver}
-BuildRequires: php-phpunit-PHPUnit
-# phpcompatinfo (computed from version 0.1.1)
+## phpcompatinfo (computed from version 0.1.6)
BuildRequires: php-ctype
BuildRequires: php-date
+BuildRequires: php-mbstring
BuildRequires: php-pcre
+## Autoloader
+BuildRequires: php-composer(symfony/class-loader)
%endif
+Requires: php-cli
# composer.json
Requires: php(language) >= %{php_min_ver}
-# phpcompatinfo (computed from version 0.1.1)
+# phpcompatinfo (computed from version 0.1.6)
Requires: php-ctype
Requires: php-date
+Requires: php-mbstring
Requires: php-pcre
+# Autoloader
+Requires: php-composer(symfony/class-loader)
+# Composer
Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
@@ -77,11 +86,36 @@ the SCSS syntax.
%prep
%setup -qn %{github_name}-%{github_commit}
-# Lib pre-0.1.0 compat
+: Lib pre-0.1.0 compat
%patch0 -p1
-# Bin
+: Bin
%patch1 -p1
+sed 's#__PHPDIR__#%{phpdir}#' -i bin/pscss
+
+: Create autoloader
+(cat <<'AUTOLOAD'
+<?php
+/**
+ * Autoloader 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('Leafo\\ScssPhp\\', dirname(dirname(__DIR__)));
+
+return $fedoraClassLoader;
+AUTOLOAD
+) | tee src/autoload.php
%build
@@ -89,42 +123,49 @@ the SCSS syntax.
%install
-# Lib
-mkdir -pm 0755 %{buildroot}%{phpdir}/Leafo/ScssPhp
+rm -rf %{buildroot}
+
+: Lib
+mkdir -p %{buildroot}%{phpdir}/Leafo/ScssPhp
cp -pr src/* %{buildroot}%{phpdir}/Leafo/ScssPhp/
-# Lib pre-0.1.0 compat
-mkdir -pm 0755 %{buildroot}%{phpdir}/%{github_name}
+: Lib pre-0.1.0 compat
+mkdir -p %{buildroot}%{phpdir}/%{github_name}
cp -p classmap.php %{buildroot}%{phpdir}/%{github_name}/scss.inc.php
-# Bin
-mkdir -pm 0755 %{buildroot}%{_bindir}
+: Bin
+mkdir -p %{buildroot}%{_bindir}
install -pm 0755 bin/pscss %{buildroot}%{_bindir}/
%check
%if %{with_tests}
-
-%{__phpunit} \
- --bootstrap %{buildroot}%{phpdir}/%{github_name}/scss.inc.php \
- --include-path %{buildroot}%{phpdir} \
- -d date.timezone="UTC"
+%{_bindir}/phpunit -v --bootstrap %{buildroot}%{phpdir}/Leafo/ScssPhp/autoload.php
%else
: Tests skipped
%endif
+%clean
+rm -rf %{buildroot}
+
+
%files
%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE.md
-%doc README.md composer.json
+%doc README.md
+%doc composer.json
%{phpdir}/%{github_name}/scss.inc.php
%{phpdir}/Leafo/ScssPhp
%{_bindir}/pscss
%changelog
+* Sun Jun 28 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 0.1.6-1
+- Updated to 0.1.6 (RHBZ #1226748)
+- Added autoloader
+
* Thu Oct 30 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 0.1.1-1
- Updated to 0.1.1 (BZ #1126612)
- Removed man page