Fixed test bug and make the plain diffs plainer.
[catagits/Gitalist.git] / lib / Gitalist.pm
CommitLineData
89de6a33 1package Gitalist;
42fe5d11 2use Moose;
775e96e0 3BEGIN { require 5.008006; }
89de6a33 4use Catalyst::Runtime 5.80;
775e96e0 5use namespace::autoclean;
89de6a33 6
42fe5d11 7extends 'Catalyst';
89de6a33 8
43d4a724 9use Catalyst qw/
89de6a33 10 ConfigLoader
fac828e0 11 Unicode::Encoding
d5cc37a4 12 Static::Simple
fac828e0 13 StackTrace
16bdb8df 14 SubRequest
fac828e0 15/;
61b56ed6 16
f692fcb9 17our $VERSION = '0.000005';
775e96e0 18$VERSION = eval $VERSION;
89de6a33 19
d3feefcf 20__PACKAGE__->config(
61b56ed6 21 name => 'Gitalist',
22 default_view => 'Default',
7bf1a6f5 23 default_model => 'CollectionOfRepos',
d3feefcf 24);
89de6a33 25
89de6a33 26__PACKAGE__->setup();
27
319537bf 28after prepare_path => sub {
29 my ($ctx) = @_;
30 if ($ctx->req->param('a')) {
31 $ctx->request->uri->path('/legacy' . $ctx->request->uri->path);
32 }
33};
34
4df2f62f 35around uri_for => sub {
36 my ($orig, $c) = (shift, shift);
df49ca46 37 my $uri = $c->$orig(@_);
74d26472 38 $$uri =~ tr[&][;] if defined $uri;
4df2f62f 39 return $uri;
40};
61b56ed6 41
775e96e0 421;
43
44__END__
45
89de6a33 46=head1 NAME
47
775e96e0 48Gitalist - A modern git web viewer
89de6a33 49
50=head1 SYNOPSIS
51
63f34424 52 script/gitalist_server.pl --repo_dir /home/me/code/git
89de6a33 53
b6d010e1 54=head1 INSTALL
55
56As Gitalist follows the usual Perl module format the usual approach
63f34424 57for installation should work e.g.
b6d010e1 58
59 perl Makefile.PL
60 make
61 make test
62 make install
63
63f34424 64or
65
66 cpan -i Gitalist
67
68You can also check gitalist out from git and run it, in this case you'll additionally
69need the author modules, but no configuration will be needed as it will default to looking
70for repositories the directory above the checkout.
b6d010e1 71
89de6a33 72=head1 DESCRIPTION
73
b6d010e1 74Gitalist is a web frontend for git repositories based on gitweb.cgi
775e96e0 75and backed by Catalyst.
b6d010e1 76
77=head2 History
78
79This project started off as an attempt to port gitweb.cgi to a
80Catalyst app in a piecemeal fashion. As it turns out, thanks largely
81to Florian Ragwitz's earlier effort, it was easier to use gitweb.cgi
82as a template for building a new Catalyst application.
89de6a33 83
69175e49 84=head1 GETTING GITALIST
85
86You can install Gitalist from CPAN in the usual way:
87
88 cpan -i Gitalist
89
90Alternatively, you can get Gitalist using git.
91
92The canonical repository for the master branch is:
93
1d46f550 94 git://git.shadowcat.co.uk/catagits/Gitalist.git
69175e49 95
96Gitalist is also mirrored to github, and a number of people have active forks
97with branches and/or new features in the master branch.
98
99=head1 INITIAL CONFIGURATION
100
101Gitalist is configured using L<Catalyst::Plugin::Configloader>. The supplied sample
102configuration is in L<Config::General> format, however it is possible to configure
103Gitalist using other config file formats (such as YAML) if you prefer.
104
105=head2 WHEN CHECKING GITALIST OUT OF GIT
106
107Gitalist from git includes a minimal C<gitalist_local.conf>, which sets the repository
108directory to one directory higher than the Gitalist repository.
109
110This means that if you check Gitalist out next to your other git checkouts, then starting
111the demo server needs no parameters at all:
112
113 Gitalist [master]$ ./script/gitalist_server.pl
114 You can connect to your server at http://localhost:3000
115
116=head2 FOR CPAN INSTALLS
63f34424 117
118Gitalist can be supplied with a config file by setting the C<< GITALIST_CONFIG >>
119environment variable to point to a configuration file.
120
69175e49 121If you install Gitalist from CPAN, a default configuration is installed along with gitalist,
122which is complete except for a repository directory. You can get a copy of this configuration
123by running:
63f34424 124
125 cp `perl -Ilib -MGitalist -e'print Gitalist->path_to("gitalist.conf")'` gitalist.conf
126
69175e49 127You can then edit this confg, adding a repos_dir path and customising other settings as desired.
128
129You can then start the Gitalist demo server by setting C<< GITALIST_CONFIG >>. For example:
130
131 GITALIST_CONFIG=/usr/local/etc/gitalist.conf gitalist_server.pl
63f34424 132
133Alternatively, if you only want to set a repository directory and are otherwise happy with
1d46f550 134the default configuration, then you can set the C<< GITALIST_REPO_DIR >> environment
63f34424 135variable, or pass the C<< --repos_dir >> flag to any of the scripts.
136
1d46f550 137 GITALIST_REPO_DIR=/home/myuser/code/git gitalist_server.pl
69175e49 138 gitalist_server.pl --repos_dir home/myuser/code/git
139
1d46f550 140The C<< GITALIST_REPO_DIR >> environment variable will override the repository directory set
63f34424 141in configuration, and will itself be overridden by he C<< --repos_dir >> flag.
142
69175e49 143=head1 RUNNING
144
145Once you have followed the instructions above to install and configure Gitalist, you may want
146to run it in a more production facing environment than using the single threaded developement
147server.
148
149The recommended deployment method for Gitalist is FastCGI, although Gitalist can also be run
150under mod_perl or as pure perl with L<Catalyst::Engine::PreFork>.
151
152Assuming that you have installed Gitalist's dependencies into a L<local::lib>, and you
153are running from a git checkout, adding a trivial FCGI script as C<script/gitalist.fcgi>
154(this file is specifically in C<.gitignore> so you can have your own copy):
155
156 #!/bin/sh
157 export PERL5LIB=/home/t0m/public_html/Gitalist/lib:/home/t0m/perl5/lib/perl5:$PERL5LIB
158 exec /home/t0m/public_html/Gitalist/script/gitalist_fastcgi.pl
159
160This example can be seen live here:
161
162 http://goatse.co.uk/~bobtfish/Gitalist/script/gitalist.fcgi/
163
164=head1 CONTRIBUTING
165
166Patches are welcome, please feel free to fork on github and send pull requests, send patches
167from git format-patch to the bug tracker, or host your own copy of gitalist somewhere and
168ask us to pull from it.
169
170=head1 SUPPORT
171
172Gitalist has an active irc community in C<#gitalist> on irc.perl.org, please feel free to stop
173by and ask questions, report bugs or installation issues or generally for a chat about where
174we plan to go with the project.
175
89de6a33 176=head1 SEE ALSO
177
b6d010e1 178L<Gitalist::Controller::Root>
179
44a9ed75 180L<Gitalist::Git::Repository>
b6d010e1 181
182L<Catalyst>
89de6a33 183
42fe5d11 184=head1 AUTHORS AND COPYRIGHT
89de6a33 185
42fe5d11 186 Catalyst application:
b6d010e1 187 (C) 2009 Venda Ltd and Dan Brook <broq@cpan.org>
188 (C) 2009, Tom Doran <bobtfish@bobtfish.net>
189 (C) 2009, Zac Stevens <zts@cryptocracy.com>
42fe5d11 190
191 Original gitweb.cgi from which this was derived:
192 (C) 2005-2006, Kay Sievers <kay.sievers@vrfy.org>
193 (C) 2005, Christian Gierke
89de6a33 194
b6d010e1 195 Model based on http://github.com/rafl/gitweb
196 (C) 2008, Florian Ragwitz
89de6a33 197
b6d010e1 198=head1 LICENSE
42fe5d11 199
b6d010e1 200Licensed under GNU GPL v2
89de6a33 201
202=cut