]> mj.ucw.cz Git - gallery.git/blob - gal2/bin/gal-mj-upload
5ce096dcad41274546c36c285d8a3e90011edf0c
[gallery.git] / gal2 / bin / gal-mj-upload
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Cwd;
7 my $cwd = getcwd;
8 my ($root, $album) = $cwd =~ m{(.*)/photos/(.*)} or die "Cannot identify album from current directory, giving up.\n";
9 my $static = "$root/static/gallery/photo/$album";
10 -d $static or die "Cannot find generated photos in $static, giving up.\n";
11
12 print "## Uploading album $album\n";
13 system "rs", "$static/", "jw:www/static/gallery/photo/$album/";
14 die if $?;
15
16 print "## Pulling at the server\n";
17 system "ssh", "jw", "cd web && git pull";
18 die if $?;
19
20 print "## Regenerating cache at the server\n";
21 system "ssh", "jw", "cd web/photos/$album && ~/web/gal2/gal cache";
22 die if $?;
23
24 print "Done.\n";