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