Removed the dependency on git for creating the zip archive

This commit is contained in:
Andy Heathershaw 2016-11-06 17:00:44 +00:00
parent 8eff022fc7
commit 24d9c318cb

View File

@ -79,10 +79,33 @@ $sgCommand = sprintf(
system($sgCommand);
echo 'Creating the release archive...' . PHP_EOL . PHP_EOL;
system('git add --force vendor/');
system('git stash');
system(sprintf('git archive --format zip --output %1$s/blue-twilight_%2$s.zip --prefix=blue-twilight_%2$s/ "stash@{0}"', $argv[2], $argv[1]));
system('git stash pop');
$rootPath = dirname(dirname(__DIR__));
// Initialize archive object
$zip = new ZipArchive();
$zip->open(sprintf('%s/blue-twilight_%s.zip', $argv[1], $argv[0]), ZipArchive::CREATE | ZipArchive::OVERWRITE);
/** @var SplFileInfo[] $files */
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($rootPath),
RecursiveIteratorIterator::LEAVES_ONLY
);
foreach ($files as $name => $file)
{
// Skip directories (they will be added automatically)
if (!$file->isDir())
{
// Get real and relative path for current file
$filePath = $file->getRealPath();
$relativePath = substr($filePath, strlen($rootPath) + 1);
// Add current file to archive
$zip->addFile($filePath, $relativePath);
}
}
$zip->close();
echo PHP_EOL . PHP_EOL;
echo 'All done!';