- Document usage
- - Fix variable replacements when updating the package.xml
-
- Do the distribution runner.
- Add module for generating component documentation.
$contents = $contents['dir']['file'];
$taskfiles = array();
foreach ($contents as $file) {
+ if (!isset($file['attribs'])) {
+ continue;
+ }
$atts = $file['attribs'];
unset($file['attribs']);
if (count($file)) {
$logger,
''
);
- switch ($tag) {
- case 'replace':
+ switch ($taskname) {
+ case 'PEAR_Task_Replace_rw':
$task->setInfo(
$raw['attribs']['from'],
$raw['attribs']['to'],
);
break;
default:
- throw new Components_Exceptions(
+ throw new Components_Exception(
sprintf('Unsupported task type %s!', $tag)
);
}
break;
case 'script':
$filename = basename($file['attribs']['name']);
- if (substr($filename, strlen($filename) - 4)) {
+ if (substr($filename, strlen($filename) - 4) == '.php') {
$filename = substr($filename, 0, strlen($filename) - 4);
}
$package->addInstallAs(
public function run()
{
$arguments = $this->_config->getArguments();
+ $options = $this->_config->getOptions();
+
if (isset($options['pearrc'])) {
$package = $this->_factory->createPackageForInstallLocation(
$arguments[0] . '/package.xml',
);
}
- $options = $this->_config->getOptions();
if (!empty($options['packagexml'])) {
$package->printUpdatedPackageFile();
}
public function thePOptionProvidesAnUpdatedPackageXml()
{
$this->given('the default Components setup')
- ->when('calling the package with the packagexml option and a Horde element')
+ ->when('calling the package with the packagexml option and a Horde component')
->then('the new package.xml of the Horde element will be printed.');
}
/**
+ * @scenario
+ */
+ public function thePOptionWithThePearrcOptionProvidesAnUpdatedPackageXml()
+ {
+ $this->given('the default Components setup')
+ ->when('calling the package with the pearrc, the packagexml option, and a Horde component')
+ ->then('the new package.xml of the Horde element will be printed.');
+ }
+
+ /**
+ * @scenario
+ */
+ public function thePOptionProvidesAnUpdatedPackageXmlWhichRetainsReplaceTasks()
+ {
+ $this->given('the default Components setup')
+ ->when('calling the package with the packagexml option and a Horde component')
+ ->then('the new package.xml of the Horde component will retain all "replace" tasks.');
+ }
+
+ /**
+ * @scenario
+ */
+ public function thePOptionProvidesAnUpdatedPackageXmlWithDefaultInstallLocations()
+ {
+ $this->given('the default Components setup')
+ ->when('calling the package with the packagexml option and a Horde component')
+ ->then('the new package.xml will install java script files in a default location')
+ ->and('the new package.xml will install migration files in a default location')
+ ->and('the new package.xml will install script files in a default location');
+ }
+
+
+ /**
* @todo Test (and fix) the reactions to three more scenarios:
* - invalid XML in the package.xml (e.g. tag missing)
* - empty file list
);
$world['output'] = $this->_callStrictComponents();
break;
- case 'calling the package with the packagexml option and a Horde element':
+ case 'calling the package with the packagexml option and a Horde component':
$_SERVER['argv'] = array(
'horde-components',
'--packagexml',
);
$world['output'] = $this->_callUnstrictComponents();
break;
+ case 'calling the package with the pearrc, the packagexml option, and a Horde component':
+ $_SERVER['argv'] = array(
+ 'horde-components',
+ '--pearrc=' . $this->_getTemporaryDirectory() . DIRECTORY_SEPARATOR . '.pearrc',
+ '--packagexml',
+ dirname(__FILE__) . '/fixture/simple'
+ );
+ $world['output'] = $this->_callUnstrictComponents();
+ break;
case 'calling the package with the packagexml option and the path':
$_SERVER['argv'] = array(
'horde-components',
$world['output']
);
break;
+ case 'the new package.xml of the Horde component will retain all "replace" tasks.':
+ $this->assertRegExp(
+ '#<tasks:replace from="@data_dir@" to="data_dir" type="pear-config" />#',
+ $world['output']
+ );
+ break;
+ case 'the new package.xml will install java script files in a default location':
+ $this->assertRegExp(
+ '#<install as="js/test.js" name="js/test.js" />#',
+ $world['output']
+ );
+ break;
+ case 'the new package.xml will install migration files in a default location':
+ $this->assertRegExp(
+ '#<install as="migration/test.sql" name="migration/test.sql" />#',
+ $world['output']
+ );
+ break;
+ case 'the new package.xml will install script files in a default location':
+ $this->assertRegExp(
+ '#<install as="other_script" name="script/other_script" />#',
+ $world['output']
+ );
+ $this->assertRegExp(
+ '#<install as="shell_script.sh" name="script/shell_script.sh" />#',
+ $world['output']
+ );
+ $this->assertRegExp(
+ '#<install as="script" name="script/script.php" />#',
+ $world['output']
+ );
+ break;
case 'a new PEAR configuration file will be installed':
$this->assertTrue(
file_exists($this->_temp_dir . DIRECTORY_SEPARATOR . '.pearrc')
<dir baseinstalldir="/" name="/">
<dir name="lib">
<file name="Old.php" role="php" />
+ <file name="Stays.php" role="php">
+ <tasks:replace from="@data_dir@" to="data_dir" type="pear-config" />
+ </file>
</dir> <!-- /lib -->
</dir> <!-- / -->
</contents>
<phprelease>
<filelist>
<install as="Old.php" name="lib/Old.php" />
+ <install as="Stays.php" name="lib/Stays.php" />
</filelist>
</phprelease>
<changelog>
--- /dev/null
+#!/usr/bin/env php
+<?php
--- /dev/null
+#!/usr/bin/env php
+<?php
--- /dev/null
+#!/usr/bin/bash