1 package Moose::Website;
3 use MooseX::Types::Path::Class;
7 use YAML::XS 'LoadFile';
8 use Moose::Website::I18N;
10 our $VERSION = '0.01';
11 our $AUTHORITY = 'cpan:STEVAN';
13 with 'MooseX::Getopt';
17 isa => 'Path::Class::Dir',
24 isa => 'Path::Class::File',
27 file(__FILE__)->parent->parent->parent->file('data', 'pages.yml')
31 has 'template_root' => (
33 isa => 'Path::Class::Dir',
36 file(__FILE__)->parent->parent->parent->subdir('templates')
43 default => sub { 'en' },
54 Moose::Website::I18N->get_handle( $self->locale )
59 traits => [ 'NoGetopt' ],
61 isa => 'ArrayRef[HashRef]',
65 LoadFile( $self->page_file->stringify );
70 traits => [ 'NoGetopt' ],
77 INCLUDE_PATH => $self->template_root,
78 %{ $self->template_config }
83 has 'template_config' => (
84 traits => [ 'NoGetopt' ],
88 default => sub { +{} },
91 sub log { shift; warn @_, "\n" }
96 foreach my $page ( @{ $self->pages } ) {
98 my $outfile = $self->outdir->file( $page->{outfile} )->stringify;
100 $self->log( "Writing page " . $page->{name} . " to $outfile using template " . $page->{template} );
104 $self->build_template_params( current_page => $page ),
106 ) || confess $self->tt->error;
110 sub build_template_params {
111 my ($self, %params) = @_;
113 $params{ pages } = $self->pages;
114 $params{ loc } = sub { $self->i18n->loc( @_ ) };
120 __PACKAGE__->meta->make_immutable;
130 Moose::Website - A Moosey solution to this problem
148 All complex software has bugs lurking in it, and this module is no
149 exception. If you find a bug please either email me, or add the bug
154 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
156 =head1 COPYRIGHT AND LICENSE
158 Copyright 2010 Infinity Interactive, Inc.
160 L<http://www.iinteractive.com>
162 This library is free software; you can redistribute it and/or modify
163 it under the same terms as Perl itself.