... | ... |
@@ -1,157 +1,22 @@ |
1 |
-Gitweb Lite |
|
1 |
+Gitpub |
|
2 | 2 |
|
3 |
- gitweb.cgi clone. Serve git repository. |
|
4 |
- Example: http://perlcodesample.com/gitweblite |
|
5 |
- |
|
6 |
-Features |
|
7 |
- |
|
8 |
- This is gitweb.cgi clone, and has the following features. |
|
9 |
- |
|
10 |
- - gitweb.cgi default features. |
|
11 |
- - Written by Perl and Mojolicious web framework. |
|
12 |
- - Prerequisite is Perl 5.8.7+. |
|
13 |
- - Having HTTP server. You can run gitweblite, |
|
14 |
- even if "apache" is not installed. |
|
15 |
- - Multiple project homes. |
|
16 |
- - Zero configuration. |
|
17 |
- - Default encoding is UTF-8, you can change this. |
|
18 |
- - don't work on Windows. |
|
3 |
+ Github clone. Serve git repository. |
|
19 | 4 |
|
20 | 5 |
Operation |
21 | 6 |
|
22 | 7 |
Start |
23 | 8 |
|
24 |
- ./gitweblite |
|
9 |
+ ./githublite |
|
25 | 10 |
|
26 |
- Application start in back ground. Port is 10010. |
|
11 |
+ Application start in back ground. Port is 10020. |
|
27 | 12 |
You can access the following URL. |
28 | 13 |
|
29 | 14 |
http://localhost:10010 |
30 | 15 |
|
31 |
- If you change port, edit gitweblite.conf. |
|
16 |
+ If you change port, edit githublite.conf. |
|
32 | 17 |
|
33 | 18 |
Stop |
34 | 19 |
|
35 |
- ./gitweblite --stop |
|
20 |
+ ./githublite --stop |
|
36 | 21 |
|
37 | 22 |
You can stop application by --stop option. |
38 |
- |
|
39 |
-Description |
|
40 |
- |
|
41 |
- by default, /home and /git/pub directory is searched recursively. |
|
42 |
- if xxx.git directory is found and it is git repository, |
|
43 |
- the repository display on top page. |
|
44 |
- |
|
45 |
-Config |
|
46 |
- |
|
47 |
- You can set config in gitweblite.conf. |
|
48 |
- Config is written by JSON (// is comment line). |
|
49 |
- Create your config file copied from gitweblite.conf.example |
|
50 |
- |
|
51 |
- cp gitweblite.conf.example gitweblite.conf |
|
52 |
- |
|
53 |
- These is available options. |
|
54 |
- |
|
55 |
- encoding |
|
56 |
- |
|
57 |
- Text encoding. |
|
58 |
- |
|
59 |
- Default: |
|
60 |
- |
|
61 |
- "encoding" : "UTF-8" |
|
62 |
- |
|
63 |
- git_bin |
|
64 |
- |
|
65 |
- git command (/usr/local/bin/git etc) |
|
66 |
- |
|
67 |
- Default: |
|
68 |
- |
|
69 |
- git command is automatically detected by PATH environment variable |
|
70 |
- |
|
71 |
- hypnotoad |
|
72 |
- |
|
73 |
- Server configuration. |
|
74 |
- |
|
75 |
- Default: |
|
76 |
- |
|
77 |
- "hypnotoad" : { |
|
78 |
- "listen" : ["http://*:10010"] |
|
79 |
- } |
|
80 |
- |
|
81 |
- logo_link |
|
82 |
- |
|
83 |
- Logo link URL |
|
84 |
- |
|
85 |
- Default: |
|
86 |
- |
|
87 |
- "logo_link" : "https://github.com/yuki-kimoto/gitweblite" |
|
88 |
- |
|
89 |
- prevent_xss |
|
90 |
- |
|
91 |
- Prevent XSS atack. |
|
92 |
- |
|
93 |
- Default: |
|
94 |
- |
|
95 |
- "prevent_xss" : 0 |
|
96 |
- |
|
97 |
- search_dirs |
|
98 |
- |
|
99 |
- Git repository searching directories. |
|
100 |
- |
|
101 |
- Default: |
|
102 |
- |
|
103 |
- "search_dirs" : ["/git/pub", "/home"] |
|
104 |
- |
|
105 |
- search_max_depth |
|
106 |
- |
|
107 |
- Searching directory max depth. |
|
108 |
- |
|
109 |
- Default: |
|
110 |
- |
|
111 |
- "search_max_depth" : 10 |
|
112 |
- |
|
113 |
- text_ext |
|
114 |
- |
|
115 |
- Text file extention. If "encoding" is not "UTF-8", generally text file |
|
116 |
- is assumed as binary file. If "text_ext" is set, the file having the extention |
|
117 |
- assumed as text file. |
|
118 |
- |
|
119 |
- Default: |
|
120 |
- |
|
121 |
- "text_exts" : ["txt"] |
|
122 |
- |
|
123 |
-Logo and favicon |
|
124 |
- |
|
125 |
- You can use your logo and favicon. |
|
126 |
- Set logo or favicon image file into the following name. |
|
127 |
- |
|
128 |
- user/public/git-logo.png |
|
129 |
- user/public/git-favicon.png |
|
130 |
- |
|
131 |
-Reverse proxy |
|
132 |
- |
|
133 |
- You can use gitweblite with reverse proxy such as apache/mod_proxy. |
|
134 |
- |
|
135 |
- Apache/mod_proxy |
|
136 |
- |
|
137 |
- <VirtualHost *:80> |
|
138 |
- ServerName perlcodesample.com |
|
139 |
- <Proxy *> |
|
140 |
- Order deny,allow |
|
141 |
- Allow from all |
|
142 |
- </Proxy> |
|
143 |
- ProxyRequests Off |
|
144 |
- ProxyPreserveHost On |
|
145 |
- |
|
146 |
- ProxyPass /gitweblite http://localhost:10010/gitweblite keepalive=On |
|
147 |
- ProxyPassReverse /gitweblite http://localhost:10010/gitweblite |
|
148 |
- |
|
149 |
- RequestHeader set X-Forwarded-HTTPS "0" |
|
150 |
- </VirtualHost> |
|
151 |
- |
|
152 |
-COPYRIGHT & LICENSE |
|
153 |
- |
|
154 |
- Copyright 2009-2012 Yuki Kimoto, all rights reserved. |
|
155 |
- |
|
156 |
- This program is free software; you can redistribute it and/or modify it |
|
157 |
- under the same terms as Perl itself. |
... | ... |
@@ -3,4 +3,4 @@ |
3 | 3 |
DIR=$(dirname $0) |
4 | 4 |
PERL5LIB="$DIR/mojolegacy/lib:$DIR/extlib/lib/perl5" |
5 | 5 |
export PERL5LIB |
6 |
-$DIR/mojolegacy/script/hypnotoad $DIR/script/gitweblite "$*" |
|
6 |
+$DIR/mojolegacy/script/hypnotoad $DIR/script/gitpub "$*" |
... | ... |
@@ -0,0 +1,30 @@ |
1 |
+{ |
|
2 |
+ // Encoding |
|
3 |
+ "encoding" : "UTF-8", |
|
4 |
+ |
|
5 |
+ // Git command |
|
6 |
+ // "git_bin" : "/usr/local/bin/git", |
|
7 |
+ |
|
8 |
+ // Server config |
|
9 |
+ // "hypnotoad" : { |
|
10 |
+ // "listen" : ["http://*:10010"] |
|
11 |
+ // }, |
|
12 |
+ |
|
13 |
+ // Logo link |
|
14 |
+ // "logo_link" : "https://github.com/yuki-kimoto/gitweblite", |
|
15 |
+ |
|
16 |
+ // Prevent XSS atack |
|
17 |
+ // "prevent_xss" : 0, |
|
18 |
+ |
|
19 |
+ // Search directory |
|
20 |
+ // "search_dirs" : ["/git/pub", "/home"], |
|
21 |
+ |
|
22 |
+ // Serach max depth |
|
23 |
+ // "search_max_depth" : 10, |
|
24 |
+ |
|
25 |
+ // Text extention |
|
26 |
+ // "text_exts" : ["txt"], |
|
27 |
+ |
|
28 |
+ // No mean key-value for allow last conmma |
|
29 |
+ "no_mean" : "no_mean" |
|
30 |
+} |
... | ... |
@@ -1,10 +1,10 @@ |
1 | 1 |
use 5.008007; |
2 |
-package Gitweblite; |
|
2 |
+package Gitpub; |
|
3 | 3 |
|
4 | 4 |
our $VERSION = '1.00'; |
5 | 5 |
|
6 | 6 |
use Mojo::Base 'Mojolicious'; |
7 |
-use Gitweblite::Git; |
|
7 |
+use Gitpub::Git; |
|
8 | 8 |
|
9 | 9 |
has 'git'; |
10 | 10 |
|
... | ... |
@@ -12,22 +12,22 @@ sub startup { |
12 | 12 |
my $self = shift; |
13 | 13 |
|
14 | 14 |
# Config |
15 |
- my $conf_file = $ENV{GITWEBLITE_CONFIG_FILE} |
|
16 |
- || $self->home->rel_file('gitweblite.conf'); |
|
15 |
+ my $conf_file = $ENV{GITPUB_CONFIG_FILE} |
|
16 |
+ || $self->home->rel_file('gitpub.conf'); |
|
17 | 17 |
$self->plugin('JSONConfigLoose', {file => $conf_file}) if -f $conf_file; |
18 | 18 |
my $conf = $self->config; |
19 | 19 |
$conf->{search_dirs} ||= ['/git/pub', '/home']; |
20 | 20 |
$conf->{search_max_depth} ||= 10; |
21 |
- $conf->{logo_link} ||= "https://github.com/yuki-kimoto/gitweblite"; |
|
21 |
+ $conf->{logo_link} ||= "https://github.com/yuki-kimoto/gitpub"; |
|
22 | 22 |
$conf->{hypnotoad} ||= {listen => ["http://*:10010"]}; |
23 | 23 |
$conf->{prevent_xss} ||= 0; |
24 | 24 |
$conf->{encoding} ||= 'UTF-8'; |
25 | 25 |
$conf->{text_exts} ||= ['txt']; |
26 | 26 |
|
27 | 27 |
# Git |
28 |
- my $git = Gitweblite::Git->new; |
|
28 |
+ my $git = Gitpub::Git->new; |
|
29 | 29 |
my $git_bin = $conf->{git_bin} ? $conf->{git_bin} : $git->search_bin; |
30 |
- die qq/Can't detect git command. set "git_bin" in gitweblite.conf/ |
|
30 |
+ die qq/Can't detect git command. set "git_bin" in gitpub.conf/ |
|
31 | 31 |
unless $git_bin; |
32 | 32 |
$git->bin($git_bin); |
33 | 33 |
$git->search_dirs($conf->{search_dirs}); |
... | ... |
@@ -39,7 +39,7 @@ sub startup { |
39 | 39 |
# Helper |
40 | 40 |
{ |
41 | 41 |
# Remove top slash |
42 |
- $self->helper('gitweblite_rel' => sub { |
|
42 |
+ $self->helper('gitpub_rel' => sub { |
|
43 | 43 |
my ($self, $path) = @_; |
44 | 44 |
|
45 | 45 |
$path =~ s/^\///; |
... | ... |
@@ -48,7 +48,7 @@ sub startup { |
48 | 48 |
}); |
49 | 49 |
|
50 | 50 |
# Get head commit id |
51 |
- $self->helper('gitweblite_get_head_id' => sub { |
|
51 |
+ $self->helper('gitpub_get_head_id' => sub { |
|
52 | 52 |
my ($self, $project) = @_; |
53 | 53 |
|
54 | 54 |
my $head_commit = $self->app->git->parse_commit($project, "HEAD"); |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-package Gitweblite::Git; |
|
1 |
+package Gitpub::Git; |
|
2 | 2 |
use Mojo::Base -base; |
3 | 3 |
|
4 | 4 |
use Carp 'croak'; |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-package Gitweblite::Main; |
|
1 |
+package Gitpub::Main; |
|
2 | 2 |
use Mojo::Base 'Mojolicious::Controller'; |
3 | 3 |
use File::Basename 'dirname'; |
4 | 4 |
use Carp 'croak'; |
... | ... |
@@ -3,4 +3,4 @@ |
3 | 3 |
DIR=$(dirname $0) |
4 | 4 |
PERL5LIB="$DIR/mojolegacy/lib:$DIR/extlib/lib/perl5" |
5 | 5 |
export PERL5LIB |
6 |
-$DIR/mojolegacy/script/morbo $DIR/script/gitweblite "$*" |
|
6 |
+$DIR/mojolegacy/script/morbo $DIR/script/gitpub "$*" |
... | ... |
@@ -17,7 +17,7 @@ Please visit http://mojolicio.us for detailed installation instructions. |
17 | 17 |
EOF |
18 | 18 |
|
19 | 19 |
# Application |
20 |
-$ENV{MOJO_APP} ||= 'Gitweblite'; |
|
20 |
+$ENV{MOJO_APP} ||= 'Gitpub'; |
|
21 | 21 |
|
22 | 22 |
# Start commands |
23 | 23 |
Mojolicious::Commands->start; |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
<div class="page_nav"> |
2 |
- % my $id = stash('id') || gitweblite_get_head_id($project); |
|
2 |
+ % my $id = stash('id') || gitpub_get_head_id($project); |
|
3 | 3 |
% if ($current eq 'summary') { |
4 | 4 |
Summary |
5 | 5 |
% } else { |
... | ... |
@@ -7,7 +7,7 @@ |
7 | 7 |
Raw |
8 | 8 |
</a> |
9 | 9 |
| |
10 |
- % my $head_id = gitweblite_get_head_id($project); |
|
10 |
+ % my $head_id = gitpub_get_head_id($project); |
|
11 | 11 |
<a href="<%= url_for('blob', project => $project_ns, id_file => "HEAD/$file") %>"> |
12 | 12 |
HEAD |
13 | 13 |
</a> |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
% layout 'common'; |
2 |
- % my $head_id = gitweblite_get_head_id($project); |
|
2 |
+ % my $head_id = gitpub_get_head_id($project); |
|
3 | 3 |
%= include '/include/header', title => 'Blob Diff', project => $project; |
4 | 4 |
%= include '/include/current_directory', home_ns => $home_ns, home => $home; |
5 | 5 |
%= include '/include/page_navi', current => 'blobdiff', head_id => $id, project_ns => $project_ns; |
... | ... |
@@ -1,12 +1,12 @@ |
1 | 1 |
% layout 'common'; |
2 |
- %= include '/include/header', title => 'Gitweb Lite'; |
|
2 |
+ %= include '/include/header', title => 'Gitpub'; |
|
3 | 3 |
<table class="project_list"> |
4 | 4 |
<th>Home Directory</th> |
5 | 5 |
% my $toggle = 0; |
6 | 6 |
% for my $home (@$homes) { |
7 | 7 |
<tr class="<%= $toggle++ ? 'light' : 'dark' %>"> |
8 | 8 |
<td> |
9 |
- <a class="list" href="<%= url_for('projects', home => gitweblite_rel($home)); %>"> |
|
9 |
+ <a class="list" href="<%= url_for('projects', home => gitpub_rel($home)); %>"> |
|
10 | 10 |
<%= $home %> |
11 | 11 |
</a> |
12 | 12 |
</td> |