summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2017-03-23 09:40:15 +0100
committerRemi Collet <fedora@famillecollet.com>2017-03-23 09:40:15 +0100
commitc7c2cafe3ded3a303a12cd6078f77893c09b554c (patch)
tree8b188ccbc30148acfae3db8ce30644fd22fd280a
parent9041633e57b7a54508e38ff6fd995172b1201205 (diff)
v5.2.0
-rw-r--r--.gitignore3
-rw-r--r--composer.json5
-rw-r--r--php-justinrainbow-json-schema5-rpm.patch82
-rw-r--r--php-justinrainbow-json-schema5.spec17
4 files changed, 88 insertions, 19 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cbff62c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*.tar.gz
+*.tgz
+*.src.rpm
diff --git a/composer.json b/composer.json
index c6257ad..f1f6fae 100644
--- a/composer.json
+++ b/composer.json
@@ -41,6 +41,7 @@
"require-dev": {
"json-schema/JSON-Schema-Test-Suite": "1.2.0",
"phpunit/phpunit": "^4.8.22",
+ "friendsofphp/php-cs-fixer": "^2.1",
"phpdocumentor/phpdocumentor": "~2"
},
"autoload": {
@@ -58,6 +59,8 @@
"scripts": {
"test" : "vendor/bin/phpunit",
"testOnly" : "vendor/bin/phpunit --colors --filter",
- "coverage" : "vendor/bin/phpunit --coverage-text"
+ "coverage" : "vendor/bin/phpunit --coverage-text",
+ "style-check" : "vendor/bin/php-cs-fixer fix --dry-run --verbose --diff",
+ "style-fix" : "vendor/bin/php-cs-fixer fix --verbose"
}
}
diff --git a/php-justinrainbow-json-schema5-rpm.patch b/php-justinrainbow-json-schema5-rpm.patch
index 28cbe0f..e354326 100644
--- a/php-justinrainbow-json-schema5-rpm.patch
+++ b/php-justinrainbow-json-schema5-rpm.patch
@@ -1,7 +1,7 @@
-diff -up bin/validate-json.rpm bin/validate-json
---- bin/validate-json.rpm 2016-04-15 11:02:32.629960716 +0200
-+++ bin/validate-json 2016-04-15 11:07:01.583136406 +0200
-@@ -6,28 +6,7 @@
+diff -up ./bin/validate-json.rpm ./bin/validate-json
+--- ./bin/validate-json.rpm 2017-03-23 08:58:50.000000000 +0100
++++ ./bin/validate-json 2017-03-23 09:23:35.797857285 +0100
+@@ -6,32 +6,7 @@
* @author Christian Weiske <christian.weiske@netresearch.de>
*/
@@ -16,7 +16,6 @@ diff -up bin/validate-json.rpm bin/validate-json
-{
- $className = ltrim($className, '\\');
- $fileName = '';
-- $namespace = '';
- if ($lastNsPos = strrpos($className, '\\')) {
- $namespace = substr($className, 0, $lastNsPos);
- $className = substr($className, $lastNsPos + 1);
@@ -27,19 +26,72 @@ diff -up bin/validate-json.rpm bin/validate-json
- require_once $fileName;
- }
-}
-+require_once '/usr/share/php/JsonSchema5/autoload.php';
-
- /**
- * Show the json parse error that happened last
-@@ -85,11 +64,6 @@ function parseHeaderValue($headerValue)
- }
-
-
+-
-// support running this tool from git checkout
-if (is_dir(__DIR__ . '/../src/JsonSchema')) {
- set_include_path(__DIR__ . '/../src' . PATH_SEPARATOR . get_include_path());
-}
--
++require_once '/usr/share/php/JsonSchema5/autoload.php';
+
$arOptions = array();
$arArgs = array();
- array_shift($argv);//script itself
+diff -up ./src/JsonSchema/Uri/UriRetriever.php.rpm ./src/JsonSchema/Uri/UriRetriever.php
+--- ./src/JsonSchema/Uri/UriRetriever.php.rpm 2017-03-23 08:58:50.000000000 +0100
++++ ./src/JsonSchema/Uri/UriRetriever.php 2017-03-23 09:23:35.797857285 +0100
+@@ -323,7 +323,8 @@ class UriRetriever implements BaseUriRet
+ }
+
+ // translate references to local files within the json-schema package
+- $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
++ $path = (getenv('BUILDROOT_SCHEMA')?:'') . '/usr/share/php-justinrainbow-json-schema5';
++ $uri = preg_replace('|^package://|', sprintf('file://%s/', $path), $uri);
+
+ return $uri;
+ }
+diff -up ./tests/Uri/UriRetrieverTest.php.rpm ./tests/Uri/UriRetrieverTest.php
+--- ./tests/Uri/UriRetrieverTest.php.rpm 2017-03-23 08:58:50.000000000 +0100
++++ ./tests/Uri/UriRetrieverTest.php 2017-03-23 09:28:28.992372836 +0100
+@@ -295,7 +295,8 @@ EOF;
+ public function testPackageURITranslation()
+ {
+ $retriever = new UriRetriever();
+- $root = sprintf('file://%s/', realpath(__DIR__ . '/../..'));
++ $path = (getenv('BUILDROOT_SCHEMA')?:'') . '/usr/share/php-justinrainbow-json-schema5';
++ $root = sprintf('file://%s/', $path);
+
+ $uri = $retriever->translate('package://foo/bar.json');
+ $this->assertEquals("${root}foo/bar.json", $uri);
+@@ -304,7 +305,8 @@ EOF;
+ public function testDefaultDistTranslations()
+ {
+ $retriever = new UriRetriever();
+- $root = sprintf('file://%s/dist/schema/', realpath(__DIR__ . '/../..'));
++ $path = (getenv('BUILDROOT_SCHEMA')?:'') . '/usr/share/php-justinrainbow-json-schema5';
++ $root = sprintf('file://%s/dist/schema/', $path);
+
+ $this->assertEquals(
+ $root . 'json-schema-draft-03.json',
+@@ -322,11 +324,12 @@ EOF;
+ $retriever = new UriRetriever();
+
+ // load schema from package
+- $schema = $retriever->retrieve('package://tests/fixtures/foobar.json');
++ $schema = $retriever->retrieve('file://' . dirname(__DIR__) . '/fixtures/foobar.json');
+ $this->assertNotFalse($schema);
+
+ // check that the schema was loaded & processed correctly
+- $this->assertEquals('454f423bd7edddf0bc77af4130ed9161', md5(json_encode($schema)));
++ $schema->id = 'foo';
++ $this->assertEquals('c2ef5714b639cea176fdeeafe418aa09', md5(json_encode($schema)));
+ }
+
+ public function testJsonSchemaOrgMediaTypeHack()
+@@ -365,7 +367,7 @@ EOF;
+ 'JsonSchema\Exception\JsonDecodingException',
+ 'JSON syntax is malformed'
+ );
+- $schema = $retriever->retrieve('package://tests/fixtures/bad-syntax.json');
++ $schema = $retriever->retrieve('file://' . dirname(__DIR__) . '/fixtures/bad-syntax.json');
+ }
+
+ public function testGenerateURI()
diff --git a/php-justinrainbow-json-schema5.spec b/php-justinrainbow-json-schema5.spec
index bf60d84..2bcf0cc 100644
--- a/php-justinrainbow-json-schema5.spec
+++ b/php-justinrainbow-json-schema5.spec
@@ -6,14 +6,14 @@
#
# Please, preserve the changelog entries
#
-%global gh_commit 48817e5f95c9d29e11513f12e43cc0223fa5eb6c
+%global gh_commit e3c9bccdc38bbd09bcac0131c00f3be58368b416
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner justinrainbow
%global gh_project json-schema
%global php_home %{_datadir}/php
%global with_tests 0%{!?_without_tests:1}
%global major 5
-%global minor 1.0
+%global minor 2.0
# Some sample files, only used for tests
@@ -59,6 +59,7 @@ BuildRequires: php-spl
# From composer.json, "require-dev": {
# "json-schema/JSON-Schema-Test-Suite": "1.2.0",
# "phpunit/phpunit": "^4.8.22",
+# "friendsofphp/php-cs-fixer": "^2.1",
# "phpdocumentor/phpdocumentor": "~2"
BuildRequires: php-composer(phpunit/phpunit) >= 4.8.22
# Autoloader
@@ -104,7 +105,8 @@ Autoloader: %{php_home}/JsonSchema%{major}/autoload.php
%prep
%setup -q -n %{gh_project}-%{gh_commit} -a 1
-%patch0 -p0 -b .rpm
+%patch0 -p1 -b .rpm
+find src -name \*.rpm -delete -print
cp %{SOURCE2} src/JsonSchema/autoload.php
@@ -131,6 +133,9 @@ rm -rf %{buildroot}
: Library
mkdir -p %{buildroot}%{php_home}
cp -pr src/JsonSchema %{buildroot}%{php_home}/JsonSchema%{major}
+: Schemas
+mkdir -p %{buildroot}%{_datadir}/%{name}
+cp -pr dist %{buildroot}%{_datadir}/%{name}/dist
: Command
install -Dpm 0755 bin/validate-json %{buildroot}%{_bindir}/validate-json%{major}
@@ -145,6 +150,8 @@ require '%{buildroot}%{php_home}/JsonSchema%{major}/autoload.php';
\Fedora\Autoloader\Autoload::addPsr4('JsonSchema\\Tests\\', 'tests/');
EOF
+export BUILDROOT_SCHEMA=%{buildroot}
+
: Test the command
sed -e 's:%{php_home}:%{buildroot}%{php_home}:' \
bin/validate-json > bin/validate-json-test
@@ -186,9 +193,13 @@ rm -rf %{buildroot}
%doc *.md
%{_bindir}/validate-json%{major}
%{php_home}/JsonSchema%{major}
+%{_datadir}/%{name}
%changelog
+* Thu Mar 23 2017 Remi Collet <remi@remirepo.net> - 5.2.0-1
+- Update to 5.2.0
+
* Wed Feb 22 2017 Remi Collet <remi@fedoraproject.org> - 5.1.0-1
- update to 5.1.0