From 71881712c325f047fb1bb8dbbf7a31da85d7f06c Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 4 Sep 2017 12:18:56 +0200 Subject: import from Fedora --- php-flow-jsonpath-add-license-file.patch | 35 +++++++ php-flow-jsonpath.spec | 155 +++++++++++++++++++++++++++++++ 2 files changed, 190 insertions(+) create mode 100644 php-flow-jsonpath-add-license-file.patch create mode 100644 php-flow-jsonpath.spec diff --git a/php-flow-jsonpath-add-license-file.patch b/php-flow-jsonpath-add-license-file.patch new file mode 100644 index 0000000..825ef85 --- /dev/null +++ b/php-flow-jsonpath-add-license-file.patch @@ -0,0 +1,35 @@ +From 85bd143727b0fb063f03902aef39112ae37deaf2 Mon Sep 17 00:00:00 2001 +From: Shawn Iwinski +Date: Sun, 20 Aug 2017 21:13:06 -0400 +Subject: [PATCH] Add LICENSE file + +--- + LICENSE | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + create mode 100644 LICENSE + +diff --git a/LICENSE b/LICENSE +new file mode 100644 +index 0000000..d9fd9c2 +--- /dev/null ++++ b/LICENSE +@@ -0,0 +1,19 @@ ++Copyright (c) 2014-2017 Stephen Frank ++ ++Permission is hereby granted, free of charge, to any person obtaining a copy ++of this software and associated documentation files (the "Software"), to deal ++in the Software without restriction, including without limitation the rights ++to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++copies of the Software, and to permit persons to whom the Software is furnished ++to do so, subject to the following conditions: ++ ++The above copyright notice and this permission notice shall be included in all ++copies or substantial portions of the Software. ++ ++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ++THE SOFTWARE. diff --git a/php-flow-jsonpath.spec b/php-flow-jsonpath.spec new file mode 100644 index 0000000..44617de --- /dev/null +++ b/php-flow-jsonpath.spec @@ -0,0 +1,155 @@ +# +# Fedora spec file for php-flow-jsonpath +# +# Copyright (c) 2017 Shawn Iwinski +# +# License: MIT +# http://opensource.org/licenses/MIT +# +# Please preserve changelog entries +# + +%global github_owner FlowCommunications +%global github_name JSONPath +%global github_version 0.3.4 +%global github_commit 00aa9c361e4d0a210dd95f3c917a1e0dde3a957f + +%global composer_vendor flow +%global composer_project jsonpath + +# "php": ">=5.4.0" +%global php_min_ver 5.4.0 + +# Build using "--without tests" to disable tests +%global with_tests 0%{!?_without_tests:1} + +%{!?phpdir: %global phpdir %{_datadir}/php} + +Name: php-%{composer_vendor}-%{composer_project} +Version: %{github_version} +Release: 1%{?github_release}%{?dist} +Summary: JSONPath implementation for parsing, searching and flattening arrays + +Group: Development/Libraries +License: MIT +URL: https://github.com/%{github_owner}/%{github_name} +Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz + +# Add LICENSE file +# https://github.com/FlowCommunications/JSONPath/pull/20 +Patch0: %{name}-add-license-file.patch + +BuildArch: noarch +# Tests +%if %{with_tests} +## composer.json +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(phpunit/phpunit) +## phpcompatinfo (computed from version 0.3.4) +BuildRequires: php-json +BuildRequires: php-pcre +BuildRequires: php-spl +## Autoloader +BuildRequires: php-composer(fedora/autoloader) +%endif + +# composer.json +Requires: php(language) >= %{php_min_ver} +# phpcompatinfo (computed from version 0.3.4) +Requires: php-json +Requires: php-pcre +Requires: php-spl +# Autoloader +Requires: php-composer(fedora/autoloader) + +# Composer +Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} + +%description +This is a JSONPath [1] implementation for PHP based on Stefan Goessner's +JSONPath script. + +JSONPath is an XPath-like expression language for filtering, flattening and +extracting data. + +I believe that is improves on the original script (which was last updated in +2007) by doing a few things: +* Object-oriented code (should be easier to manage or extend in future) +* Expressions are parsed into tokens using some code cribbed from Doctrine + Lexer and cached +* There is no eval() in use +* Performance is pretty much the same +* Any combination of objects/arrays/ArrayAccess-objects can be used as the data + input which is great if you're de-serializing JSON in to objects or if you + want to process your own data structures. + +Autoloader: %{phpdir}/Flow/JSONPath/autoload.php + +[1] http://goessner.net/articles/JsonPath/ + + +%prep +%setup -qn %{github_name}-%{github_commit} + +: Add LICENSE file +%patch0 -p1 + + +%build +: Create autoloader +cat <<'AUTOLOAD' | tee src/Flow/JSONPath/autoload.php + - 0.3.4-1 +- Initial package -- cgit