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