« lib/Gitalist/Git/CollectionOfRepositories/FromDirectoryRecursive.pm
↑ Summary
lib/Gitalist/Git/CollectionOfRepositories/Role/Context.pm »
| 1 | package Gitalist; | ||
| 2 | |||
| 3 | 7 | ▶ | BEGIN { require 5.008006; } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 7 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | extends 'Catalyst'; | ||
| 8 | |||
| 9 | 7 | ▶ | use Git::Gitalist::Util; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 7 | ▶ | use Catalyst::Runtime 5.90006; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 7 | ▶ | use Catalyst qw/ |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | ConfigLoader | ||
| 14 | Unicode::Encoding | ||
| 15 | Static::Simple | ||
| 16 | StackTrace | ||
| 17 | SubRequest | ||
| 18 | 7 | /; | |
| 19 | |||
| 20 | 7 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | |||
| 22 | our $VERSION = '0.005001'; | ||
| 23 | $VERSION = eval $VERSION; | ||
| 24 | |||
| 25 | __PACKAGE__->config( | ||
| 26 | name => 'Gitalist', | ||
| 27 | default_view => 'Default', | ||
| 28 | default_model => 'CollectionOfRepos', | ||
| 29 | use_request_uri_for_path => 1, | ||
| 30 | disable_component_resolution_regex_fallback => 1, | ||
| 31 | ); | ||
| 32 | |||
| 33 | __PACKAGE__->setup(); | ||
| 34 | |||
| 35 | after prepare_path => sub { | ||
| 36 | my ($ctx) = @_; | ||
| 37 | my $path = $ctx->req->uri->path; | ||
| 38 | if ($ctx->req->param('a')) { | ||
| 39 | $ctx->req->uri->path("/legacy$path"); | ||
| 40 | } | ||
| 41 | |||
| 42 | if($path =~ s/[.]json$// && $ctx->req->content_type eq 'application/json') { | ||
| 43 | $ctx->req->uri->path($path); | ||
| 44 | } | ||
| 45 | }; | ||
| 46 | |||
| 47 | around uri_for => sub { | ||
| 48 | my ($orig, $c) = (shift, shift); | ||
| 49 | my $uri = $c->$orig(@_); | ||
| 50 | $$uri =~ tr[&][;] if defined $uri; | ||
| 51 | return $uri; | ||
| 52 | }; | ||
| 53 | |||
| 54 | 0 | ▶ | sub uri_with { |
|
Subroutine
uri_with: not called CC=1 SCAR=6.9
| |||
| 55 | 0 | my ($self, @args) = @_; | |
| 56 | 0 | my $uri = $self->request->uri_with(@args); | |
| 57 | # Wow this awful. | ||
| 58 | 0 | $uri =~ s[/fragment\b][]; | |
| 59 | 0 | return $uri; | |
| 60 | } | ||
| 61 | |||
| 62 | after setup_finalize => sub { | ||
| 63 | # At app startup, ensure we can find a git binary, rather than | ||
| 64 | # lazily breaking later at request time. | ||
| 65 | Git::Gitalist::Util::git_executable_path() | ||
| 66 | or die <<ERR; | ||
| 67 | No git executable found in PATH. | ||
| 68 | Please specify which git executable to use in gitalist.conf or ensure that | ||
| 69 | a git executable is reachable in the PATH environment variable. | ||
| 70 | ERR | ||
| 71 | }; | ||
| 72 | |||
| 73 | 1; | ||
| 74 | |||
| 75 | __END__ | ||