1 package Gitalist::Controller::LegacyURI;
4 use namespace::autoclean;
6 BEGIN { extends 'Gitalist::Controller' }
8 sub handler : Chained('/base') PathPart('legacy') Args() {
9 my ( $self, $c, $repos ) = @_;
10 my ($action, @captures);
11 if (my $a = $c->req->param('a')) {
12 $a eq 'opml' && do { $action = '/opml/opml'; };
13 $a eq 'project_index' && do { $action = '/legacyuri/project_index'; };
14 $a =~ /^(summary|heads|tags)$/ && do { $action = "/repository/$1"; push(@captures, $repos); };
16 die("Not supported") unless $action;
17 $c->res->redirect($c->uri_for_action($action, \@captures));
21 sub project_index : Chained('/base') Args(0) {
22 my ( $self, $c ) = @_;
24 $c->response->content_type('text/plain');
26 join "\n", map $_->name, $c->model()->repositories->flatten
27 ) or die 'No repositories found in '. $c->model->repo_dir;
30 __PACKAGE__->meta->make_immutable;