2 # This is a hack to upload a locally generated gallery to MJ's web.
6 print "## Updating Git\n";
10 print "## Ensuring that photos are generated\n";
16 my ($root, $album) = $cwd =~ m{(.*)/photos/(.*)} or die "Cannot identify album from current directory, giving up.\n";
17 my $static = "$root/static/gallery/photo/$album";
18 -d $static or die "Cannot find generated photos in $static, giving up.\n";
20 print "## Uploading album $album\n";
21 system "rs", "$static/", "jw:www/static/gallery/photo/$album/";
24 print "## Calling editor on index files\n";
25 system 'vim', 'gallery.cf', "$root/photos/Makefile", "$root/photos/index.thtml";
28 print "## Committing to repository\n";
29 system 'git', 'add', 'gallery.cf', 'gallery.list'; die if #?;
30 system 'git', 'add', "$root/photos/Makefile", "$root/photos/index.thtml", "$root/photos/default.cf"; die if $?;
31 system 'git', 'commit'; die if $?;
32 system 'git', 'push'; die if $?;
34 print "## Pulling at the server\n";
35 system "ssh", "jw", "cd web && git pull && make";
38 print "## Regenerating cache at the server\n";
39 system "ssh", "jw", "cd web/photos/$album && ~/web/gal/gal cache";