Started the switch from hand-written URLs to uri_for.
[catagits/Gitalist.git] / lib / Gitalist.pm
1 package Gitalist;
2 use Moose;
3 use namespace::autoclean;
4
5 use Catalyst::Runtime 5.80;
6
7 extends 'Catalyst';
8
9 use Catalyst qw/
10                 ConfigLoader
11                 Static::Simple
12                 StackTrace/;
13
14 use Class::C3::Adopt::NEXT -no_warn;
15
16 our $VERSION = '0.01';
17
18 # Bring in the libified gitweb.cgi.
19 use gitweb;
20
21 __PACKAGE__->config(
22     name => 'Gitalist',
23     default_view => 'Default',
24 );
25
26 # Start the application
27 __PACKAGE__->setup();
28
29 sub uri_for {
30     my $p = ref $_[-1] eq 'HASH'
31           ? $_[-1]
32           : push(@_, {}) && $_[-1];
33     $p->{p} = $_[0]->model('Git')->project;
34
35     (my $uri = $_[0]->NEXT::uri_for(@_[1 .. $#_]))
36       # Ampersand! What is this, the 90s?
37       =~ s/&/;/g;
38     return $uri;
39 }
40
41 =head1 NAME
42
43 Gitalist - Catalyst based application
44
45 =head1 SYNOPSIS
46
47     script/gitalist_server.pl
48
49 =head1 DESCRIPTION
50
51 [enter your description here]
52
53 =head1 SEE ALSO
54
55 L<Gitalist::Controller::Root>, L<Catalyst>
56
57 =head1 AUTHORS AND COPYRIGHT
58
59   Catalyst application:
60     (C) 2009 Venda Ltd and Dan Brook <dbrook@venda.com>
61
62   Original gitweb.cgi from which this was derived:
63     (C) 2005-2006, Kay Sievers <kay.sievers@vrfy.org>
64     (C) 2005, Christian Gierke
65
66 =head1 LICENSE
67
68 FIXME - Is this going to be GPLv2 as per gitweb? If so this is broken..
69
70 This library is free software. You can redistribute it and/or modify
71 it under the same terms as Perl itself.
72
73 =cut
74
75 1;