]> mj.ucw.cz Git - gallery.git/commitdiff
Gallery2: Added gal-mj-upload
authorMartin Mares <mj@ucw.cz>
Wed, 26 Dec 2012 20:30:51 +0000 (21:30 +0100)
committerMartin Mares <mj@ucw.cz>
Sun, 8 Feb 2015 20:14:09 +0000 (21:14 +0100)
gal2/bin/gal-mj-upload [new file with mode: 0755]

diff --git a/gal2/bin/gal-mj-upload b/gal2/bin/gal-mj-upload
new file mode 100755 (executable)
index 0000000..5ce096d
--- /dev/null
@@ -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";