Bump version
[catagits/Gitalist.git] / lib / Gitalist.pm
1 package Gitalist;
2 use Moose;
3 BEGIN { require 5.008006; }
4 use Catalyst::Runtime 5.80;
5 use namespace::autoclean;
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.000002';
17 $VERSION = eval $VERSION;
18
19 __PACKAGE__->config(
20     name => 'Gitalist',
21     default_view => 'Default',
22     default_model => 'GitRepos',
23 );
24
25 __PACKAGE__->setup();
26
27 around uri_for => sub {
28   my ($orig, $c) = (shift, shift);
29   my $project_name = $c->stash->{'Project'} && $c->stash->{'Project'}->name;
30   my $hash = ref($_[-1]) eq 'HASH' ? pop @_ : {};
31   my $params = Catalyst::Utils::merge_hashes(
32     { p => $hash->{p} || $project_name },
33     $hash,
34   );
35   delete $params->{p} unless defined $params->{p} && length $params->{p};
36   (my $uri = $c->$orig(@_, $params))
37     =~ tr[&][;];
38   return $uri;
39 };
40
41 1;
42
43 __END__
44
45 =head1 NAME
46
47 Gitalist - A modern git web viewer
48
49 =head1 SYNOPSIS
50
51     script/gitalist_server.pl --repo_dir /home/me/code/git
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 or
64
65   cpan -i Gitalist
66
67 You can also check gitalist out from git and run it, in this case you'll additionally
68 need the author modules, but no configuration will be needed as it will default to looking
69 for repositories the directory above the checkout.
70
71 =head1 DESCRIPTION
72
73 Gitalist is a web frontend for git repositories based on gitweb.cgi
74 and backed by Catalyst.
75
76 =head2 History
77
78 This project started off as an attempt to port gitweb.cgi to a
79 Catalyst app in a piecemeal fashion. As it turns out, thanks largely
80 to Florian Ragwitz's earlier effort, it was easier to use gitweb.cgi
81 as a template for building a new Catalyst application.
82
83 =head1 CONFIGURATION
84
85 Gitalist can be supplied with a config file by setting the C<< GITALIST_CONFIG >>
86 environment variable to point to a configuration file.
87
88 A default configuration is installed along with gitalist, which is complete except
89 for a repository directory. You can get a copy of this configuration by running:
90
91   cp `perl -Ilib -MGitalist -e'print Gitalist->path_to("gitalist.conf")'` gitalist.conf
92
93 adding a repos_dir path and then setting C<< GITALIST_CONFIG >>.
94
95 Alternatively, if you only want to set a repository directory and are otherwise happy with
96 the default configuration, then you can set the C<< GITALIST_REPOS_DIR >> environment
97 variable, or pass the C<< --repos_dir >> flag to any of the scripts.
98
99 The C<< GITALIST_REPOS_DIR >> environment variable will override the repository directory set
100 in configuration, and will itself be overridden by he C<< --repos_dir >> flag.
101
102 =head1 SEE ALSO
103
104 L<Gitalist::Controller::Root>
105
106 L<Gitalist::Git::Project>
107
108 L<Catalyst>
109
110 =head1 AUTHORS AND COPYRIGHT
111
112   Catalyst application:
113     (C) 2009 Venda Ltd and Dan Brook <broq@cpan.org>
114     (C) 2009, Tom Doran <bobtfish@bobtfish.net>
115     (C) 2009, Zac Stevens <zts@cryptocracy.com>
116
117   Original gitweb.cgi from which this was derived:
118     (C) 2005-2006, Kay Sievers <kay.sievers@vrfy.org>
119     (C) 2005, Christian Gierke
120
121   Model based on http://github.com/rafl/gitweb
122     (C) 2008, Florian Ragwitz
123
124 =head1 LICENSE
125
126 Licensed under GNU GPL v2
127
128 =cut