mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
use tar.gz to archive releases
This commit is contained in:
parent
929b506789
commit
ddca233771
1 changed files with 11 additions and 11 deletions
|
|
@ -4,19 +4,19 @@
|
||||||
// PHP 5.4 is required
|
// PHP 5.4 is required
|
||||||
|
|
||||||
if ( !isset($argv) || !isset($argv[1]) ) {
|
if ( !isset($argv) || !isset($argv[1]) ) {
|
||||||
die("Usage: buildzip.php <path_to_repo> [-o source.zip] [-v VERSION]\n");
|
die("Usage: buildtar.php <path_to_repo> [-o source.tar.gz] [-v VERSION]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
$repo = $argv[1];
|
$repo = $argv[1];
|
||||||
$dir = sys_get_temp_dir(). DIRECTORY_SEPARATOR. "mytinytodo.build";
|
$dir = sys_get_temp_dir(). DIRECTORY_SEPARATOR. "mytinytodo.build";
|
||||||
$curdir = getcwd();
|
$curdir = getcwd();
|
||||||
$zipfile = $curdir. DIRECTORY_SEPARATOR. 'mytinytodo-v@VERSION-@REV.zip';
|
$archive = $curdir. DIRECTORY_SEPARATOR. 'mytinytodo-v@VERSION-@REV.tar.gz';
|
||||||
$ver = 0;
|
$ver = 0;
|
||||||
|
|
||||||
while ($arg = next($argv))
|
while ($arg = next($argv))
|
||||||
{
|
{
|
||||||
if ($arg == '-o') {
|
if ($arg == '-o') {
|
||||||
$zipfile = next($argv);
|
$archive = next($argv);
|
||||||
}
|
}
|
||||||
elseif ($arg == '-v') {
|
elseif ($arg == '-v') {
|
||||||
$ver = next($argv);
|
$ver = next($argv);
|
||||||
|
|
@ -62,23 +62,23 @@ closedir($dh);
|
||||||
chdir('..'); # to the root of repo
|
chdir('..'); # to the root of repo
|
||||||
rename('src', 'mytinytodo') or die("Cant rename 'src'\n");
|
rename('src', 'mytinytodo') or die("Cant rename 'src'\n");
|
||||||
|
|
||||||
`zip -9 -r mytinytodo.zip mytinytodo`; #OS dep.!!!
|
`tar -czf mytinytodo.tar.gz mytinytodo`; #OS dep.!!!
|
||||||
if (!file_exists('mytinytodo.zip')) {
|
if (!file_exists('mytinytodo.tar.gz')) {
|
||||||
die("Failed to pack files (no output zip file)\n");
|
die("Failed to pack files (no output tar.gz file)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
$zipfile = str_replace('@VERSION', $ver, $zipfile);
|
$archive = str_replace('@VERSION', $ver, $archive);
|
||||||
$zipfile = str_replace('@REV', $rev, $zipfile);
|
$archive = str_replace('@REV', $rev, $archive);
|
||||||
|
|
||||||
chdir($curdir);
|
chdir($curdir);
|
||||||
if ( ! rename("$dir/mytinytodo.zip", $zipfile) ) {
|
if ( ! rename("$dir/mytinytodo.tar.gz", $archive) ) {
|
||||||
die("Failed to move mytinytodo.zip to $zipfile");
|
die("Failed to move mytinytodo.tar.gz to $archive");
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteTreeIfDir($dir);
|
deleteTreeIfDir($dir);
|
||||||
echo("> Temp dir was cleaned\n");
|
echo("> Temp dir was cleaned\n");
|
||||||
|
|
||||||
echo("> Build is stored in $zipfile\n");
|
echo("> Build is stored in $archive\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in a new issue