summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore8
-rw-r--r--Makefile4
-rw-r--r--composer.json35
-rwxr-xr-xmakesrc.sh28
-rw-r--r--php-swaggest-json-diff.spec116
5 files changed, 191 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..9ffd7e9
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,35 @@
+{
+ "name": "swaggest/json-diff",
+ "description": "JSON diff/rearrange/patch/pointer library for PHP",
+ "type": "library",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Viacheslav Poturaev",
+ "email": "vearutop@gmail.com"
+ }
+ ],
+ "require": {
+ "ext-json": "*"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.8.23",
+ "phpunit/php-code-coverage": "2.2.4",
+ "codeclimate/php-test-reporter": "^0.4.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "Swaggest\\JsonDiff\\": "src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Swaggest\\JsonDiff\\Tests\\": "tests/src"
+ }
+ },
+ "config": {
+ "platform": {
+ "php": "5.4.45"
+ }
+ }
+}
diff --git a/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..7d752c6
--- /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 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-diff.spec b/php-swaggest-json-diff.spec
new file mode 100644
index 0000000..f0a6adc
--- /dev/null
+++ b/php-swaggest-json-diff.spec
@@ -0,0 +1,116 @@
+# remirepo/fedora spec file for php-swaggest-json-diff
+#
+# 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 53c412ad8e3fc1293d4e6fdf06f7839698ad897d
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner swaggest
+%global gh_project json-diff
+# Packagist
+%global pk_vendor %{gh_owner}
+%global pk_project %{gh_project}
+# Namespace
+%global ns_vendor Swaggest
+%global ns_project JsonDiff
+%global major %nil
+
+Name: php-%{pk_vendor}-%{pk_project}%{major}
+Version: 3.7.0
+Release: 1%{?gh_date?%{gh_date}git%{gh_short}}%{?dist}
+Summary: JSON diff/rearrange/patch/pointer library for PHP
+
+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-json
+# 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-filter
+BuildRequires: php-pcre
+# For autoloader
+BuildRequires: php-fedora-autoloader-devel
+%endif
+
+# From composer.json, "require": {
+# "ext-json": "*"
+Requires: php-json
+# From phpcompatinfo report for 3.7.0
+Requires: php-filter
+Requires: php-pcre
+# For generated autoloader
+Requires: php-composer(fedora/autoloader)
+
+# Composer
+Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version}
+
+
+%description
+A PHP implementation for finding unordered diff between two JSON documents.
+
+Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+
+
+%build
+: Create autoloader
+%{_bindir}/phpab -t fedora -o src/autoload.php src
+
+
+%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');
+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
+%dir %{_datadir}/php/%{ns_vendor}
+ %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
+
+
+%changelog
+* Thu Sep 12 2019 Remi Collet <remi@remirepo.net> - 3.7.0-1
+- initial package