Show
Ignore:
Timestamp:
05/27/08 21:45:18 (6 months ago)
Author:
tokuhirom
Message:

added role.

Location:
lang/perl/App-Chariot/trunk/lib/App
Files:
2 added
4 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/App-Chariot/trunk/lib/App/Chariot.pm

    r12556 r12557  
    118118    mkdir $self->config->output_dir; 
    119119    for my $controller (@CONTROLLERS) { 
    120         $controller->meta->get_method('create')->body->( $self ); 
     120        $controller->new->create($self); 
    121121    } 
    122122} 
  • lang/perl/App-Chariot/trunk/lib/App/Chariot/C/Index.pm

    r12556 r12557  
    11package App::Chariot::C::Index; 
    22use Moose; 
     3with 'App::Chariot::Role::C'; 
    34 
    45sub create { 
    5     my $self = shift; 
     6    my ($self, $c) = @_; 
    67 
    7     print "create index page\n"; 
    8     my @list = reverse @{$self->dat->list}; 
    9     my $ifile = File::Spec->catfile($self->config->assets_dir, 'tmpl', 'index.tt'); 
    10     my $ofile = File::Spec->catfile($self->config->output_dir, 'index.html'); 
     8    my @list = reverse @{$c->dat->list}; 
     9    my $ifile = File::Spec->catfile($c->config->assets_dir, 'tmpl', 'index.tt'); 
     10    my $ofile = File::Spec->catfile($c->config->output_dir, 'index.html'); 
    1111 
    12     $self->render( 
     12    $c->render( 
    1313        $ifile => $ofile, { 
    14             entries => [ @list[0..($self->config->index_stop)] ], 
     14            entries => [ @list[0..($c->config->index_stop)] ], 
    1515        } 
    1616    ); 
  • lang/perl/App-Chariot/trunk/lib/App/Chariot/C/Permalink.pm

    r12556 r12557  
    11package App::Chariot::C::Permalink; 
    22use Moose; 
     3with 'App::Chariot::Role::C'; 
    34 
    45sub create { 
    5     my ($self, ) = @_; 
     6    my ($self, $c) = @_; 
    67 
    7     print "create permalink pages\n"; 
    8     my $ifile = File::Spec->catfile($self->config->assets_dir, 'tmpl', 'item.tt'); 
    9     for my $entry (@{$self->dat->list}) { 
     8    my $ifile = File::Spec->catfile($c->config->assets_dir, 'tmpl', 'item.tt'); 
     9    for my $entry (@{$c->dat->list}) { 
    1010        my $cnt = 1; 
    1111        for my $item (reverse @{$entry->items->list}) { 
    1212            $item->count($cnt); 
    1313            $item->entry( $entry ); 
    14             my $ofile = File::Spec->catfile($self->config->output_dir, $item->permalink); 
    15             $self->render( 
     14            my $ofile = File::Spec->catfile($c->config->output_dir, $item->permalink); 
     15            $c->render( 
    1616                $ifile => $ofile, 
    1717                { 
  • lang/perl/App-Chariot/trunk/lib/App/Chariot/C/RSS.pm

    r12556 r12557  
    11package App::Chariot::C::RSS; 
    22use Moose; 
     3with 'App::Chariot::Role::C'; 
    34 
    45sub create { 
    5     my $self = shift; 
     6    my ($self, $c) = @_; 
    67 
    7     print "create rss\n"; 
    8  
    9     my $ofname = File::Spec->catfile( $self->config->output_dir, $self->config->rss_filename ); 
     8    my $ofname = File::Spec->catfile( $c->config->output_dir, $c->config->rss_filename ); 
    109 
    1110    my $rss = XML::RSS->new(version => '1.0'); 
    1211    $rss->channel( 
    13         title        => $self->config->title, 
    14         link         => $self->config->clog_url, 
    15         description  => $self->config->changelog_description, 
     12        title        => $c->config->title, 
     13        link         => $c->config->clog_url, 
     14        description  => $c->config->changelog_description, 
    1615    ); 
    1716 
    18     my @list = reverse @{$self->dat->list}; 
    19     for my $entry (@list[0..($self->config->index_stop)]) { 
     17    my @list = reverse @{$c->dat->list}; 
     18    for my $entry (@list[0..($c->config->index_stop)]) { 
    2019        my $cnt = 1; 
    2120        for my $item (reverse @{$entry->items->list}) { 
     
    2524            $rss->add_item( 
    2625                title       => $item->title, 
    27                 link        => $self->config->clog_url . $item->permalink, 
     26                link        => $c->config->clog_url . $item->permalink, 
    2827                description => $item->content, 
    2928                content => { 
    30                     encoded => $self->formatter->( $item->content ), 
     29                    encoded => $c->formatter->( $item->content ), 
    3130                }, 
    3231            );