LSG.pm (1369B)
1 #!/usr/bin/env perl 2 3 # LSG.pm - Lumidify Site Generator 4 # Written by lumidify <nobody@lumidify.org> 5 # 6 # To the extent possible under law, the author has dedicated 7 # all copyright and related and neighboring rights to this 8 # software to the public domain worldwide. This software is 9 # distributed without any warranty. 10 # 11 # You should have received a copy of the CC0 Public Domain 12 # Dedication along with this software. If not, see 13 # <http://creativecommons.org/publicdomain/zero/1.0/>. 14 15 # Note: cross-platform path processing is used wherever possible, but 16 # other parts won't work properly anyways if the path separator isn't /. 17 # Good that nobody important uses any OS on which that's the case. 18 19 package LSG; 20 use strict; 21 use warnings; 22 use LSG::Config; 23 use LSG::Template; 24 use LSG::UserFuncs; 25 use LSG::Metadata; 26 use LSG::Generate; 27 use Data::Dumper; 28 29 # FIXME: don't just chdir into $path, in case that messes up anything 30 # the calling script wanted to do afterwards 31 sub init { 32 my $path = shift; 33 chdir($path) or die "Unable to access directory \"$path\": $!\n"; 34 LSG::Config::init_config("config.ini", "modified_dates"); 35 LSG::Template::init_templates(); 36 LSG::Metadata::init_metadata(); 37 LSG::UserFuncs::init_userfuncs(); 38 } 39 40 sub generate_site { 41 LSG::Generate::gen_files(); 42 LSG::Generate::delete_obsolete(); 43 LSG::Config::write_modified_dates("modified_dates"); 44 } 45 46 1;