From 1d32f26add635a6b528bf3cf97644b35118a8285 Mon Sep 17 00:00:00 2001 From: djmaze Date: Mon, 10 Aug 2020 12:43:02 +0200 Subject: [PATCH] Added release zip builder in php --- package.json | 2 +- release.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 release.php diff --git a/package.json b/package.json index 225933933..8d29446aa 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "title": "RainLoop Webmail", "description": "Simple, modern & fast web-based email client", "private": true, - "version": "1.14.0", + "version": "1.14.0-djmaze2", "homepage": "https://www.rainloop.net", "author": { "name": "RainLoop Team", diff --git a/release.php b/release.php new file mode 100644 index 000000000..487a4bae5 --- /dev/null +++ b/release.php @@ -0,0 +1,48 @@ +version}.zip"; + +$zip = new ZipArchive(); +if (!$zip->open($destination, ZIPARCHIVE::CREATE)) { + exit("Failed to create {$destination}"); +} + +$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('rainloop/v'), RecursiveIteratorIterator::SELF_FIRST); +foreach ($files as $file) { + $file = str_replace('\\', '/', $file); + + // Ignore "." and ".." folders + if (in_array(substr($file, strrpos($file, '/')+1), array('.', '..'))) + continue; + + $dest = str_replace('/0.0.0', "/{$package->version}", $file); + if (is_dir($file)) { + $zip->addEmptyDir($dest); + } else if (is_file($file)) { + $zip->addFromString($dest, file_get_contents($file)); + } +} + +$zip->addFromString('data/VERSION', $package->version); +//$zip->addFromString('data/EMPTY', $package->version); +$zip->addFile('_include.php'); + +$index = file_get_contents('index.php'); +$index = str_replace('0.0.0', $package->version, $index); +$index = str_replace('source', 'community', $index); +$zip->addFromString('index.php', $index); + +$zip->close(); + +echo "\n{$destination} created\n";