[224] | 1 | package Sophie::Controller::Compat; |
---|
| 2 | use Moose; |
---|
| 3 | use namespace::autoclean; |
---|
| 4 | |
---|
| 5 | BEGIN {extends 'Catalyst::Controller'; } |
---|
| 6 | |
---|
| 7 | =head1 NAME |
---|
| 8 | |
---|
| 9 | Sophie::Controller::Compat - Catalyst Controller |
---|
| 10 | |
---|
| 11 | =head1 DESCRIPTION |
---|
| 12 | |
---|
| 13 | Catalyst Controller. |
---|
| 14 | |
---|
| 15 | =head1 METHODS |
---|
| 16 | |
---|
| 17 | =cut |
---|
| 18 | |
---|
| 19 | sub viewrpm :Path('/viewrpm') :Args(0) { |
---|
| 20 | my ($self, $c) = @_; |
---|
| 21 | $c->res->redirect($c->uri_for('/rpms')); |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | sub viewrpms :Path('/viewrpm') :Args { |
---|
| 25 | my ($self, $c, $pkgid, @args) = @_; |
---|
| 26 | |
---|
| 27 | $c->res->redirect($c->uri_for('/rpms', $pkgid, @args)); |
---|
| 28 | } |
---|
| 29 | |
---|
[246] | 30 | sub rpm :Path('/rpm') :Args { |
---|
| 31 | my ($self, $c, $dist, $rpm, @uargs) = @_; |
---|
[224] | 32 | |
---|
[252] | 33 | my @args = split(',', $dist, 3); |
---|
[224] | 34 | if (@args == 2) { |
---|
| 35 | unshift(@args, ''); |
---|
| 36 | } |
---|
[251] | 37 | $c->forward('/distrib/exists', [ { distribution => $args[0], release => |
---|
| 38 | $args[1], arch => $args[2] } ]) or $c->go('/404/index'); |
---|
[246] | 39 | $c->res->redirect($c->uri_for('/distrib', @args, 'rpms', $rpm, @uargs)); |
---|
[224] | 40 | } |
---|
| 41 | |
---|
[246] | 42 | sub srpm :Path('/srpm') :Args { |
---|
| 43 | my ($self, $c, $dist, $rpm, @uargs) = @_; |
---|
[224] | 44 | |
---|
[252] | 45 | my @args = split(',', $dist, 3); |
---|
[224] | 46 | if (@args == 2) { |
---|
| 47 | unshift(@args, ''); |
---|
| 48 | } |
---|
[251] | 49 | $c->forward('/distrib/exists', [ { distribution => $args[0], release => |
---|
| 50 | $args[1], arch => $args[2] } ]) or $c->go('/404/index'); |
---|
[246] | 51 | $c->res->redirect($c->uri_for('/distrib', @args, 'srpms', $rpm, @uargs)); |
---|
[224] | 52 | } |
---|
| 53 | |
---|
[226] | 54 | # /distrib/foo,bar,baz/RPM |
---|
| 55 | sub distrib :Private { |
---|
| 56 | my ($self, $c, $distrib, $rpm) = @_; |
---|
| 57 | |
---|
| 58 | my @args = split(',', $distrib); |
---|
| 59 | if (@args == 2) { |
---|
| 60 | unshift(@args, ''); |
---|
| 61 | } |
---|
[251] | 62 | $c->forward('/distrib/exists', [ { distribution => $args[0], release => |
---|
| 63 | $args[1], arch => $args[2] } ]) or $c->go('/404/index'); |
---|
[226] | 64 | $c->res->redirect($c->uri_for('/distrib', @args, 'rpms', $rpm)); |
---|
| 65 | } |
---|
| 66 | |
---|
[224] | 67 | =head1 AUTHOR |
---|
| 68 | |
---|
| 69 | Olivier Thauvin |
---|
| 70 | |
---|
| 71 | =head1 LICENSE |
---|
| 72 | |
---|
| 73 | This library is free software. You can redistribute it and/or modify |
---|
| 74 | it under the same terms as Perl itself. |
---|
| 75 | |
---|
| 76 | =cut |
---|
| 77 | |
---|
| 78 | __PACKAGE__->meta->make_immutable; |
---|
| 79 | |
---|
| 80 | 1; |
---|