Almost forgot to add some troublshooting steps...
[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
4e3ae730 17our $VERSION = '0.002005';
775e96e0 18$VERSION = eval $VERSION;
89de6a33 19
d3feefcf 20__PACKAGE__->config(
61b56ed6 21 name => 'Gitalist',
22 default_view => 'Default',
7bf1a6f5 23 default_model => 'CollectionOfRepos',
e77519b1 24 use_request_uri_for_path => 1,
25 disable_component_resolution_regex_fallback => 1,
d3feefcf 26);
89de6a33 27
89de6a33 28__PACKAGE__->setup();
29
319537bf 30after prepare_path => sub {
31 my ($ctx) = @_;
32 if ($ctx->req->param('a')) {
33 $ctx->request->uri->path('/legacy' . $ctx->request->uri->path);
34 }
35};
36
4df2f62f 37around uri_for => sub {
38 my ($orig, $c) = (shift, shift);
df49ca46 39 my $uri = $c->$orig(@_);
74d26472 40 $$uri =~ tr[&][;] if defined $uri;
4df2f62f 41 return $uri;
42};
61b56ed6 43
906a2dd2 44around uri_for_action => sub {
45 my ($orig, $c) = (shift, shift);
46 my $uri = $c->$orig(@_);
47 $$uri =~ s[/fragment\b][] if defined $uri;
48 return $uri;
49};
50
51sub uri_with {
52 my ($self, @args) = @_;
53 my $uri = $self->request->uri_with(@args);
54 # Wow this awful.
55 $uri =~ s[/fragment\b][];
56 return $uri;
57}
58
775e96e0 591;
60
61__END__
62
89de6a33 63=head1 NAME
64
775e96e0 65Gitalist - A modern git web viewer
89de6a33 66
67=head1 SYNOPSIS
68
63f34424 69 script/gitalist_server.pl --repo_dir /home/me/code/git
89de6a33 70
b6d010e1 71=head1 INSTALL
72
73As Gitalist follows the usual Perl module format the usual approach
63f34424 74for installation should work e.g.
b6d010e1 75
76 perl Makefile.PL
77 make
78 make test
79 make install
80
63f34424 81or
82
83 cpan -i Gitalist
84
85You can also check gitalist out from git and run it, in this case you'll additionally
86need the author modules, but no configuration will be needed as it will default to looking
87for repositories the directory above the checkout.
b6d010e1 88
89de6a33 89=head1 DESCRIPTION
90
b6d010e1 91Gitalist is a web frontend for git repositories based on gitweb.cgi
775e96e0 92and backed by Catalyst.
b6d010e1 93
94=head2 History
95
96This project started off as an attempt to port gitweb.cgi to a
97Catalyst app in a piecemeal fashion. As it turns out, thanks largely
98to Florian Ragwitz's earlier effort, it was easier to use gitweb.cgi
99as a template for building a new Catalyst application.
89de6a33 100
69175e49 101=head1 GETTING GITALIST
102
103You can install Gitalist from CPAN in the usual way:
104
105 cpan -i Gitalist
106
107Alternatively, you can get Gitalist using git.
108
109The canonical repository for the master branch is:
110
1d46f550 111 git://git.shadowcat.co.uk/catagits/Gitalist.git
69175e49 112
113Gitalist is also mirrored to github, and a number of people have active forks
114with branches and/or new features in the master branch.
115
ccb79ac8 116=head1 BOOTSTRAPPING
117
118As of C<0.002001> Gitalist can now be bootstrapped to run out of its
119own directory by installing its prerequisites locally with the help of
120L<local::lib>. So instead of installing the prerequisites to the
121system path with CPAN they are installed under the Gitalist directory.
122
123To do this clone Gitalist from the Shadowcat repository mentioned
e2c6e7c1 124above or grab a snapshot from broquaint's github repository:
ccb79ac8 125
126 http://github.com/broquaint/Gitalist/downloads
127
128With the source acquired and unpacked run the following from within the
129Gitalist directory:
130
e2c6e7c1 131 perl script/bootstrap.pl
ccb79ac8 132
133This will install the necessary modules for the build process which in
134turn installs the prerequisites locally.
135
e2c6e7c1 136I<NB> The relevant bootstrap scripts aren't available in the CPAN dist
137as the bootstrap scripts should not be installed.
138
69175e49 139=head1 INITIAL CONFIGURATION
140
141Gitalist is configured using L<Catalyst::Plugin::Configloader>. The supplied sample
142configuration is in L<Config::General> format, however it is possible to configure
143Gitalist using other config file formats (such as YAML) if you prefer.
144
145=head2 WHEN CHECKING GITALIST OUT OF GIT
146
147Gitalist from git includes a minimal C<gitalist_local.conf>, which sets the repository
148directory to one directory higher than the Gitalist repository.
149
150This means that if you check Gitalist out next to your other git checkouts, then starting
151the demo server needs no parameters at all:
152
153 Gitalist [master]$ ./script/gitalist_server.pl
154 You can connect to your server at http://localhost:3000
155
156=head2 FOR CPAN INSTALLS
63f34424 157
158Gitalist can be supplied with a config file by setting the C<< GITALIST_CONFIG >>
159environment variable to point to a configuration file.
160
69175e49 161If you install Gitalist from CPAN, a default configuration is installed along with gitalist,
162which is complete except for a repository directory. You can get a copy of this configuration
163by running:
63f34424 164
165 cp `perl -Ilib -MGitalist -e'print Gitalist->path_to("gitalist.conf")'` gitalist.conf
166
3d0e045e 167You can then edit this confg, adding a repo_dir path and customising other settings as desired.
69175e49 168
169You can then start the Gitalist demo server by setting C<< GITALIST_CONFIG >>. For example:
170
171 GITALIST_CONFIG=/usr/local/etc/gitalist.conf gitalist_server.pl
63f34424 172
173Alternatively, if you only want to set a repository directory and are otherwise happy with
1d46f550 174the default configuration, then you can set the C<< GITALIST_REPO_DIR >> environment
3d0e045e 175variable, or pass the C<< --repo_dir >> flag to any of the scripts.
63f34424 176
1d46f550 177 GITALIST_REPO_DIR=/home/myuser/code/git gitalist_server.pl
3d0e045e 178 gitalist_server.pl --repo_dir home/myuser/code/git
69175e49 179
1d46f550 180The C<< GITALIST_REPO_DIR >> environment variable will override the repository directory set
3d0e045e 181in configuration, and will itself be overridden by he C<< --repo_dir >> flag.
63f34424 182
69175e49 183=head1 RUNNING
184
185Once you have followed the instructions above to install and configure Gitalist, you may want
186to run it in a more production facing environment than using the single threaded developement
187server.
188
189The recommended deployment method for Gitalist is FastCGI, although Gitalist can also be run
190under mod_perl or as pure perl with L<Catalyst::Engine::PreFork>.
191
192Assuming that you have installed Gitalist's dependencies into a L<local::lib>, and you
193are running from a git checkout, adding a trivial FCGI script as C<script/gitalist.fcgi>
194(this file is specifically in C<.gitignore> so you can have your own copy):
195
196 #!/bin/sh
69175e49 197 exec /home/t0m/public_html/Gitalist/script/gitalist_fastcgi.pl
198
199This example can be seen live here:
200
f9d6e4f1 201 http://example.gitalist.com
69175e49 202
203=head1 CONTRIBUTING
204
205Patches are welcome, please feel free to fork on github and send pull requests, send patches
206from git format-patch to the bug tracker, or host your own copy of gitalist somewhere and
207ask us to pull from it.
208
209=head1 SUPPORT
210
211Gitalist has an active irc community in C<#gitalist> on irc.perl.org, please feel free to stop
212by and ask questions, report bugs or installation issues or generally for a chat about where
213we plan to go with the project.
214
89de6a33 215=head1 SEE ALSO
216
b6d010e1 217L<Gitalist::Controller::Root>
218
44a9ed75 219L<Gitalist::Git::Repository>
b6d010e1 220
221L<Catalyst>
89de6a33 222
42fe5d11 223=head1 AUTHORS AND COPYRIGHT
89de6a33 224
42fe5d11 225 Catalyst application:
b6d010e1 226 (C) 2009 Venda Ltd and Dan Brook <broq@cpan.org>
227 (C) 2009, Tom Doran <bobtfish@bobtfish.net>
228 (C) 2009, Zac Stevens <zts@cryptocracy.com>
42fe5d11 229
230 Original gitweb.cgi from which this was derived:
231 (C) 2005-2006, Kay Sievers <kay.sievers@vrfy.org>
232 (C) 2005, Christian Gierke
89de6a33 233
b6d010e1 234 Model based on http://github.com/rafl/gitweb
235 (C) 2008, Florian Ragwitz
89de6a33 236
b6d010e1 237=head1 LICENSE
42fe5d11 238
b6d010e1 239Licensed under GNU GPL v2
89de6a33 240
241=cut