Commit | Line | Data |
ecb0ebe7 |
1 | package Gitalist::URIStructure::Repository; |
2 | use MooseX::MethodAttributes::Role; |
3 | use Try::Tiny qw/try catch/; |
4 | use namespace::autoclean; |
5 | |
6 | requires 'base'; |
7 | |
8 | after 'base' => sub { |
9 | my ($self, $c) = @_; |
10 | $c->stash(_do_not_mangle_uri_for => 1); |
11 | }; |
12 | |
13 | sub find : Chained('base') PathPart('') CaptureArgs(1) { |
12a0f9d3 |
14 | my ($self, $c, $repos_name) = @_; |
16dcb884 |
15 | # XXX FIXME - This should be in the repository fragment controller, and the repository |
16 | # controller should just check has_repository |
ecb0ebe7 |
17 | try { |
12a0f9d3 |
18 | my $repos = $c->model()->get_repository($repos_name); |
19 | $c->stash( |
20 | Repository => $repos, |
21 | HEAD => $repos->head_hash, |
22 | ); |
ecb0ebe7 |
23 | } |
24 | catch { |
25 | $c->detach('/error_404'); |
26 | }; |
27 | } |
28 | |
29 | sub summary : Chained('find') PathPart('') Args(0) {} |
30 | |
31 | sub shortlog : Chained('find') Args(0) {} |
32 | |
33 | sub heads : Chained('find') Args(0) {} |
34 | |
35 | sub log : Chained('find') Args(0) {} |
36 | |
5cb2f569 |
37 | sub tags : Chained('find') Args(0) {} |
38 | |
ecb0ebe7 |
39 | 1; |