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