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