From 58b154fc9db18054969a3c530f28e6aeadc349a9 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Wed, 26 Dec 2012 21:30:51 +0100 Subject: [PATCH] Gallery2: Added gal-mj-upload --- gal2/bin/gal-mj-upload | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 gal2/bin/gal-mj-upload diff --git a/gal2/bin/gal-mj-upload b/gal2/bin/gal-mj-upload new file mode 100755 index 0000000..5ce096d --- /dev/null +++ b/gal2/bin/gal-mj-upload @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Cwd; +my $cwd = getcwd; +my ($root, $album) = $cwd =~ m{(.*)/photos/(.*)} or die "Cannot identify album from current directory, giving up.\n"; +my $static = "$root/static/gallery/photo/$album"; +-d $static or die "Cannot find generated photos in $static, giving up.\n"; + +print "## Uploading album $album\n"; +system "rs", "$static/", "jw:www/static/gallery/photo/$album/"; +die if $?; + +print "## Pulling at the server\n"; +system "ssh", "jw", "cd web && git pull"; +die if $?; + +print "## Regenerating cache at the server\n"; +system "ssh", "jw", "cd web/photos/$album && ~/web/gal2/gal cache"; +die if $?; + +print "Done.\n"; -- 2.39.2