summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer.json45
-rw-r--r--php-ocramius-code-generator-utils.spec61
2 files changed, 77 insertions, 29 deletions
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..e74f4b5
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,45 @@
+{
+ "name": "ocramius/code-generator-utils",
+ "description": "A set of code generator utilities built on top of PHP-Parsers that ease its use when combined with Reflection",
+ "type": "library",
+ "license": "MIT",
+ "homepage": "https://github.com/Ocramius/CodeGenerationUtils",
+ "keywords": [
+ "reflection",
+ "code generation",
+ "php code",
+ "parser",
+ "compiler"
+ ],
+ "authors": [
+ {
+ "name": "Marco Pivetta",
+ "email": "ocramius@gmail.com",
+ "homepage": "http://ocramius.github.com/"
+ }
+ ],
+ "require": {
+ "php": "~7.0",
+ "nikic/php-parser": "~2.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~5.0",
+ "squizlabs/php_codesniffer": "~2.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "CodeGenerationUtils\\": "src/CodeGenerationUtils"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "CodeGenerationUtilsTests\\": "tests/CodeGenerationUtilsTests",
+ "CodeGenerationUtilsTestAsset\\": "tests/CodeGenerationUtilsTestAsset"
+ }
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ }
+}
diff --git a/php-ocramius-code-generator-utils.spec b/php-ocramius-code-generator-utils.spec
index 993d097..05aa463 100644
--- a/php-ocramius-code-generator-utils.spec
+++ b/php-ocramius-code-generator-utils.spec
@@ -1,5 +1,6 @@
+# remirepo spec file for php-ocramius-code-generator-utils, from
#
-# RPM spec file for php-ocramius-code-generator-utils
+# Fedora spec file for php-ocramius-code-generator-utils
#
# Copyright (c) 2014-2015 Shawn Iwinski <shawn.iwinski@gmail.com>
#
@@ -11,17 +12,17 @@
%global github_owner Ocramius
%global github_name CodeGenerationUtils
-%global github_version 0.3.2
-%global github_commit 0e2f6c593fc82801cbb5c8fa90559d923bd1445c
+%global github_version 0.4.0
+%global github_commit 7dc0be1dec3376d95ba094688f0d84f7cf95f300
%global composer_vendor ocramius
%global composer_project code-generator-utils
-# "php": ">=5.3.3"
-%global php_min_ver 5.3.3
-# "nikic/php-parser": "~1.3"
-%global php_parser_min_ver 1.3
-%global php_parser_max_ver 2
+# "php": "~7.0"
+%global php_min_ver 7.0
+# "nikic/php-parser": "~2.0"
+%global php_parser_min_ver 2.0
+%global php_parser_max_ver 3
# Build using "--without tests" to disable tests
%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
@@ -46,8 +47,9 @@ BuildArch: noarch
BuildRequires: php(language) >= %{php_min_ver}
BuildRequires: php-composer(nikic/php-parser) >= %{php_parser_min_ver}
BuildRequires: php-composer(nikic/php-parser) < %{php_parser_max_ver}
-BuildRequires: php-phpunit-PHPUnit
-# phpcompatinfo (computed from version 0.3.0)
+BuildRequires: php-composer(phpunit/phpunit) >= 5.0
+BuildRequires: %{_bindir}/phpab
+# phpcompatinfo (computed from version 0.4.0)
BuildRequires: php-pcre
BuildRequires: php-reflection
BuildRequires: php-spl
@@ -57,9 +59,8 @@ BuildRequires: php-spl
Requires: php(language) >= %{php_min_ver}
Requires: php-composer(nikic/php-parser) >= %{php_parser_min_ver}
Requires: php-composer(nikic/php-parser) < %{php_parser_max_ver}
-# phpcompatinfo (computed from version 0.3.0)
+# phpcompatinfo (computed from version 0.4.0)
Requires: php-pcre
-Requires: php-reflection
Requires: php-spl
# Composer
@@ -69,14 +70,18 @@ Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
A set of code generator utilities built on top of PHP-Parsers that ease its use
when combined with Reflection.
+Autoloader: %{phpdir}/CodeGenerationUtils/autoload.php
+
%prep
%setup -qn %{github_name}-%{github_commit}
%build
-# Empty build section, nothing required
-
+%{_bindir}/phpab --output src/CodeGenerationUtils/autoload.php src/CodeGenerationUtils
+cat << 'EOF' | tee -a src/CodeGenerationUtils/autoload.php
+require_once '%{phpdir}/PhpParser2/autoload.php';
+EOF
%install
rm -rf %{buildroot}
@@ -86,21 +91,13 @@ cp -rp src/* %{buildroot}%{phpdir}/
%check
%if %{with_tests}
-# Create autoloader
-cat > autoload.php <<'AUTOLOAD'
-<?php
-require_once 'PhpParser/Autoloader.php';
-PhpParser\Autoloader::register();
-
-spl_autoload_register(function ($class) {
- $src = str_replace('\\', '/', $class).'.php';
- @include_once $src;
-});
-AUTOLOAD
-
-%{__phpunit} \
- --bootstrap autoload.php \
- --include-path %{buildroot}%{phpdir}:./tests
+mkdir vendor
+%{_bindir}/phpab --output vendor/autoload.php tests
+cat << 'EOF' | tee -a vendor/autoload.php
+require_once '%{buildroot}%{phpdir}/CodeGenerationUtils/autoload.php';
+EOF
+
+%{_bindir}/phpunit
%else
: Tests skipped
%endif
@@ -119,6 +116,12 @@ rm -rf %{buildroot}
%changelog
+* Wed Jun 29 2016 Remi Collet <remi@fedoraproject.org> - 0.4.0-1
+- update to 0.4.0
+- raise dependency on php ~7.0
+- raise dependency on nikic/php-parser ~2.0
+- add simple autoloader
+
* Sun Aug 9 2015 Remi Collet <remi@fedoraproject.org> - 0.3.2-1
- update to 0.3.2
- raise dependency on nikic/php-parser ~1.3