Skip to content

Commit

Permalink
Check if .horde.yml exists and is up-to-date.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Oct 25, 2017
1 parent d742737 commit 2e583cf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
14 changes: 14 additions & 0 deletions lib/Components/Component/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ public function getDocumentOrigin()
*/
public function updatePackage($action, $options)
{
if (!file_exists($this->getHordeYmlPath())) {
throw new Components_Exception($this->getHordeYmlPath() . ' is missing');
}

if (!file_exists($this->getPackageXmlPath())) {
if (!empty($options['theme'])) {
$this->getFactory()->createThemePackageFile($this->_directory);
Expand Down Expand Up @@ -711,4 +715,14 @@ public function getPackageXmlPath()
{
return $this->_directory . '/package.xml';
}

/**
* Return the path to the .horde.yml file of the component.
*
* @return string The path to the .horde.yml file.
*/
public function getHordeYmlPath()
{
return $this->_directory . '/.horde.yml';
}
}
10 changes: 8 additions & 2 deletions lib/Components/Helper/ChangeLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ public function changelogFileExists()
public function addChangelog($entry)
{
$hordeInfo = $this->_getHordeInfo();
$changelog = Horde_Yaml::loadFile($this->_directory . self::CHANGELOG);
if (!isset($hordeInfo['version'])) {
throw new Components_Exception('.horde.yml is missing a \'version\' entry');
}
$version = $hordeInfo['version']['release'];
$changelog = Horde_Yaml::loadFile($this->_directory . self::CHANGELOG);
$info = $changelog[$version];
$notes = explode("\n", trim($info['notes']));
array_unshift($notes, $entry);
Expand Down Expand Up @@ -324,8 +327,11 @@ public function updateChanges($options)
return;
}

$hordeInfo = $this->_getHordeInfo();
$allchanges = Horde_Yaml::loadFile($changelog);
$hordeInfo = $this->_getHordeInfo();
if (!isset($hordeInfo['version'])) {
throw new Components_Exception('.horde.yml is missing a \'version\' entry');
}

if (empty($options['pretend'])) {
$changesfp = fopen($changes, 'w');
Expand Down

0 comments on commit 2e583cf

Please sign in to comment.