--- /dev/null
+<?php
+/**
+ * Components_Helper_Templates:: converts templates into target files.
+ *
+ * PHP version 5
+ *
+ * @category Horde
+ * @package Components
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Components
+ */
+
+/**
+ * Components_Helper_Templates:: converts templates into target files.
+ *
+ * Copyright 2011 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 <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Components
+ */
+class Components_Helper_Templates
+{
+ /**
+ * The target location.
+ *
+ * @var string
+ */
+ private $_target;
+
+ /**
+ * Constructor.
+ *
+ * @param string $source The template(s) source path.
+ * @param string $target The template(s) target path.
+ */
+ public function __construct($source, $target)
+ {
+ $this->_target = $target;
+ }
+
+ /**
+ * Rewrite the template(s) from the source(s) to the target location(s).
+ *
+ * @param array $parameters The template(s) parameters.
+ *
+ * @return NULL
+ */
+ public function write(array $parameters = array())
+ {
+ file_put_contents($this->_target, '');
+ }
+}
\ No newline at end of file
<email>jan@horde.org</email>
<active>yes</active>
</lead>
- <date>2010-12-10</date>
- <time>05:54:35</time>
+ <date>2011-01-11</date>
+ <time>05:29:34</time>
<version>
<release>0.0.1</release>
<api>0.0.1</api>
<file name="InstallationRun.php" role="php" />
<file name="ListRun.php" role="php" />
<file name="Root.php" role="php" />
+ <file name="Templates.php" role="php" />
<file name="Tree.php" role="php" />
</dir> <!-- /lib/Components/Helper -->
<dir name="Module">
<file name="Dependencies.php" role="php" />
<file name="DevPackage.php" role="php" />
<file name="Distribute.php" role="php" />
+ <file name="Document.php" role="php" />
<file name="Installer.php" role="php" />
<file name="PearPackageXml.php" role="php" />
</dir> <!-- /lib/Components/Module -->
<file name="DependenciesTest.php" role="test" />
<file name="DevPackageTest.php" role="test" />
<file name="DistributeTest.php" role="test" />
+ <file name="DocumentTest.php" role="test" />
<file name="InstallerTest.php" role="test" />
<file name="PearPackageXmlTest.php" role="test" />
</dir> <!-- /test/Components/Integration/Components/Module -->
</dir> <!-- /test/Components/Integration -->
<dir name="Unit">
<dir name="Components">
+ <dir name="Helper">
+ <file name="TemplatesTest.php" role="test" />
+ </dir> <!-- /test/Components/Unit/Components/Helper -->
<dir name="Pear">
<dir name="Package">
<dir name="Filelist">
<file name="Autoload.php" role="test" />
<file name="phpunit.xml" role="test" />
<file name="StoryTestCase.php" role="test" />
+ <file name="TestCase.php" role="test" />
</dir> <!-- /test/Components -->
</dir> <!-- /test -->
<file name="COPYING" role="doc" />
<install as="Components/Helper/InstallationRun.php" name="lib/Components/Helper/InstallationRun.php" />
<install as="Components/Helper/ListRun.php" name="lib/Components/Helper/ListRun.php" />
<install as="Components/Helper/Root.php" name="lib/Components/Helper/Root.php" />
+ <install as="Components/Helper/Templates.php" name="lib/Components/Helper/Templates.php" />
<install as="Components/Helper/Tree.php" name="lib/Components/Helper/Tree.php" />
<install as="Components/Module/Base.php" name="lib/Components/Module/Base.php" />
<install as="Components/Module/CiSetup.php" name="lib/Components/Module/CiSetup.php" />
<install as="Components/Module/Dependencies.php" name="lib/Components/Module/Dependencies.php" />
<install as="Components/Module/DevPackage.php" name="lib/Components/Module/DevPackage.php" />
<install as="Components/Module/Distribute.php" name="lib/Components/Module/Distribute.php" />
+ <install as="Components/Module/Document.php" name="lib/Components/Module/Document.php" />
<install as="Components/Module/Installer.php" name="lib/Components/Module/Installer.php" />
<install as="Components/Module/PearPackageXml.php" name="lib/Components/Module/PearPackageXml.php" />
<install as="Components/Pear/Dependencies.php" name="lib/Components/Pear/Dependencies.php" />
<install as="Components/Autoload.php" name="test/Components/Autoload.php" />
<install as="Components/phpunit.xml" name="test/Components/phpunit.xml" />
<install as="Components/StoryTestCase.php" name="test/Components/StoryTestCase.php" />
+ <install as="Components/TestCase.php" name="test/Components/TestCase.php" />
<install as="Components/fixture/changelog/lib/Some.php" name="test/Components/fixture/changelog/lib/Some.php" />
<install as="Components/fixture/channels/pear.horde.org.channel.xml" name="test/Components/fixture/channels/pear.horde.org.channel.xml" />
<install as="Components/fixture/channels/pear.php.net.channel.xml" name="test/Components/fixture/channels/pear.php.net.channel.xml" />
<install as="Components/Integration/Components/Module/DependenciesTest.php" name="test/Components/Integration/Components/Module/DependenciesTest.php" />
<install as="Components/Integration/Components/Module/DevPackageTest.php" name="test/Components/Integration/Components/Module/DevPackageTest.php" />
<install as="Components/Integration/Components/Module/DistributeTest.php" name="test/Components/Integration/Components/Module/DistributeTest.php" />
+ <install as="Components/Integration/Components/Module/DocumentTest.php" name="test/Components/Integration/Components/Module/DocumentTest.php" />
<install as="Components/Integration/Components/Module/InstallerTest.php" name="test/Components/Integration/Components/Module/InstallerTest.php" />
<install as="Components/Integration/Components/Module/PearPackageXmlTest.php" name="test/Components/Integration/Components/Module/PearPackageXmlTest.php" />
+ <install as="Components/Unit/Components/Helper/TemplatesTest.php" name="test/Components/Unit/Components/Helper/TemplatesTest.php" />
<install as="Components/Unit/Components/Pear/Package/Filelist/DefaultTest.php" name="test/Components/Unit/Components/Pear/Package/Filelist/DefaultTest.php" />
<install as="COPYING" name="COPYING" />
<install as="TODO" name="TODO" />
<release>alpha</release>
<api>alpha</api>
</stability>
- <date>2010-12-10</date>
+ <date>2011-01-11</date>
<license uri="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html">LGPL</license>
<notes>
* Initial release
--- /dev/null
+<?php
+/**
+ * Test base.
+ *
+ * PHP version 5
+ *
+ * @category Horde
+ * @package Components
+ * @subpackage UnitTests
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Components
+ */
+
+/**
+ * Test base.
+ *
+ * Copyright 2011 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
+ * @subpackage UnitTests
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Components
+ */
+class Components_TestCase
+extends PHPUnit_Framework_TestCase
+{
+ protected function getTemporaryDirectory()
+ {
+ return Horde_Util::createTempDir();
+ }
+}
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * Test the template machinery.
+ *
+ * PHP version 5
+ *
+ * @category Horde
+ * @package Components
+ * @subpackage UnitTests
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Components
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../Autoload.php';
+
+/**
+ * Test the template machinery.
+ *
+ * Copyright 2011 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
+ * @subpackage UnitTests
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Components
+ */
+class Components_Unit_Components_Helper_TemplatesTest
+extends Components_TestCase
+{
+ public function testWrite()
+ {
+ $target = $this->getTemporaryDirectory() . '/target';
+ $templates = new Components_Helper_Templates('', $target, array());
+ $templates->write();
+ $this->assertTrue(file_exists($target));
+ }
+}
\ No newline at end of file