--- /dev/null
+.DS_Store
\ No newline at end of file
--- /dev/null
+#!perl
+
+use strict;
+use warnings;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Moose::Website;
+
+Moose::Website->new_with_options->run;
\ No newline at end of file
--- /dev/null
+---
+- name : home
+ template : index.tt
+ outfile : index.html
+- name : about
+ template : about.tt
+ outfile : about.html
+- name : download
+ template : download.tt
+ outfile : download.html
+ data :
+ CPAN:
+ - name : Moose
+ url : http://search.cpan.org/dist/Moose/
+ - name : Class::MOP
+ url : http://search.cpan.org/dist/Class-MOP/
+ - name : Task::Moose
+ url : http://search.cpan.org/dist/Task-Moose/
+ - name : Task::Kensho
+ url : http://search.cpan.org/dist/Task-Kensho/
+ - name : MooseX::*
+ url : http://search.cpan.org/search?query=MooseX&mode=dist
+ git:
+ public : git://git.moose.perl.org/Moose.git
+ commiter : gitmo@git.moose.perl.org:Moose.git
+ web_view : http://git.shadowcat.co.uk/gitweb/gitweb.cgi
+- name : articles
+ template : articles.tt
+ outfile : articles.html
+ data :
+ - year : 2010
+ articles :
+ - title : Moose 1.00 is Released
+ url : http://stevan-little.blogspot.com/2010/03/moose-100-is-released.html
+ - year : 2009
+ articles : []
+ - year : 2008
+ articles : []
+ - year : 2007
+ articles : []
+ - year : 2006
+ articles : []
+
--- /dev/null
+package Moose::Website;
+use Moose;
+use MooseX::Types::Path::Class;
+
+use Template;
+use YAML::XS 'LoadFile';
+use Moose::Website::I18N;
+
+our $VERSION = '0.01';
+our $AUTHORITY = 'cpan:STEVAN';
+
+with 'MooseX::Getopt';
+
+has 'page_file' => (
+ is => 'ro',
+ isa => 'Path::Class::File',
+ coerce => 1,
+ required => 1,
+);
+
+has 'outdir' => (
+ is => 'ro',
+ isa => 'Path::Class::Dir',
+ coerce => 1,
+ required => 1,
+);
+
+has 'template_root' => (
+ is => 'ro',
+ isa => 'Path::Class::Dir',
+ coerce => 1,
+ required => 1,
+);
+
+has 'template_config' => (
+ is => 'ro',
+ isa => 'HashRef',
+ lazy => 1,
+ default => sub { +{} },
+);
+
+has 'locale' => (
+ is => 'ro',
+ isa => 'Str',
+ default => sub { 'en' },
+);
+
+# ....
+
+has 'i18n' => (
+ is => 'ro',
+ isa => 'Object',
+ lazy => 1,
+ default => sub {
+ my $self = shift;
+ Moose::Website::I18N->get_handle( $self->locale )
+ }
+);
+
+has 'pages' => (
+ traits => [ 'NoGetopt' ],
+ is => 'ro',
+ isa => 'ArrayRef[HashRef]',
+ lazy => 1,
+ default => sub {
+ my $self = shift;
+ LoadFile( $self->page_file->stringify );
+ }
+);
+
+has 'tt' => (
+ traits => [ 'NoGetopt' ],
+ is => 'ro',
+ isa => 'Template',
+ lazy => 1,
+ default => sub {
+ my $self = shift;
+ Template->new(
+ INCLUDE_PATH => $self->template_root,
+ %{ $self->template_config }
+ )
+ }
+);
+
+sub log { shift; warn @_, "\n" }
+
+sub run {
+ my $self = shift;
+
+ foreach my $page ( @{ $self->pages } ) {
+ $self->tt->process(
+ $page->{template},
+ $self->build_template_params( current_page => $page ),
+ $self->outdir->file( $page->{outfile} )->stringify
+ ) || confess $self->tt->error;
+ }
+}
+
+sub build_template_params {
+ my ($self, %params) = @_;
+
+ $params{ pages } = $self->pages;
+ $params{ loc } = sub { $self->i18n->loc( @_ ) };
+
+ \%params;
+}
+
+
+__PACKAGE__->meta->make_immutable;
+
+no Moose; 1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Moose::Website - A Moosey solution to this problem
+
+=head1 SYNOPSIS
+
+ use Moose::Website;
+
+=head1 DESCRIPTION
+
+=head1 METHODS
+
+=over 4
+
+=item B<>
+
+=back
+
+=head1 BUGS
+
+All complex software has bugs lurking in it, and this module is no
+exception. If you find a bug please either email me, or add the bug
+to cpan-RT.
+
+=head1 AUTHOR
+
+Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2010 Infinity Interactive, Inc.
+
+L<http://www.iinteractive.com>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
--- /dev/null
+package Moose::Website::I18N;
+use Moose;
+
+use Path::Class;
+
+our $VERSION = '0.01';
+our $AUTHORITY = 'cpan:STEVAN';
+
+BEGIN { extends 'Locale::Maketext' };
+
+use Locale::Maketext::Lexicon {
+ '*' => [ Gettext => file(__FILE__)->parent->file("I18N", "po", "*.po")->stringify ],
+ _auto => 1,
+ _decode => 1,
+};
+
+sub loc {
+ my ( $self, $item, @args ) = @_;
+
+ if ( @args == 0 and ref($item) eq 'ARRAY') {
+ ( $item, @args ) = @$item;
+ }
+
+ return $self->maketext( $item, @args );
+}
+
+__PACKAGE__->meta->make_immutable( inline_constructor => 0 );
+
+no Moose; 1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Moose::Website::I18N - A Moosey solution to this problem
+
+=head1 SYNOPSIS
+
+ use Moose::Website::I18N;
+
+=head1 DESCRIPTION
+
+=head1 METHODS
+
+=over 4
+
+=item B<>
+
+=back
+
+=head1 BUGS
+
+All complex software has bugs lurking in it, and this module is no
+exception. If you find a bug please either email me, or add the bug
+to cpan-RT.
+
+=head1 AUTHOR
+
+Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2010 Infinity Interactive, Inc.
+
+L<http://www.iinteractive.com>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
--- /dev/null
+msgid ""
+msgstr ""
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid "global page title"
+msgstr "Moose - A Post Modern Object System for Perl"
+
+msgid "moose"
+msgstr "Moose"
+
+msgid "moose subtitle"
+msgstr "A Post Modern Object System for Perl"
+
+# nav
+
+msgid "nav home"
+msgstr "Home"
+
+msgid "nav about"
+msgstr "About"
+
+msgid "nav articles"
+msgstr "Articles"
+
+msgid "nav download"
+msgstr "Download"
+
+# about
+
+msgid "about title"
+msgstr "About Moose"
+
+msgid "about body"
+msgstr ""
+"<p>Moose is a postmodern object system for Perl 5 that takes the tedium out of writing object-oriented Perl. It borrows all the best features from Perl 6, CLOS (LISP), Smalltalk, Java, BETA, OCaml, Ruby and more, while still keeping true to its Perl 5 roots.</p>"
+"<p>Moose is 100% production ready and in heavy use in a number of systems and growing every day. Try it today!</p>"
+
+# articles
+
+msgid "articles title"
+msgstr "Articles About Moose"
+
+# download
+
+msgid "download title"
+msgstr "Download"
+
+msgid "cpan"
+msgstr "CPAN"
+
+msgid "git"
+msgstr "Git"
+
+msgid "git public"
+msgstr "Git Public Repo URL"
+
+msgid "git commiter"
+msgstr "Git URL for Commiters"
+
+msgid "git web view"
+msgstr "Git Web View"
+
+
+
+
+
+
+
--- /dev/null
+[% WRAPPER 'wrapper/sub_page.tt' %]
+
+ <h2>[% loc('about title') %]</h2>
+ [% loc('about body') %]
+
+[% END %]
\ No newline at end of file
--- /dev/null
+[% WRAPPER 'wrapper/sub_page.tt' %]
+
+ <h2>[% loc('articles title') %]</h2>
+
+ <ul>
+ [% FOREACH item IN current_page.data %]
+ <li>
+ [% loc(item.year) %]
+ <ul>
+ [% FOREACH article IN item.articles %]
+ <li><a href="[% article.url %]">[% article.title %]</a></li>
+ [% END %]
+ </ul>
+ </li>
+ [% END %]
+ </ul>
+
+[% END %]
\ No newline at end of file
--- /dev/null
+[% WRAPPER 'wrapper/sub_page.tt' %]
+
+ <h2>[% loc('download title') %]</h2>
+
+ <h3>[% loc('cpan') %]<h3>
+
+ <ul>
+ [% FOREACH module IN current_page.data.CPAN %]
+ <li><a href="[% module.url %]">[% module.name %]</a></li>
+ [% END %]
+ </ul>
+
+ <h3>[% loc('git') %]<h3>
+
+ <ul>
+ <li>[% loc('git public') %] — [% current_page.data.git.public %]</li>
+
+ <li>[% loc('git commiter') %] — [% current_page.data.git.commiter %]</li>
+
+ <li><a href="[% current_page.data.git.web_view %]">[% loc('git web view') %]</a></li>
+ </ul>
+
+
+[% END %]
\ No newline at end of file
--- /dev/null
+[% WRAPPER 'wrapper/root.tt' %]
+
+ <h1>[% loc('moose') %]</h1>
+ <h2>[% loc('moose subtitle') %]</h2>
+ [% INCLUDE 'shared/nav.tt' %]
+
+[% END %]
\ No newline at end of file
--- /dev/null
+<ul>
+ [% FOREACH page IN pages %]
+ <li><a href="[% page.outfile %]">[% loc('nav ' _ page.name) %]</a></li>
+ [% END %]
+</ul>
\ No newline at end of file
--- /dev/null
+<html>
+<head>
+<title>[% loc('global page title') %]</title>
+</head>
+<body>
+[% content %]
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+[% WRAPPER 'wrapper/root.tt' %]
+[% INCLUDE 'shared/nav.tt' %]
+[% content %]
+[% END %]
\ No newline at end of file