new release script, which sets versions for extensions
This commit is contained in:
parent
e2bf31e482
commit
7f672711a0
2 changed files with 106 additions and 9 deletions
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
scriptdir=$(dirname $(readlink -e $0))
|
||||
|
||||
# +--------------------------------------------------------------------------+
|
||||
# | pwg_rel_create.sh |
|
||||
# +--------------------------------------------------------------------------+
|
||||
|
@ -38,22 +40,78 @@ then
|
|||
git checkout $2
|
||||
fi
|
||||
|
||||
cd plugins
|
||||
git clone https://github.com/Piwigo/TakeATour.git
|
||||
git clone https://github.com/Piwigo/AdminTools.git
|
||||
git clone https://github.com/Piwigo/LocalFilesEditor.git
|
||||
git clone https://github.com/Piwigo/LanguageSwitch.git
|
||||
|
||||
# remove Git metadata
|
||||
rm -rf /tmp/$version/piwigo/.git
|
||||
rm -rf /tmp/$version/piwigo/plugins/*/.git
|
||||
|
||||
# +--------------------------------------------------------------------------+
|
||||
# | plugins |
|
||||
# +--------------------------------------------------------------------------+
|
||||
|
||||
cd plugins
|
||||
|
||||
for plugin in TakeATour AdminTools LocalFilesEditor LanguageSwitch
|
||||
do
|
||||
cd /tmp/$version/piwigo/plugins
|
||||
|
||||
plugin_dir=$plugin
|
||||
if [ $plugin = "LanguageSwitch" ]
|
||||
then
|
||||
plugin_dir=language_switch
|
||||
fi
|
||||
|
||||
# clone repo
|
||||
git clone https://github.com/Piwigo/${plugin}.git $plugin_dir
|
||||
cd /tmp/$version/piwigo/plugins/$plugin_dir
|
||||
|
||||
# change version
|
||||
perl $scriptdir/replace_version.pl --file=main.inc.php --version=$version
|
||||
|
||||
# register metadata in dedicated file
|
||||
echo https://github.com/Piwigo/${plugin}.git > pem_metadata.txt
|
||||
git log -n 1 --pretty=format:"%H %ad" --date=iso8601 >> pem_metadata.txt
|
||||
|
||||
# remove Git metadata
|
||||
rm -rf .git
|
||||
done
|
||||
|
||||
# +--------------------------------------------------------------------------+
|
||||
# | themes |
|
||||
# +--------------------------------------------------------------------------+
|
||||
|
||||
cd /tmp/$version/piwigo/themes
|
||||
for themefile in $(ls */themeconf.inc.php)
|
||||
do
|
||||
# change version
|
||||
perl $scriptdir/replace_version.pl --file=$themefile --version=$version
|
||||
done
|
||||
|
||||
# +--------------------------------------------------------------------------+
|
||||
# | languages |
|
||||
# +--------------------------------------------------------------------------+
|
||||
|
||||
cd /tmp/$version/piwigo/language
|
||||
for languagefile in $(ls */common.lang.php)
|
||||
do
|
||||
# change version
|
||||
perl $scriptdir/replace_version.pl --file=$languagefile --version=$version
|
||||
done
|
||||
|
||||
# +--------------------------------------------------------------------------+
|
||||
# | data directories + zip 1 |
|
||||
# +--------------------------------------------------------------------------+
|
||||
|
||||
# create "data" directories
|
||||
cd /tmp/$version
|
||||
|
||||
mkdir piwigo/upload
|
||||
mkdir piwigo/_data
|
||||
touch piwigo/_data/dummy.txt
|
||||
|
||||
zip -r $name-nochmod.zip piwigo
|
||||
zip -q -r $name-nochmod.zip piwigo
|
||||
|
||||
# +--------------------------------------------------------------------------+
|
||||
# | permissions + zip 2 |
|
||||
# +--------------------------------------------------------------------------+
|
||||
|
||||
chmod -R a+w piwigo/local
|
||||
chmod a+w piwigo/_data
|
||||
|
@ -61,6 +119,6 @@ chmod a+w piwigo/upload
|
|||
chmod a+w piwigo/plugins
|
||||
chmod a+w piwigo/themes
|
||||
|
||||
zip -r $name.zip piwigo
|
||||
zip -q -r $name.zip piwigo
|
||||
|
||||
echo cd /tmp/$version
|
||||
|
|
39
tools/replace_version.pl
Normal file
39
tools/replace_version.pl
Normal file
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
####
|
||||
# Usage
|
||||
#
|
||||
# perl replace_version.pl --file=/path/to/file.php --version=2.8.0
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Getopt::Long;
|
||||
use File::Basename;
|
||||
|
||||
my %opt = ();
|
||||
GetOptions(
|
||||
\%opt,
|
||||
qw/
|
||||
file=s
|
||||
version=s
|
||||
/
|
||||
);
|
||||
|
||||
if (not -e $opt{file}) {
|
||||
die "file missing ".$opt{file};
|
||||
}
|
||||
|
||||
my $new_content = '';
|
||||
open(my $ifh, '<'.$opt{file}) or die 'Houston, problem with "'.$opt{file}.'" for reading';
|
||||
while (<$ifh>) {
|
||||
if (/^Version:/) {
|
||||
$_ = 'Version: '.$opt{version}.''."\n";
|
||||
}
|
||||
$new_content.= $_;
|
||||
}
|
||||
close($ifh);
|
||||
|
||||
open(my $ofh, '>'.$opt{file}) or die 'Houston, problem with "'.$opt{file}.'" for writing';
|
||||
print {$ofh} $new_content;
|
||||
close($ofh);
|
Loading…
Add table
Reference in a new issue