From 31227f0822145d55d1d278ec7176795585e2c9ff Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel
Date: Tue, 2 Nov 2010 08:16:02 +0100
Subject: [PATCH] Started wrapping/modifying the PackageFilemanager based
content list generator to allow injecting customized ignores.
---
components/lib/Components/Helper/Root.php | 10 +++
components/lib/Components/Pear/Factory.php | 3 -
.../lib/Components/Pear/Package/Contents.php | 35 ++++++----
.../Components/Pear/Package/Contents/Factory.php | 51 ++++++++++++++
.../Components/Pear/Package/Contents/Ignore.php | 67 ++++++++++++++++++
.../lib/Components/Pear/Package/Contents/List.php | 80 ++++++++++++++++++++++
6 files changed, 228 insertions(+), 18 deletions(-)
create mode 100644 components/lib/Components/Pear/Package/Contents/Factory.php
create mode 100644 components/lib/Components/Pear/Package/Contents/Ignore.php
create mode 100644 components/lib/Components/Pear/Package/Contents/List.php
diff --git a/components/lib/Components/Helper/Root.php b/components/lib/Components/Helper/Root.php
index 2f350b5cf..fc8312cf9 100644
--- a/components/lib/Components/Helper/Root.php
+++ b/components/lib/Components/Helper/Root.php
@@ -90,4 +90,14 @@ class Components_Helper_Root
}
return $package_file;
}
+
+ /**
+ * Return the contents of the gitignore file.
+ *
+ * @return string The information from the gitignore file.
+ */
+ public function fetchGitIgnore()
+ {
+ return '';
+ }
}
\ No newline at end of file
diff --git a/components/lib/Components/Pear/Factory.php b/components/lib/Components/Pear/Factory.php
index 6e136032e..f6d2f8d08 100644
--- a/components/lib/Components/Pear/Factory.php
+++ b/components/lib/Components/Pear/Factory.php
@@ -297,12 +297,9 @@ class Components_Pear_Factory
$package_xml_path,
array(
'packagedirectory' => dirname($package_xml_path),
- 'filelistgenerator' => 'file',
'clearcontents' => false,
'clearchangelog' => false,
'simpleoutput' => true,
- 'ignore' => array('*~', 'conf.php', 'CVS/*'),
- 'include' => '*',
'dir_roles' =>
array(
'bin' => 'script',
diff --git a/components/lib/Components/Pear/Package/Contents.php b/components/lib/Components/Pear/Package/Contents.php
index 2bffb9622..2c03805b8 100644
--- a/components/lib/Components/Pear/Package/Contents.php
+++ b/components/lib/Components/Pear/Package/Contents.php
@@ -49,17 +49,27 @@ class Components_Pear_Package_Contents
private $_filelist_factory;
/**
+ * Provides access to the contents handler.
+ *
+ * @var Components_Pear_Package_Contents_Factory
+ */
+ private $_contents_factory;
+
+ /**
* Constructor.
*
- * @param Components_Pear_Package_Tasks $tasks A tasks helper.
- * @param Components_Pear_Package_Filelist_Factory $factory Creates the filelist handler.
+ * @param Components_Pear_Package_Tasks $tasks A tasks helper.
+ * @param Components_Pear_Package_Filelist_Factory $filelist Creates the filelist handler.
+ * @param Components_Pear_Package_Contents_Factory $contents Creates the contents handler.
*/
public function __construct(
Components_Pear_Package_Tasks $tasks,
- Components_Pear_Package_Filelist_Factory $factory
+ Components_Pear_Package_Filelist_Factory $filelist,
+ Components_Pear_Package_Contents_Factory $contents
) {
$this->_tasks = $tasks;
- $this->_filelist_factory = $factory;
+ $this->_filelist_factory = $filelist;
+ $this->_contents_factory = $contents;
}
/**
@@ -90,16 +100,6 @@ class Components_Pear_Package_Contents
}
/**
- * Generate an updated contents listing.
- *
- * @return NULL
- */
- private function _generateContents()
- {
- $this->getPackage()->generateContents();
- }
-
- /**
* Return an updated package description.
*
* @return PEAR_PackageFileManager2 The updated package.
@@ -107,7 +107,12 @@ class Components_Pear_Package_Contents
public function update()
{
$taskfiles = $this->_tasks->denote($this->getPackage());
- $this->_generateContents();
+
+ $generator = $this->_contents_factory->create($this->getPackage());
+ $this->getPackage()->clearContents('/');
+ $this->getPackage()->_struc = $generator->getFileList();
+ $this->getPackage()->_getSimpleDirTag($this->getPackage()->_struc);
+
$this->_tasks->annotate($this->getPackage(), $taskfiles);
$this->_filelist_factory->create($this->getPackage())->update();
diff --git a/components/lib/Components/Pear/Package/Contents/Factory.php b/components/lib/Components/Pear/Package/Contents/Factory.php
new file mode 100644
index 000000000..86c934a3a
--- /dev/null
+++ b/components/lib/Components/Pear/Package/Contents/Factory.php
@@ -0,0 +1,51 @@
+
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Components
+ */
+
+/**
+ * Components_Pear_Package_Contents_Factory:: handles the different content list
+ * generators.
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Horde
+ * @package Components
+ * @author Gunnar Wrobel