Skip to content

Commit

Permalink
Move docs/ to doc/.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Oct 16, 2017
1 parent 3c3afa2 commit 7d500c4
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/Horde/Release.php
Expand Up @@ -61,7 +61,7 @@ class Horde_Release
protected $_newSourceVersionString;

/**
* Version number of next release for docs/CHANGES.
* Version number of next release for doc/CHANGES.
*
* @var string
*/
Expand Down
13 changes: 9 additions & 4 deletions lib/Horde/Release/Sentinel.php
Expand Up @@ -32,7 +32,10 @@
class Horde_Release_Sentinel
{
/** Path to the CHANGES file. */
const CHANGES = '/docs/CHANGES';
const CHANGES = '/doc/CHANGES';

/** Path to the CHANGES file up to Horde 5. */
const CHANGES_H5 = '/docs/CHANGES';

/** Path to the Application.php file. */
const APPLICATION = '/lib/Application.php';
Expand Down Expand Up @@ -184,9 +187,11 @@ public function updateApplication($version)
*/
public function changesFileExists()
{
$changes = $this->_component . self::CHANGES;
if (file_exists($changes)) {
return $changes;
foreach (array(self::CHANGES, self::CHANGES_H5) as $path) {
$changes = $this->_component . $path;
if (file_exists($changes)) {
return $changes;
}
}
return false;
}
Expand Down
37 changes: 37 additions & 0 deletions test/Horde/Release/Unit/Release/SentinelTest.php
Expand Up @@ -29,6 +29,27 @@ class Horde_Release_Unit_Release_SentinelTest
extends Horde_Release_TestCase
{
public function testUpdateSentinel()
{
$tmp_dir = $this->getTemporaryDirectory();
$sentinel = new Horde_Release_Sentinel($tmp_dir);
mkdir($tmp_dir . '/doc');
file_put_contents($tmp_dir . '/doc/CHANGES', "\n=OLD=\n");
$sentinel->updateChanges('1.0.0');
$this->assertEquals(
'------
v1.0.0
------
=OLD=
',
file_get_contents($tmp_dir . '/doc/CHANGES')
);
}

public function testUpdateSentinelWithHorde5()
{
$tmp_dir = $this->getTemporaryDirectory();
$sentinel = new Horde_Release_Sentinel($tmp_dir);
Expand All @@ -50,6 +71,22 @@ public function testUpdateSentinel()
}

public function testReplaceSentinel()
{
$tmp_dir = $this->getTemporaryDirectory();
$sentinel = new Horde_Release_Sentinel($tmp_dir);
mkdir($tmp_dir . '/doc');
file_put_contents($tmp_dir . '/doc/CHANGES', "---\nOLD\n---\nTEST");
$sentinel->replaceChanges('1.0.0');
$this->assertEquals(
'------
v1.0.0
------
TEST',
file_get_contents($tmp_dir . '/doc/CHANGES')
);
}

public function testReplaceSentinelWithHorde5()
{
$tmp_dir = $this->getTemporaryDirectory();
$sentinel = new Horde_Release_Sentinel($tmp_dir);
Expand Down
31 changes: 31 additions & 0 deletions test/Horde/Release/Unit/ReleaseTest.php
Expand Up @@ -29,6 +29,37 @@ class Horde_Release_Unit_ReleaseTest
extends Horde_Release_TestCase
{
public function testUpdateSentinel()
{
$tmp_dir = $this->getTemporaryDirectory();
$r = $this->_getReleaseHelper(
$this->_getOptions(
array('oldversion' => '0.9', 'version' => '1.0',)
)
);
mkdir($tmp_dir . '/doc');
file_put_contents($tmp_dir . '/doc/CHANGES', "\n=OLD=\n");

$r->setVersionStrings();
$r->setDirectoryName($tmp_dir);
ob_start();
$r->updateSentinel();
ob_end_clean();

$this->assertEquals(
'----------
v1.0.1-cvs
----------
=OLD=
',
file_get_contents($tmp_dir . '/doc/CHANGES')
);
}

public function testUpdateSentinelWithHorde5()
{
$tmp_dir = $this->getTemporaryDirectory();
$r = $this->_getReleaseHelper(
Expand Down

0 comments on commit 7d500c4

Please sign in to comment.