public function getRunnerDistribute();
/**
+ * Returns the documentation handler for a package.
+ *
+ * @return Components_Runner_Document The distribution handler.
+ */
+ public function getRunnerDocument();
+
+ /**
* Returns the installer for a package.
*
* @return Components_Runner_Installer The installer.
{
parent::__construct(new Horde_Injector_TopLevel());
$this->setInstance('Components_Dependencies', $this);
+ $this->bindFactory(
+ 'Horde_Cli', 'Components_Dependencies', 'createCli'
+ );
}
/**
}
/**
+ * Returns the documentation handler for a package.
+ *
+ * @return Components_Runner_Document The distribution handler.
+ */
+ public function getRunnerDocument()
+ {
+ return $this->getInstance('Components_Runner_Document');
+ }
+
+ /**
* Returns the snapshot packaging handler for a package.
*
* @return Components_Runner_DevPackage The snapshot handler.
{
return $this->getInstance('Components_Output');
}
+
+ /**
+ * Create the CLI handler.
+ *
+ * @return Horde_Cli The CLI handler.
+ */
+ public function createCli()
+ {
+ return Horde_Cli::init();
+ }
}
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * Components_Module_Document:: generates HTML documentation 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_Document:: generates HTML documentation 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_Document
+extends Components_Module_Base
+{
+ /**
+ * Return the title for the option group representing this module.
+ *
+ * @return string The group title.
+ */
+ public function getOptionGroupTitle()
+ {
+ return 'Document';
+ }
+
+ /**
+ * Return the description for the option group representing this module.
+ *
+ * @return string The group description.
+ */
+ public function getOptionGroupDescription()
+ {
+ return 'This module generates HTML documentation for the component.';
+ }
+
+ /**
+ * Return the options for this module.
+ *
+ * @return array The group options.
+ */
+ public function getOptionGroupOptions()
+ {
+ return array(
+ new Horde_Argv_Option(
+ '-O',
+ '--document',
+ array(
+ 'action' => 'store',
+ 'help' => 'Generate the documentation for the component in the specified DOCUMENT root location. The name of the component will be added to this root path.'
+ )
+ ),
+ );
+ }
+
+ /**
+ * 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['document'])) {
+ $this->requirePackageXml($config->getPackageDirectory());
+ $this->_dependencies->getRunnerDocument()->run();
+ }
+ }
+}
--- /dev/null
+<?php
+/**
+ * Test the Document module.
+ *
+ * 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 Document module.
+ *
+ * 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
+ * @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_Integration_Components_Module_DocumentTest
+extends Components_StoryTestCase
+{
+ /**
+ * @scenario
+ */
+ public function theDocumentModuleAddsTheOOptionInTheHelpOutput()
+ {
+ $this->given('the default Components setup')
+ ->when('calling the package with the help option')
+ ->then('the help will contain the option', '-O\s*DOCUMENT,\s*--document=DOCUMENT');
+ }
+}
\ No newline at end of file