Generate AUTHORS file from commits

This commit is contained in:
Lukas Reschke 2015-10-26 13:51:22 +01:00
parent 9a7a45bc37
commit f2a7888c5c
1 changed files with 20 additions and 1 deletions

View File

@ -21,6 +21,7 @@
class Licenses class Licenses
{ {
protected $paths = array(); protected $paths = array();
public $authors = [];
public function __construct() { public function __construct() {
$this->licenseText = <<<EOD $this->licenseText = <<<EOD
@ -82,7 +83,24 @@ EOD;
/** @var SplFileInfo $file */ /** @var SplFileInfo $file */
$this->handleFile($file); $this->handleFile($file);
} }
}
function writeAuthorsFile() {
ksort($this->authors);
$template = "ownCloud is written by:
@AUTHORS@
With help from many libraries and frameworks including:
Open Collaboration Services
SabreDAV
jQuery
";
$authors = implode(PHP_EOL, array_map(function($author){
return " - ".$author;
}, $this->authors));
$template = str_replace('@AUTHORS@', $authors, $template);
file_put_contents(__DIR__.'/../AUTHORS', $template);
} }
function handleFile($path) { function handleFile($path) {
@ -156,6 +174,7 @@ EOD;
'Jenkins for ownCloud <owncloud-bot@tmit.eu>']); 'Jenkins for ownCloud <owncloud-bot@tmit.eu>']);
}); });
$authors = array_map(function($author){ $authors = array_map(function($author){
$this->authors[$author] = $author;
return " * @author $author"; return " * @author $author";
}, $authors); }, $authors);
return implode(PHP_EOL, $authors); return implode(PHP_EOL, $authors);
@ -187,5 +206,5 @@ if (isset($argv[1])) {
'../status.php', '../status.php',
'../version.php', '../version.php',
]); ]);
$licenses->writeAuthorsFile();
} }