aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2016-03-07 20:59:19 +0100
committerplegall <plg@piwigo.org>2016-03-07 20:59:19 +0100
commit7f672711a08fa3dcf103179aef04e07fb6f79643 (patch)
treee056b322f4b4ab3cef9473d8816b195d54fe61be /tools
parente2bf31e482923836120c9abcd38767e5693ac28d (diff)
new release script, which sets versions for extensions
Diffstat (limited to 'tools')
-rwxr-xr-xtools/pwg_rel_create.sh74
-rw-r--r--tools/replace_version.pl39
2 files changed, 105 insertions, 8 deletions
diff --git a/tools/pwg_rel_create.sh b/tools/pwg_rel_create.sh
index f891d55e1..c3cf7d0ce 100755
--- a/tools/pwg_rel_create.sh
+++ b/tools/pwg_rel_create.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+scriptdir=$(dirname $(readlink -e $0))
+
# +--------------------------------------------------------------------------+
# | pwg_rel_create.sh |
# +--------------------------------------------------------------------------+
@@ -38,22 +40,78 @@ then
git checkout $2
fi
+# remove Git metadata
+rm -rf /tmp/$version/piwigo/.git
+
+# +--------------------------------------------------------------------------+
+# | plugins |
+# +--------------------------------------------------------------------------+
+
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
-rm -rf /tmp/$version/piwigo/.git
-rm -rf /tmp/$version/piwigo/plugins/*/.git
+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
diff --git a/tools/replace_version.pl b/tools/replace_version.pl
new file mode 100644
index 000000000..845948d81
--- /dev/null
+++ b/tools/replace_version.pl
@@ -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);