Skip to content

Commit

Permalink
Further improve generated composer.json
Browse files Browse the repository at this point in the history
- Fix autoloader prefix
- Set the correct 'type'
- Default to Horde website as the homepage
  • Loading branch information
yunosh committed Nov 7, 2017
1 parent 95a5542 commit c983805
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions lib/Components/Component/Source.php
Expand Up @@ -383,12 +383,26 @@ public function updateComposerFromHordeYml()
'role' => $author['role'],
);
}
if ($yaml['name'] == 'Horde_Core') {
$prefix = 'Horde';
} elseif ($yaml['name'] == 'imp') {
$prefix = 'IMP';
} elseif (strpos($yaml['name'], 'Horde') !== 0) {
$prefix = Horde_String::ucfirst($yaml['name']);
} else {
$prefix = $yaml['name'];
}
$autoload = array('psr-0' => array($prefix => 'lib/'));
$type = $yaml['type'] == 'library' ? 'library' : 'project';
$homepage = isset($yaml['homepage'])
? $yaml['homepage']
: 'https://www.horde.org';

$json = array(
'name' => 'horde/' . $yaml['id'],
'description' => $yaml['full'],
'type' => $yaml['type'],
'homepage' => isset($yaml['homepage']) ? $yaml['homepage'] : null,
'type' => $type,
'homepage' => $homepage,
'license' => $yaml['license']['identifier'],
'authors' => $authors,
'version' => $yaml['version']['release'],
Expand All @@ -405,11 +419,7 @@ public function updateComposerFromHordeYml()
'pear-pear.horde.org/' . $yaml['id'] => $replaceVersion,
'pear-horde/' . $yaml['id'] => $replaceVersion,
),
'autoload' => array(
'psr-0' => array(
'Horde' => 'lib/',
),
),
'autoload' => $autoload,
);
$json = array_filter($json);

Expand Down

0 comments on commit c983805

Please sign in to comment.