X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage.pm;h=953d8ae4ab6d78c181d558cff9de3884762f4901;hb=879063d7deb100035d21ff2be57dce8d090b431f;hp=bce618c92b4216900b5327b908a4eeaecdbcd3ae;hpb=e5f2bda6c8984be0c49a3e058a165286791fef51;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page.pm b/lib/Gruntmaster/Page.pm index bce618c..953d8ae 100644 --- a/lib/Gruntmaster/Page.pm +++ b/lib/Gruntmaster/Page.pm @@ -4,13 +4,15 @@ use 5.014000; use strict; use warnings; use parent qw/Exporter/; -our @EXPORT_OK = qw/generate/; +our @EXPORT_OK = qw/generate _generate/; use Fcntl qw/:flock/; use File::Basename qw/fileparse/; +use File::Path qw/make_path/; use File::Slurp qw/write_file/; use IO::Compress::Gzip qw/gzip/; use IO::File; +use Gruntmaster::Data qw/PUBLISH/; our $VERSION = '0.001'; our @generators; @@ -34,6 +36,7 @@ sub declaregen{ my $contest = qr,(?:ct/$component/)?,; declaregen Index => qr,^index$,; declaregen Learn => qr,^learn$,; + declaregen Account => qr,^account$,; declaregen Ct => qr,^ct/index$,; declaregen 'Ct::Entry' => qr,^ct/$component/index$,; declaregen St => qr,^ct/$component/log/st$,; @@ -44,10 +47,11 @@ sub declaregen{ declaregen 'Pb::Entry' => qr,^${contest}pb/$component$,; } -sub generate{ +sub _generate{ my ($path) = @_; my ($path_noext, $ext) = $path =~ m/^(.*)\.(.*)$/; - my $basename = fileparse $path_noext; + my ($basename, $directories) = fileparse $path_noext; + make_path $directories; IO::File->new(">$path_noext.var")->close unless -f "$path_noext.var"; flock my $lockfh = IO::File->new("<$path_noext.var"), LOCK_EX; @@ -74,6 +78,10 @@ sub generate{ close $typemap; } +sub generate{ + PUBLISH 'genpage', shift; +} + 1; __END__ # Below is stub documentation for your module. You'd better edit it!