mirror of
https://github.com/joomla-extensions/patchtester.git
synced 2024-12-23 03:19:00 +00:00
Add hash generator step
This commit is contained in:
parent
17b2521ef1
commit
6b62a397df
@ -16,3 +16,4 @@ tar zcf ../packages/com_patchtester.tar.gz .
|
||||
zip -r ../packages/com_patchtester.zip .
|
||||
cd ../../
|
||||
composer install
|
||||
php build/patchtester/hash_generator.php
|
||||
|
33
build/patchtester/hash_generator.php
Executable file
33
build/patchtester/hash_generator.php
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
* Script used to generate hashes for release packages
|
||||
*
|
||||
* Usage: php build/patchtester/hash_generator.php
|
||||
*
|
||||
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2017 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
|
||||
$packageDir = dirname(__DIR__) . '/packages';
|
||||
|
||||
$hashes = array();
|
||||
|
||||
/** @var DirectoryIterator $file */
|
||||
foreach (new DirectoryIterator($packageDir) as $file)
|
||||
{
|
||||
if ($file->isDir() || $file->isDot())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$hashes[$file->getFilename()] = array(
|
||||
'sha384' => hash_file('sha384', $file->getPathname()),
|
||||
);
|
||||
}
|
||||
|
||||
$jsonOptions = PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT : 0;
|
||||
|
||||
@file_put_contents($packageDir . '/checksums.json', json_encode($hashes, $jsonOptions));
|
||||
|
||||
echo 'Checksums file generated' . PHP_EOL . PHP_EOL;
|
Loading…
Reference in New Issue
Block a user