From 7f5bbea1ec5605924c62a604f6f67c187a8346ea Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Tue, 17 Feb 2015 13:40:18 +0100
Subject: php-phpspec-php-diff: 1.0.2 - New package

---
 Makefile                  |  4 +++
 php-diff-example.patch    | 50 ++++++++++++++++++++++++++
 php-phpspec-php-diff.spec | 92 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 146 insertions(+)
 create mode 100644 Makefile
 create mode 100644 php-diff-example.patch
 create mode 100644 php-phpspec-php-diff.spec

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..13af741
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../../common/Makefile
+
diff --git a/php-diff-example.patch b/php-diff-example.patch
new file mode 100644
index 0000000..8f2d906
--- /dev/null
+++ b/php-diff-example.patch
@@ -0,0 +1,50 @@
+diff -up example/example.php.old example/example.php
+--- example/example.php.old	2015-02-17 13:26:45.000000000 +0100
++++ example/example.php	2015-02-17 13:27:34.000000000 +0100
+@@ -11,8 +11,8 @@
+ 		<hr />
+ 		<?php
+ 
+-		// Include the diff class
+-		require_once dirname(__FILE__).'/../lib/Diff.php';
++		// Include the autoloader
++		require_once 'phpspec/php-diff/autoload.php';
+ 
+ 		// Include two sample files for comparison
+ 		$a = explode("\n", file_get_contents(dirname(__FILE__).'/a.txt'));
+@@ -31,8 +31,6 @@
+ 		<h2>Side by Side Diff</h2>
+ 		<?php
+ 
+-		// Generate a side by side diff
+-		require_once dirname(__FILE__).'/../lib/Diff/Renderer/Html/SideBySide.php';
+ 		$renderer = new Diff_Renderer_Html_SideBySide;
+ 		echo $diff->Render($renderer);
+ 
+@@ -40,8 +38,6 @@
+ 		<h2>Inline Diff</h2>
+ 		<?php
+ 
+-		// Generate an inline diff
+-		require_once dirname(__FILE__).'/../lib/Diff/Renderer/Html/Inline.php';
+ 		$renderer = new Diff_Renderer_Html_Inline;
+ 		echo $diff->render($renderer);
+ 
+@@ -49,8 +45,6 @@
+ 		<h2>Unified Diff</h2>
+ 		<pre><?php
+ 
+-		// Generate a unified diff
+-		require_once dirname(__FILE__).'/../lib/Diff/Renderer/Text/Unified.php';
+ 		$renderer = new Diff_Renderer_Text_Unified;
+ 		echo htmlspecialchars($diff->render($renderer));
+ 
+@@ -59,8 +53,6 @@
+ 		<h2>Context Diff</h2>
+ 		<pre><?php
+ 
+-		// Generate a context diff
+-		require_once dirname(__FILE__).'/../lib/Diff/Renderer/Text/Context.php';
+ 		$renderer = new Diff_Renderer_Text_Context;
+ 		echo htmlspecialchars($diff->render($renderer));
+ 		?>
diff --git a/php-phpspec-php-diff.spec b/php-phpspec-php-diff.spec
new file mode 100644
index 0000000..27eb26a
--- /dev/null
+++ b/php-phpspec-php-diff.spec
@@ -0,0 +1,92 @@
+# spec file for php-phpspec-php-diff
+#
+# Copyright (c) 2015 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/4.0/
+#
+# Please, preserve the changelog entries
+#
+%global gh_commit    30e103d19519fe678ae64a60d77884ef3d71b28a
+%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner     phpspec
+%global gh_project   php-diff
+
+Name:           php-phpspec-php-diff
+Version:        1.0.2
+Release:        1%{?dist}
+Summary:        A library for generating differences between two hashable objects
+
+Group:          Development/Libraries
+# LICENSE text is inclued in the README file
+License:        BSD
+URL:            https://github.com/%{gh_owner}/%{gh_project}
+Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz
+
+# Fix example to use our generated autoloader
+Patch0:         %{gh_project}-example.patch
+
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch:      noarch
+# For minimal test
+BuildRequires:  php-cli
+# To generate an autoloader
+BuildRequires:  %{_bindir}/phpab
+
+Requires:       php(language)
+Requires:       php-pcre
+
+Provides:       php-composer(phpspec/php-diff) = %{version}
+
+
+%description
+A comprehensive library for generating differences between two hashable
+objects (strings or arrays). Generated differences can be rendered in
+all of the standard formats including:
+ * Unified
+ * Context
+ * Inline HTML
+ * Side by Side HTML
+
+The logic behind the core of the diff engine (ie, the sequence matcher)
+is primarily based on the Python difflib package. The reason for doing
+so is primarily because of its high degree of accuracy.
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+
+%patch0 -p0
+
+
+%build
+: Generate a simple autoloader
+%{_bindir}/phpab --output lib/autoload.php lib
+
+
+%install
+# No namespace, so use a package specific dir
+rm -rf       %{buildroot}
+mkdir -p     %{buildroot}%{_datadir}/php/phpspec/php-diff
+cp -pr lib/* %{buildroot}%{_datadir}/php/phpspec/php-diff
+
+
+%check
+# Not really a test... but should work without error
+cd example
+%{_bindir}/php -d include_path=%{buildroot}%{_datadir}/php example.php >/dev/null
+
+
+%clean
+rm -rf %{buildroot}
+
+
+%files
+%defattr(-,root,root,-)
+%doc README example
+%doc composer.json
+%{_datadir}/php/phpspec
+
+
+%changelog
+* Tue Feb 17 2015 Remi Collet <remi@fedoraproject.org> - 1.0.2-1
+- initial package
\ No newline at end of file
-- 
cgit