interface Components_Dependencies
{
/**
+ * Returns the distribution handler for a package.
+ *
+ * @return Components_Runner_Distribute The distribution handler.
+ */
+ public function getRunnerDistribute();
+
+ /**
* Returns the installer for a package.
*
* @return Components_Runner_Installer The installer.
}
/**
+ * Returns the distribution handler for a package.
+ *
+ * @return Components_Runner_Distribute The distribution handler.
+ */
+ public function getRunnerDistribute()
+ {
+ return $this->getInstance('Components_Runner_Distribute');
+ }
+
+ /**
* Returns the installer for a package.
*
* @return Components_Runner_Installer The installer.
--- /dev/null
+<?php
+/**
+ * Components_Module_Distribute:: prepares a distribution package for a
+ * component.
+ *
+ * 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_Module_Distribute:: prepares a distribution package for a
+ * component.
+ *
+ * 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 <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Components
+ */
+class Components_Module_Distribute
+extends Components_Module_Base
+{
+ /**
+ * Return the title for the option group representing this module.
+ *
+ * @return string The group title.
+ */
+ public function getOptionGroupTitle()
+ {
+ return 'Distribute';
+ }
+
+ /**
+ * Return the description for the option group representing this module.
+ *
+ * @return string The group description.
+ */
+ public function getOptionGroupDescription()
+ {
+ return 'This module prepares a distribution package (e.g. RPM, APT, Ebuild, ...) from a component.';
+ }
+
+ /**
+ * Return the options for this module.
+ *
+ * @return array The group options.
+ */
+ public function getOptionGroupOptions()
+ {
+ return array(
+ new Horde_Argv_Option(
+ '-D',
+ '--distribute',
+ array(
+ 'action' => 'store',
+ 'help' => 'Prepare the component package in the specified DISTRIBUTE location'
+ )
+ ),
+ new Horde_Argv_Option(
+ '-t',
+ '--template',
+ array(
+ 'action' => 'store',
+ 'help' => 'Location of a template that will be rewritten into the final package definition.'
+ )
+ ),
+ );
+ }
+
+ /**
+ * Determine if this module should act. Run all required actions if it has
+ * been instructed to do so.
+ *
+ * @return NULL
+ */
+ public function handle(Components_Config $config)
+ {
+ $options = $config->getOptions();
+ if (!empty($options['distribute'])) {
+ $this->_dependencies->getRunnerDistribute()->run();
+ }
+ }
+}
if (!file_exists($this->_config_file)) {
$this->createPearConfig();
}
+ if (!isset($GLOBALS['_PEAR_Config_instance'])) {
+ $GLOBALS['_PEAR_Config_instance'] = false;
+ }
return PEAR_Config::singleton($this->_config_file);
}
--- /dev/null
+<?php
+/**
+ * Components_Pear_Package:: provides package handling mechanisms.
+ *
+ * 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_Pear_Package:: provides package handling mechanisms.
+ *
+ * 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 <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Components
+ */
+class Components_Pear_Package
+{
+ /**
+ * The output handler.
+ *
+ * @param Component_Output
+ */
+ private $_output;
+
+ /**
+ * The package representation.
+ *
+ * @param PEAR_PackageFile_v2
+ */
+ private $_package;
+
+ /**
+ * Constructor.
+ *
+ * @param Component_Output $output The output handler.
+ */
+ public function __construct(Components_Output $output)
+ {
+ $this->_output = $output;
+ }
+
+ /**
+ * Define the package to work on.
+ *
+ * @param string $package_xml_patch Path to the package.xml file.
+ *
+ * @return NULL
+ */
+ public function setPackage($package_xml_path)
+ {
+ }
+}
--- /dev/null
+<?php
+/**
+ * Components_Runner_Distribute:: prepares a distribution package for a
+ * component.
+ *
+ * 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_Runner_Distribute:: prepares a distribution package for a
+ * component.
+ *
+ * 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 <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Components
+ */
+class Components_Module_Installer
+{
+ /**
+ * The configuration for the current job.
+ *
+ * @var Components_Config
+ */
+ private $_config;
+
+ /**
+ * The package handler.
+ *
+ * @var Components_Pear_Package
+ */
+ private $_package;
+
+ /**
+ * Constructor.
+ *
+ * @param Components_Config $config The configuration for the current job.
+ * @param Components_Pear_Package $package Package handler.
+ */
+ public function __construct(
+ Components_Config $config,
+ Components_Pear_Package $package
+ ) {
+ $this->_config = $config;
+ $this->_package = $package;
+ }
+
+ public function run()
+ {
+ $options = $this->_config->getOptions();
+ $arguments = $this->_config->getArguments();
+ $location = realpath($options['distribute']);
+
+ }
+}
<file name="Base.php" role="php" />
<file name="CiSetup.php" role="php" />
<file name="DevPackage.php" role="php" />
+ <file name="Distribute.php" role="php" />
<file name="Installer.php" role="php" />
<file name="PearPackageXml.php" role="php" />
</dir> <!-- /lib/Components/Module -->
<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/DevPackage.php" name="lib/Components/Module/DevPackage.php" />
+ <install as="Components/Module/Distribute.php" name="lib/Components/Module/Distribute.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/InstallLocation.php" name="lib/Components/Pear/InstallLocation.php" />
case 'calling the package with the install option and a Horde element':
$_SERVER['argv'] = array(
'horde-components',
+ '--channelxmlpath=' . dirname(__FILE__) . '/fixture/channels',
'--install=' . $this->_getTemporaryDirectory(),
dirname(__FILE__) . '/../../'
);