diff options
author | Remi Collet <fedora@famillecollet.com> | 2015-02-17 15:43:51 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2015-02-17 15:43:51 +0100 |
commit | f00533bc8f3fc163fda8617a265b7e228dcd0de9 (patch) | |
tree | 0d8576839ec6ac6a297bd757ece9709e39aeb707 |
php-phpspec: 2.1.1 - New package
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | php-phpspec.spec | 146 | ||||
-rw-r--r-- | phpspec-autoload.php | 16 | ||||
-rw-r--r-- | phpspec-rpm.patch | 34 |
4 files changed, 200 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..13af741 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../../../common/Makefile + diff --git a/php-phpspec.spec b/php-phpspec.spec new file mode 100644 index 0000000..c691df1 --- /dev/null +++ b/php-phpspec.spec @@ -0,0 +1,146 @@ +# spec file for php-phpspec +# +# Copyright (c) 2015 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# +%global gh_commit 66a1df93099282b1514e9e001fcf6e9393f7783d +%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) +%global gh_owner phpspec +%global gh_project phpspec + +Name: php-phpspec +Version: 2.1.1 +Release: 1%{?dist} +Summary: Specification-oriented BDD framework for PHP 5.3+ + +Group: Development/Libraries +License: MIT +URL: https://github.com/%{gh_owner}/%{gh_project} +Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz + +Source1: %{gh_project}-autoload.php + +# Use our autoloader +Patch0: %{gh_project}-rpm.patch + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildArch: noarch +BuildRequires: %{_bindir}/phpunit +BuildRequires: php-composer(phpspec/prophecy) >= 1.1 +BuildRequires: php-composer(phpspec/php-diff) >= 1.0.0 +BuildRequires: php-composer(sebastian/exporter) >= 1.0 +BuildRequires: php-composer(symfony/console) >= 2.3.0 +BuildRequires: php-composer(symfony/event-dispatcher) >= 2.1 +BuildRequires: php-composer(symfony/finder) >= 2.1 +BuildRequires: php-composer(symfony/process) >= 2.1 +BuildRequires: php-composer(symfony/yaml) >= 2.1 +BuildRequires: php-composer(doctrine/instantiator) >= 1.0.1 +BuildRequires: php-composer(symfony/class-loader) +# From composer.json, require-dev +BuildRequires: php-composer(symfony/filesystem) >= 2.1 + +# From composer.json, require +# "php": ">=5.3.3", +# "phpspec/prophecy": "~1.1", +# "phpspec/php-diff": "~1.0.0", +# "sebastian/exporter": "~1.0", +# "symfony/console": "~2.3", +# "symfony/event-dispatcher": "~2.1", +# "symfony/finder": "~2.1", +# "symfony/process": "~2.1", +# "symfony/yaml": "~2.1", +# "doctrine/instantiator": "~1.0,>=1.0.1" +Requires: php(language) >= 5.3.3 +Requires: php-composer(phpspec/prophecy) >= 1.1 +Requires: php-composer(phpspec/prophecy) < 2 +Requires: php-composer(phpspec/php-diff) >= 1.0.0 +Requires: php-composer(phpspec/php-diff) < 2 +Requires: php-composer(sebastian/exporter) >= 1.0 +Requires: php-composer(sebastian/exporter) < 2 +Requires: php-composer(symfony/console) >= 2.3.0 +Requires: php-composer(symfony/console) < 3 +Requires: php-composer(symfony/event-dispatcher) >= 2.1 +Requires: php-composer(symfony/event-dispatcher) < 3 +Requires: php-composer(symfony/finder) >= 2.1 +Requires: php-composer(symfony/finder) < 3 +Requires: php-composer(symfony/process) >= 2.1 +Requires: php-composer(symfony/process) < 3 +Requires: php-composer(symfony/yaml) >= 2.1 +Requires: php-composer(symfony/yaml) < 3 +Requires: php-composer(doctrine/instantiator) >= 1.0.1 +Requires: php-composer(doctrine/instantiator) < 2 +# For our autoloader +Requires: php-composer(symfony/class-loader) +# From phpcompatinfo report +Requires: php-pcntl +Requires: php-pcre +Requires: php-reflection +Requires: php-spl +Requires: php-tokenizer + +# Composer +Provides: php-composer(phpspec/phpspec) = %{version} +# The application +Provides: phpspec = %{version} + + +%description +phpspec is a tool which can help you write clean and working PHP code +using behaviour driven development or BDD. BDD is a technique derived +from test-first development. + +BDD is a technique used at story level and spec level. phpspec is a tool +for use at the spec level or SpecBDD. The technique is to first use a tool +like phpspec to describe the behaviour of an object you are about to write. +Next you write just enough code to meet that specification and finally you +refactor this code. + + +%prep +%setup -q -n %{gh_project}-%{gh_commit} + +%patch0 -p0 -b .rpm + +cp %{SOURCE1} src/PhpSpec/autoload.php + + +%build +# Nothing + + +%install +# No namespace, so use a package specific dir +rm -rf %{buildroot} +mkdir -p %{buildroot}%{_datadir}/php +cp -pr src/PhpSpec %{buildroot}%{_datadir}/php/PhpSpec + +install -Dpm755 bin/phpspec %{buildroot}%{_bindir}/phpspec + + +%check +%{_bindir}/php \ + -d include_path=.:%{buildroot}%{_datadir}/php:/usr/share/php \ + bin/phpspec \ + run --format pretty --verbose --no-ansi + + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc README.* CHANGES.* +%doc composer.json +%{_bindir}/phpspec +%{_datadir}/php/PhpSpec + + +%changelog +* Tue Feb 17 2015 Remi Collet <remi@fedoraproject.org> - 2.1.1-1 +- initial package
\ No newline at end of file diff --git a/phpspec-autoload.php b/phpspec-autoload.php new file mode 100644 index 0000000..fff41bc --- /dev/null +++ b/phpspec-autoload.php @@ -0,0 +1,16 @@ +<?php +require_once 'phpspec/php-diff/autoload.php'; +require_once 'Prophecy/autoload.php'; + +$vendorDir = '/usr/share/php'; +require_once $vendorDir . '/Symfony/Component/ClassLoader/UniversalClassLoader.php'; +use Symfony\Component\ClassLoader\UniversalClassLoader; + +$loader = new UniversalClassLoader(); +$loader->registerNamespaces(array( + 'Doctrine\\Instantiator' => $vendorDir, + 'SebastianBergmann' => $vendorDir, + 'Symfony\\Component' => $vendorDir, + 'PhpSpec' => dirname(__DIR__), +)); +$loader->register(); diff --git a/phpspec-rpm.patch b/phpspec-rpm.patch new file mode 100644 index 0000000..8daf1ef --- /dev/null +++ b/phpspec-rpm.patch @@ -0,0 +1,34 @@ +diff -up bin/phpspec.rpm bin/phpspec +--- bin/phpspec.rpm 2015-01-09 14:21:45.000000000 +0100 ++++ bin/phpspec 2015-02-17 15:18:53.913872436 +0100 +@@ -1,26 +1,13 @@ +-#!/usr/bin/env php ++#!/usr/bin/php + <?php + + define('PHPSPEC_VERSION', '2.1.1'); + +-if (is_file($autoload = getcwd() . '/vendor/autoload.php')) { +- require $autoload; +-} elseif (is_file($autoload = getcwd() . '/../../autoload.php')) { +- require $autoload; ++if (!ini_get('date.timezone')) { ++ ini_set('date.timezone', 'UTC'); + } + +-if (is_file($autoload = __DIR__ . '/../vendor/autoload.php')) { +- require($autoload); +-} elseif (is_file($autoload = __DIR__ . '/../../../autoload.php')) { +- require($autoload); +-} else { +- fwrite(STDERR, +- 'You must set up the project dependencies, run the following commands:' . PHP_EOL . +- 'curl -s http://getcomposer.org/installer | php' . PHP_EOL . +- 'php composer.phar install' . PHP_EOL +- ); +- exit(1); +-} ++require_once 'PhpSpec/autoload.php'; + + $app = new PhpSpec\Console\Application(PHPSPEC_VERSION); + $app->run(); |