summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2019-09-12 13:48:36 +0200
committerRemi Collet <remi@remirepo.net>2019-09-12 13:48:36 +0200
commit66911f7b4b30c8a10259afde9d65837307003ed3 (patch)
tree046e92ee152b92b295314b90d57eea579fc3326c
new package
-rw-r--r--.gitignore8
-rw-r--r--Makefile4
-rw-r--r--composer.json42
-rwxr-xr-xmakesrc.sh28
-rw-r--r--php-swaggest-json-schema.spec157
5 files changed, 239 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fc9aa8c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+clog
+package-*.xml
+*.tgz
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..91b0fd5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../common/Makefile
+
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..a96e1e4
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,42 @@
+{
+ "name": "swaggest/json-schema",
+ "description": "High definition PHP structures with JSON-schema based validation",
+ "type": "library",
+ "require": {
+ "php": ">=5.4",
+ "ext-json": "*",
+ "ext-mbstring": "*",
+ "phplang/scope-exit": "^1.0",
+ "swaggest/json-diff": "^3.5.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "4.8.35",
+ "phpunit/php-code-coverage": "2.2.4"
+ },
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Viacheslav Poturaev",
+ "email": "vearutop@gmail.com"
+ }
+ ],
+ "support": {
+ "email": "vearutop@gmail.com"
+ },
+ "prefer-stable": true,
+ "autoload": {
+ "psr-4": {
+ "Swaggest\\JsonSchema\\": "src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Swaggest\\JsonSchema\\Tests\\": "tests/src/"
+ }
+ },
+ "config": {
+ "platform": {
+ "php": "5.4.45"
+ }
+ }
+}
diff --git a/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..87a1c0b
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+NAME=$(basename $PWD)
+OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec)
+PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec)
+VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec)
+COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec)
+SHORT=${COMMIT:0:7}
+
+echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION, Commit=$COMMIT\n"
+
+echo "Cloning..."
+git clone --recursive https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
+
+echo "Getting commit..."
+pushd $PROJECT-$COMMIT
+git checkout $COMMIT
+cp composer.json ../composer.json
+popd
+
+echo "Archiving..."
+tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs $PROJECT-$COMMIT
+
+echo "Cleaning..."
+rm -rf $PROJECT-$COMMIT
+
+echo "Done."
+
diff --git a/php-swaggest-json-schema.spec b/php-swaggest-json-schema.spec
new file mode 100644
index 0000000..e8ab08d
--- /dev/null
+++ b/php-swaggest-json-schema.spec
@@ -0,0 +1,157 @@
+# remirepo/fedora spec file for php-swaggest-json-schema
+#
+# Copyright (c) 2019 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/4.0/
+#
+# Please, preserve the changelog entries
+#
+
+%global with_tests 0%{!?_without_tests:1}
+# Github
+%global gh_commit b324c2b7fd0178c7453483d6d6efe440d99d1925
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner swaggest
+%global gh_project php-json-schema
+# Packagist
+%global pk_vendor %{gh_owner}
+%global pk_project json-schema
+# Namespace
+%global ns_vendor Swaggest
+%global ns_project JsonSchema
+%global major %nil
+
+Name: php-%{pk_vendor}-%{pk_project}%{major}
+Version: 0.12.17
+Release: 1%{?gh_date?%{gh_date}git%{gh_short}}%{?dist}
+Summary: High definition PHP structures with JSON-schema based validation
+
+License: MIT
+URL: https://github.com/%{gh_owner}/%{gh_project}
+Source0: %{name}-%{version}-%{?gh_short}.tgz
+Source1: makesrc.sh
+
+BuildArch: noarch
+%if %{with_tests}
+BuildRequires: php(language) >= 5.4
+BuildRequires: php-json
+BuildRequires: php-mbstring
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+BuildRequires: (php-composer(phplang/scope-exit) > 1.0 with php-composer(phplang/scope-exit) < 2)
+BuildRequires: (php-composer(swaggest/json-diff) > 3.5.1 with php-composer(swaggest/json-diff) < 4)
+%else
+BuildRequires: php-composer(phplang/scope-exit) < 2
+BuildRequires: php-composer(phplang/scope-exit) >= 1.0
+BuildRequires: php-composer(swaggest/json-diff) < 4
+BuildRequires: php-composer(swaggest/json-diff) >= 3.5.1
+%endif
+# For tests, from composer.json "require-dev": {
+# "phpunit/phpunit": "^4.8.23",
+# "phpunit/php-code-coverage": "2.2.4",
+# "codeclimate/php-test-reporter": "^0.4.0"
+BuildRequires: php-composer(phpunit/phpunit) >= 4.8.23
+%global phpunit %{_bindir}/phpunit
+BuildRequires: php-date
+BuildRequires: php-filter
+BuildRequires: php-pcre
+BuildRequires: php-spl
+# For autoloader
+BuildRequires: php-fedora-autoloader-devel
+%endif
+
+# From composer.json, "require": {
+# "php": ">=5.4",
+# "ext-json": "*",
+# "ext-mbstring": "*",
+# "phplang/scope-exit": "^1.0",
+# "swaggest/json-diff": "^3.5.1"
+Requires: php(language) >= 5.4
+Requires: php-json
+Requires: php-mbstring
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+Requires: (php-composer(phplang/scope-exit) > 1.0 with php-composer(phplang/scope-exit) < 2)
+Requires: (php-composer(swaggest/json-diff) > 3.5.1 with php-composer(swaggest/json-diff) < 4)
+%else
+Requires: php-composer(phplang/scope-exit) < 2
+Requires: php-composer(phplang/scope-exit) >= 1.0
+Requires: php-composer(swaggest/json-diff) < 4
+Requires: php-composer(swaggest/json-diff) >= 3.5.1
+%endif
+# From phpcompatinfo report for 0.12.17
+Requires: php-date
+Requires: php-filter
+Requires: php-pcre
+Requires: php-spl
+# For generated autoloader
+Requires: php-composer(fedora/autoloader)
+
+# Composer
+Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version}
+
+
+%description
+High definition PHP structures with JSON-schema based validation.
+
+Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+
+: Fix layout
+mkdir src/spec
+cp -p spec/*.json src/spec/
+sed -e 's:/../spec/:/spec/:' -i src/RemoteRef/Preloaded.php
+
+
+%build
+: Create autoloader
+%{_bindir}/phpab -t fedora -o src/autoload.php src
+cat << 'EOF' | tee -a src/autoload.php
+
+\Fedora\Autoloader\Dependencies::required([
+ '%{_datadir}/php/PhpLang/scope-exit-autoload.php',
+ '%{_datadir}/php/Swaggest/JsonDiff/autoload.php',
+]);
+EOF
+
+
+%install
+: Library
+mkdir -p %{buildroot}%{_datadir}/php/%{ns_vendor}
+cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
+
+
+%check
+%if %{with_tests}
+mkdir vendor
+cat << 'EOF' | tee vendor/autoload.php
+<?php
+require '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\%{ns_project}\\Tests\\', dirname(__DIR__).'/tests/src');
+EOF
+
+ret=0
+for cmd in php php71 php72 php73 php74; do
+ if which $cmd; then
+ $cmd %{phpunit} --no-coverage --verbose || ret=1
+ fi
+done
+exit $ret
+%else
+: Test suite disabled
+%endif
+
+
+%files
+# remirepo:1
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc composer.json
+%doc README.md
+%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
+
+
+%changelog
+* Thu Sep 12 2019 Remi Collet <remi@remirepo.net> - 0.12.17-1
+- initial package