Merge branch 'master' of git://github.com/broquaint/Gitalist
[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 our $VERSION = '0.01';
15
16 # Bring in the libified gitweb.cgi.
17 use gitweb;
18
19 __PACKAGE__->config(
20     name => 'Gitalist',
21     default_view => 'Default',
22     default_model => 'GitRepos',
23     # Set to 1 to make your fcgi die the request after you push :)
24     exit_at_end_of_request_if_updated => 0,
25 );
26
27 # Start the application
28 __PACKAGE__->setup();
29
30 around uri_for => sub {
31   my ($orig, $c) = (shift, shift);
32   my $project_name = $c->stash->{'Project'} && $c->stash->{'Project'}->name;
33   my $hash = ref($_[-1]) eq 'HASH' ? pop @_ : {};
34   my $params = Catalyst::Utils::merge_hashes(
35     { p => $hash->{p} || $project_name },
36     $hash,
37   );
38   delete $params->{p} unless defined $params->{p} && length $params->{p};
39   (my $uri = $c->$orig(@_, $params))
40     =~ tr[&][;];
41   return $uri;
42 };
43
44 =head1 NAME
45
46 Gitalist - Transitional project to convert gitweb.cgi to a Catalyst app
47
48 =head1 SYNOPSIS
49
50     script/gitalist_server.pl
51
52
53 =head1 INSTALL
54
55 As Gitalist follows the usual Perl module format the usual approach
56 for installation should work e.g
57
58   perl Makefile.PL
59   make
60   make test
61   make install
62
63 If you're running a git checkout of Gitalist then you'll additionally
64 need the author modules. I<NB: As no distribution exists one will
65 presently need the author modules>.
66
67 =head1 DESCRIPTION
68
69 Gitalist is a web frontend for git repositories based on gitweb.cgi
70 and backed by Catalyst. It doesn't yet have the full functionality of
71 gitweb.cgi but it does have a few small additions at this stage.
72
73 =head2 History
74
75 This project started off as an attempt to port gitweb.cgi to a
76 Catalyst app in a piecemeal fashion. As it turns out, thanks largely
77 to Florian Ragwitz's earlier effort, it was easier to use gitweb.cgi
78 as a template for building a new Catalyst application.
79
80 =head1 SEE ALSO
81
82 L<Gitalist::Controller::Root>
83
84 L<Gitalist::Git::Project>
85
86 L<Catalyst>
87
88 =head1 AUTHORS AND COPYRIGHT
89
90   Catalyst application:
91     (C) 2009 Venda Ltd and Dan Brook <broq@cpan.org>
92     (C) 2009, Tom Doran <bobtfish@bobtfish.net>
93     (C) 2009, Zac Stevens <zts@cryptocracy.com>
94
95   Original gitweb.cgi from which this was derived:
96     (C) 2005-2006, Kay Sievers <kay.sievers@vrfy.org>
97     (C) 2005, Christian Gierke
98
99   Model based on http://github.com/rafl/gitweb
100     (C) 2008, Florian Ragwitz
101
102 =head1 LICENSE
103
104 Licensed under GNU GPL v2
105
106 =cut
107
108 1;