... | ... |
@@ -1,30 +0,0 @@ |
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,30 +0,0 @@ |
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 extensions |
|
26 |
- // "text_exts" : ["txt"], |
|
27 |
- |
|
28 |
- // No mean key-value for allow last conmma |
|
29 |
- "no_mean" : "no_mean" |
|
30 |
-} |
... | ... |
@@ -1,24 +0,0 @@ |
1 |
-package Mojolicious::Plugin::JSONConfigLoose; |
|
2 |
-use Mojo::Base 'Mojolicious::Plugin::JSONConfig'; |
|
3 |
- |
|
4 |
-sub load { |
|
5 |
- my ($self, $file, $conf, $app) = @_; |
|
6 |
- $app->log->debug(qq/Reading config file "$file"./); |
|
7 |
- |
|
8 |
- # Slurp UTF-8 file |
|
9 |
- open my $handle, "<:encoding(UTF-8)", $file |
|
10 |
- or die qq/Couldn't open config file "$file": $!/; |
|
11 |
- my $content; |
|
12 |
- while (my $line = <$handle>) { |
|
13 |
- if ($line =~ m#^\s*//#) { |
|
14 |
- $content .= "\n"; |
|
15 |
- next; |
|
16 |
- } |
|
17 |
- else { $content .= $line } |
|
18 |
- } |
|
19 |
- |
|
20 |
- # Process |
|
21 |
- return $self->parse($content, $file, $conf, $app); |
|
22 |
-} |
|
23 |
- |
|
24 |
-1; |
... | ... |
@@ -1,444 +0,0 @@ |
1 |
-use strict; |
|
2 |
-use warnings; |
|
3 |
-use utf8; |
|
4 |
-use File::Temp 'tempdir'; |
|
5 |
- |
|
6 |
-use Test::More 'no_plan'; |
|
7 |
- |
|
8 |
-use FindBin; |
|
9 |
-use lib "$FindBin::Bin/../mojolegacy/lib"; |
|
10 |
-use lib "$FindBin::Bin/../lib"; |
|
11 |
-use Gitweblite; |
|
12 |
- |
|
13 |
-use Test::Mojo; |
|
14 |
- |
|
15 |
-my $app = Gitweblite->new; |
|
16 |
-my $t = Test::Mojo->new($app); |
|
17 |
- |
|
18 |
-# Home page |
|
19 |
-$t->get_ok('/') |
|
20 |
- ->content_like(qr/Gitweb Lite/) |
|
21 |
- ->content_like(qr/Home Directory/) |
|
22 |
- ->content_like(qr#/home/kimoto/labo/#) |
|
23 |
- ->content_like(qr#href="/home/kimoto/labo/projects"#) |
|
24 |
-; |
|
25 |
- |
|
26 |
-# Projects page |
|
27 |
-my $home = '/home/kimoto/labo'; |
|
28 |
-$t->get_ok("$home/projects") |
|
29 |
- # Page title |
|
30 |
- ->content_like(qr/Projects/) |
|
31 |
- # Home directory |
|
32 |
- ->content_like(qr#<a href="/">home</a> >\s*<a href="/home/kimoto/labo/projects">/home/kimoto/labo</a>#) |
|
33 |
- # Project link |
|
34 |
- ->content_like(qr#<a class="list" href="/home/kimoto/labo/gitweblite_devrep.git/summary">\s+gitweblite_devrep.git\s+</a>#) |
|
35 |
- # Description link |
|
36 |
- ->content_like(qr#<a class="list" title="Test Repository テストリポジトリ\s*"\s*href="/home/kimoto/labo/gitweblite_devrep.git/summary">\s*Test Repository テストリポジトリ\s*</a>#) |
|
37 |
- # Owner |
|
38 |
- ->content_like(qr#<td><i>kimoto</i></td>#) |
|
39 |
- # Content links |
|
40 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/summary">summary</a>#) |
|
41 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/shortlog">shortlog</a>#) |
|
42 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/log">log</a>#) |
|
43 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tree">#) |
|
44 |
-; |
|
45 |
- |
|
46 |
-# Summary page |
|
47 |
-my $project = "$home/gitweblite_devrep.git"; |
|
48 |
-my $git = $app->git; |
|
49 |
-{ |
|
50 |
- my $head = $git->head_id($project); |
|
51 |
- my $commit = $git->parse_commit($project, 'HEAD'); |
|
52 |
- my $title_short = $commit->{title_short}; |
|
53 |
- my $tag_t21 = $git->tag($project, 't21'); |
|
54 |
- $t->get_ok("$project/summary") |
|
55 |
- # Page navi |
|
56 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/shortlog/$head">Shortlog</a>#) |
|
57 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/log/$head">Log</a>#) |
|
58 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/commit/$head">\s*Commit\s*</a>#) |
|
59 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/commitdiff/$head">Commitdiff</a>#) |
|
60 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tree/$head">Tree</a>#) |
|
61 |
- # Description |
|
62 |
- ->content_like(qr#<tr id="metadata_desc"><td><b>Description:</b></td><td>Test Repository テストリポジトリ\s*</td></tr>#) |
|
63 |
- # Owner |
|
64 |
- ->content_like(qr#<tr id="metadata_owner"><td><b>Owner:</b></td><td>kimoto</td></tr>#) |
|
65 |
- # Ripository URL |
|
66 |
- ->content_like(qr#http://somerep.git\s*<br />\s*git://somerep.git\s*<br />#) |
|
67 |
- # Branch |
|
68 |
- ->content_like(qr#<span class="head" title="heads/master">\s*<a href="/home/kimoto/labo/gitweblite_devrep.git/shortlog/refs/heads/master">\s*master\s*</a>\s*</span>#) |
|
69 |
- # Shortlog title link |
|
70 |
- ->content_like(qr#<a class="title" href="/home/kimoto/labo/gitweblite_devrep.git/shortlog">\s*Shortlog\s*</a>#) |
|
71 |
- # Shorlog comment link |
|
72 |
- ->content_like(qr#<a class="list subject"\s*href="/home/kimoto/labo/gitweblite_devrep.git/commit/$head">\s*$title_short\s*</a>#) |
|
73 |
- # Shortlog commit link |
|
74 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/commit/$head">\s*commit\s*</a>#) |
|
75 |
- # Shortlog commitdiff link |
|
76 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/commitdiff/$head">\s*commitdiff\s*</a>#) |
|
77 |
- # Shortlog tree link |
|
78 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tree/$head">\s*tree\s*</a>#) |
|
79 |
- # Shortlog snapshot link |
|
80 |
- ->content_like(qr#<a title="in format: tar.gz" rel="nofollow" href=\s*"/home/kimoto/labo/gitweblite_devrep.git/snapshot/$head">\s*snapshot\s*</a>#) |
|
81 |
- # Shortlog page ... link |
|
82 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/shortlog">\s*\.\.\.\s*</a>#) |
|
83 |
- # Tag name link |
|
84 |
- ->content_like(qr#<a class="list name"\s*href="/home/kimoto/labo/gitweblite_devrep.git/commit/$tag_t21->{refid}"\s*>\s*t10\s*</a>#) |
|
85 |
- # Tag comment link |
|
86 |
- ->content_like(qr#<a class="list subject"\s*href="/home/kimoto/labo/gitweblite_devrep.git/tag/$tag_t21->{id}"\s*>\s*t21\s*</a>#) |
|
87 |
- # Tag shortlog link |
|
88 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/shortlog/refs/tags/t21"\s*>\s*shortlog\s*</a>#) # Tag log link |
|
89 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/log/refs/tags/t21">\s*log\s*</a>#) |
|
90 |
- # Tags link |
|
91 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tags">\s*...\s*</a>#) |
|
92 |
- |
|
93 |
- # Head name link |
|
94 |
- ->content_like(qr#<a class="list name"\s*href="/home/kimoto/labo/gitweblite_devrep.git/log/refs/heads/b10">\s*b10\s*</a>#) |
|
95 |
- # Head shortlog link |
|
96 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/shortlog/refs/heads/b10">\s*shortlog\s*</a>#) |
|
97 |
- # Head log link |
|
98 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/log/refs/heads/b10">\s*log\s*</a>#) |
|
99 |
- # Head tree link |
|
100 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tree/b10">\s*tree\s*</a>#) |
|
101 |
- # Heads link |
|
102 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/heads">\s*...\s*</a>#) |
|
103 |
- ; |
|
104 |
-} |
|
105 |
- |
|
106 |
-# Commit page |
|
107 |
-{ |
|
108 |
- my $id = '6d71d9bc1ee3bd1c96a559109244c1fe745045de'; |
|
109 |
- my $commit = $git->parse_commit($project, $id); |
|
110 |
- my $parent = $commit->{parent}; |
|
111 |
- my $parent_short = substr($parent, 0, 7); |
|
112 |
- $t->get_ok("$project/commit/$id") |
|
113 |
- # Parent |
|
114 |
- ->content_like(qr#parent:\s*<a href="/home/kimoto/labo/gitweblite_devrep.git/commit/$parent">\s*$parent_short\s*</a>#) |
|
115 |
- # Title |
|
116 |
- ->content_like(qr#<a class="title" href="/home/kimoto/labo/gitweblite_devrep.git/commitdiff/$id">\s*日本語の内容を追加\s*</a>#) |
|
117 |
- # Head link |
|
118 |
- ->content_like(qr#<span class="head" title="heads/b10">\s*<a href="/home/kimoto/labo/gitweblite_devrep.git/shortlog/refs/heads/b10">\s*b10\s*</a>\s*</span>#) |
|
119 |
- # Tag link |
|
120 |
- ->content_like(qr#<span class="tag" title="tags/t10">\s*<a href="/home/kimoto/labo/gitweblite_devrep.git/shortlog/refs/tags/t10">\s*t10\s*</a>\s*</span>#) |
|
121 |
- # Author |
|
122 |
- ->content_like(qr#<td>author</td>\s*<td>Yuki Kimoto <kimoto.yuki\@gmail.com></td>#) |
|
123 |
- # Committer |
|
124 |
- ->content_like(qr#<td>committer</td>\s*<td>Yuki Kimoto <kimoto.yuki\@gmail.com></td>#) |
|
125 |
- # Commit |
|
126 |
- ->content_like(qr#<td>commit</td>\s*<td class="sha1">$id</td>#) |
|
127 |
- # Tree commit id link |
|
128 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tree/$id">\s*tree\s*</a>#) |
|
129 |
- # Tree link |
|
130 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tree/$id">\s*tree\s*</a>#) |
|
131 |
- # Snapshot link |
|
132 |
- ->content_like(qr#<a title="in format: tar.gz" rel="nofollow"\s*href="/home/kimoto/labo/gitweblite_devrep.git/snapshot/$id">\s*snapshot\s*</a>#) |
|
133 |
- # Parent commit id link |
|
134 |
- ->content_like(qr#<a class="list" href="/home/kimoto/labo/gitweblite_devrep.git/commit/$parent">\s*$parent\s*</a>#) |
|
135 |
- # Parent commit link |
|
136 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/commit/$parent">\s*commit\s*</a>#) |
|
137 |
- # Comment |
|
138 |
- ->content_like(qr#<div class="page_body">\s*日本語の内容を追加<br/>\s*<br/>\s*</div>#) |
|
139 |
- # Commit difftree file name link |
|
140 |
- ->content_like(qr#<a class="list" href="/home/kimoto/labo/gitweblite_devrep.git/blob/$id/a_renamed.txt">\s*a_renamed.txt\s*</a>#) |
|
141 |
- # Commit difftree blobdiff link |
|
142 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/blobdiff/$parent\.\.$id/a_renamed.txt">\s*diff\s*</a>#) |
|
143 |
- # Commit difftree blob link |
|
144 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/blob/$id/a_renamed.txt">\s*blob\s*</a>#) |
|
145 |
- ; |
|
146 |
-} |
|
147 |
- |
|
148 |
-# Commit page (Merge commit) |
|
149 |
-{ |
|
150 |
- my $id = '495195e5a9eec6c0126df9017c320f9dc2e5d0ef'; |
|
151 |
- my $commit = $git->parse_commit($project, $id); |
|
152 |
- my $parent1 = $commit->{parents}->[0]; |
|
153 |
- my $parent1_short = substr($parent1, 0, 7); |
|
154 |
- my $parent2 = $commit->{parents}->[1]; |
|
155 |
- my $parent2_short = substr($parent2, 0, 7); |
|
156 |
- $t->get_ok("$project/commit/$id") |
|
157 |
- # Merge parents |
|
158 |
- ->content_like(qr#merge:\s*<a href="/home/kimoto/labo/gitweblite_devrep.git/commit/$parent1">\s*$parent1_short</a>\s*<a href="/home/kimoto/labo/gitweblite_devrep.git/commit/$parent2">\s*$parent2_short\s*</a>#) |
|
159 |
- # Parent1 |
|
160 |
- ->content_like(qr#<a class="list" href="/home/kimoto/labo/gitweblite_devrep.git/commit/$parent1">\s*$parent1\s*</a>#) |
|
161 |
- # Parent2 |
|
162 |
- ->content_like(qr#<a class="list" href="/home/kimoto/labo/gitweblite_devrep.git/commit/$parent2">\s*$parent2\s*</a>#) |
|
163 |
- # Difftree Diff1 |
|
164 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/blobdiff/$parent1\.\.$id/conflict.txt">\s*diff1\s*</a>#) |
|
165 |
- # Defftree Diff2 |
|
166 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/blobdiff/$parent2\.\.$id/conflict.txt">\s*diff2\s*</a>#) |
|
167 |
- ; |
|
168 |
-} |
|
169 |
- |
|
170 |
-# Commit page (First commit) |
|
171 |
-{ |
|
172 |
- my $id = '4b0e81c462088b16fefbe545e00b993fd7e6f884'; |
|
173 |
- $t->get_ok("$project/commit/$id") |
|
174 |
- # Initial |
|
175 |
- ->content_like(qr#\Q(initial)#) |
|
176 |
- # New file |
|
177 |
- ->content_like(qr#<span class="file_status new">\s*\[\s*new file\s*with mode: 0644\s*\]\s*</span>#) |
|
178 |
- ; |
|
179 |
-} |
|
180 |
- |
|
181 |
-# Commit page (Rename) |
|
182 |
-{ |
|
183 |
- my $id = '15ea9d711617abda5eed7b4173a3349d30bca959'; |
|
184 |
- my $commit = $git->parse_commit($project, $id); |
|
185 |
- my $parent = $commit->{parent}; |
|
186 |
- $t->get_ok("$project/commit/$id") |
|
187 |
- # Rename |
|
188 |
- ->content_like(qr#\[\s*moved from\s*<a href="/home/kimoto/labo/gitweblite_devrep.git/blob/$parent/a\.txt">\s*a\.txt</a>\s*with 100%\s*\]#) |
|
189 |
- ; |
|
190 |
-} |
|
191 |
- |
|
192 |
-# Commit page (Change mode) |
|
193 |
-{ |
|
194 |
- my $id = '5a4043069b01c2a0c257dae1cc862c730bdb2c2f'; |
|
195 |
- my $commit = $git->parse_commit($project, $id); |
|
196 |
- my $parent = $commit->{parent}; |
|
197 |
- $t->get_ok("$project/commit/$id") |
|
198 |
- # Change mode |
|
199 |
- ->content_like(qr#\[\s*changed\s*mode: 0644->0755\s*\]#) |
|
200 |
- ; |
|
201 |
-} |
|
202 |
- |
|
203 |
-# Blob page |
|
204 |
-{ |
|
205 |
- my $id = '68a698012b16490e8cfb9d66bf8bbd9085421c69'; |
|
206 |
- my $file = 'dir/a.txt'; |
|
207 |
- $t->get_ok("$project/blob/$id/$file") |
|
208 |
- # Raw link |
|
209 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/blob-plain/$id/$file">\s*Raw\s*</a>#) |
|
210 |
- # HEAD link |
|
211 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/blob/HEAD/dir/a.txt">\s*HEAD\s*</a>#) |
|
212 |
- # Page path(project) |
|
213 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tree/$id">gitweblite_devrep.git</a>#) |
|
214 |
- # Page path(blob) |
|
215 |
- ->content_like(qr#<a title="tree home" href=\s*"/home/kimoto/labo/gitweblite_devrep.git/tree/$id/dir"\s*>\s*dir\s*</a>\s*/\s*<a title="tree home" href=\s*"/home/kimoto/labo/gitweblite_devrep.git/blob/$id/dir/a.txt">\s*a.txt\s*</a>#) |
|
216 |
- # Content |
|
217 |
- ->content_like(qr#<div class="pre"><a id="l1" href="1" class="linenr"> 1</a> aaaa</div>#) |
|
218 |
- ; |
|
219 |
-} |
|
220 |
- |
|
221 |
-# Blob (tab) |
|
222 |
-{ |
|
223 |
- my $id = '26ab87d6c2640bde3807870347ea793cdf544a5c'; |
|
224 |
- my $file = 'tab.txt'; |
|
225 |
- $t->get_ok("$project/blob/$id/$file") |
|
226 |
- # Content |
|
227 |
- ->content_like(qr#1</a> aaaaa#) |
|
228 |
- ; |
|
229 |
-} |
|
230 |
- |
|
231 |
-# Blob plain |
|
232 |
-{ |
|
233 |
- my $id = '68a698012b16490e8cfb9d66bf8bbd9085421c69'; |
|
234 |
- my $file = 'dir/a.txt'; |
|
235 |
- $t->get_ok("$project/blob-plain/$id/$file") |
|
236 |
- # Content |
|
237 |
- ->content_like(qr#aaaa#) |
|
238 |
- ; |
|
239 |
-} |
|
240 |
- |
|
241 |
-# Blob diff page |
|
242 |
-{ |
|
243 |
- my $id = '68a698012b16490e8cfb9d66bf8bbd9085421c69'; |
|
244 |
- my $from_id = 'a37fbb832ab530fe9747cb128f9461211959103b'; |
|
245 |
- my $file = 'dir/a.txt'; |
|
246 |
- $t->get_ok("$project/blobdiff/$from_id..$id/$file") |
|
247 |
- # Raw link |
|
248 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/blobdiff-plain/a37fbb832ab530fe9747cb128f9461211959103b..68a698012b16490e8cfb9d66bf8bbd9085421c69/dir/a.txt">\s*Raw\s*</a>#) |
|
249 |
- # Page path (project) |
|
250 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tree/68a698012b16490e8cfb9d66bf8bbd9085421c69">gitweblite_devrep.git</a>#) |
|
251 |
- # Page path (blob) |
|
252 |
- ->content_like(qr#<a title="tree home" href=\s*"/home/kimoto/labo/gitweblite_devrep.git/tree/68a698012b16490e8cfb9d66bf8bbd9085421c69/dir"\s*>\s*dir\s*</a>\s*/\s*<a title="tree home" href=\s*"/home/kimoto/labo/gitweblite_devrep.git/blob/68a698012b16490e8cfb9d66bf8bbd9085421c69/dir/a.txt">\s*a.txt\s*</a>#) |
|
253 |
- # Content (diff header) |
|
254 |
- ->content_like(qr#<div class="diff header">diff --git\s*<a href="/home/kimoto/labo/gitweblite_devrep.git/blob/a37fbb832ab530fe9747cb128f9461211959103b/dir/a.txt">a/dir/a.txt</a>\s*<a href="/home/kimoto/labo/gitweblite_devrep.git/blob/68a698012b16490e8cfb9d66bf8bbd9085421c69/dir/a.txt">b/dir/a.txt</a></div>#) |
|
255 |
- # Content (diff line) |
|
256 |
- ->content_like(qr#<div class="diff to_file">\+aaaa</div>#) |
|
257 |
- ; |
|
258 |
-} |
|
259 |
- |
|
260 |
-# Blobdiff plain |
|
261 |
-{ |
|
262 |
- my $id = '68a698012b16490e8cfb9d66bf8bbd9085421c69'; |
|
263 |
- my $from_id = 'a37fbb832ab530fe9747cb128f9461211959103b'; |
|
264 |
- my $file = 'dir/a.txt'; |
|
265 |
- $t->get_ok("$project/blobdiff-plain/$from_id..$id/$file") |
|
266 |
- # Content (diff line) |
|
267 |
- ->content_like(qr#\+aaaa#) |
|
268 |
- ; |
|
269 |
-} |
|
270 |
- |
|
271 |
-# Tree page (Top direcotory) |
|
272 |
-{ |
|
273 |
- my $id = '68a698012b16490e8cfb9d66bf8bbd9085421c69'; |
|
274 |
- $t->get_ok("$project/tree/$id") |
|
275 |
- # Snapshot link |
|
276 |
- ->content_like(qr#<a title="in format: tar.gz" rel="nofollow"\s*href="/home/kimoto/labo/gitweblite_devrep.git/snapshot/$id">\s*snapshot\s*</a>#) |
|
277 |
- # Commit comment |
|
278 |
- ->content_like(qr#<a class="title" href="/home/kimoto/labo/gitweblite_devrep.git/commit/68a698012b16490e8cfb9d66bf8bbd9085421c69">\s*added text to dir/a.txt\s*</a>#) |
|
279 |
- # File name link |
|
280 |
- ->content_like(qr#<a class="list" href="/home/kimoto/labo/gitweblite_devrep.git/blob/68a698012b16490e8cfb9d66bf8bbd9085421c69/README">\s*README\s*</a>#) |
|
281 |
- # Blob link |
|
282 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/blob/68a698012b16490e8cfb9d66bf8bbd9085421c69/README">\s*blob\s*</a>#) |
|
283 |
- # Raw link |
|
284 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/blob-plain/68a698012b16490e8cfb9d66bf8bbd9085421c69/README">\s*raw\s*</a>#) |
|
285 |
- # Directory link |
|
286 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tree/68a698012b16490e8cfb9d66bf8bbd9085421c69/dir">\s*dir\s*</a>#) |
|
287 |
- # Tree link |
|
288 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tree/68a698012b16490e8cfb9d66bf8bbd9085421c69/dir">\s*tree\s*</a>#) |
|
289 |
- ; |
|
290 |
-} |
|
291 |
- |
|
292 |
-# Tree page (Sub directory) |
|
293 |
-{ |
|
294 |
- my $id = '68a698012b16490e8cfb9d66bf8bbd9085421c69'; |
|
295 |
- my $dir = 'dir'; |
|
296 |
- $t->get_ok("$project/tree/$id/$dir") |
|
297 |
- # Page path (project) |
|
298 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tree/68a698012b16490e8cfb9d66bf8bbd9085421c69">gitweblite_devrep.git</a>#) |
|
299 |
- # Page path (directory) |
|
300 |
- ->content_like(qr#<a title="tree home" href=\s*"/home/kimoto/labo/gitweblite_devrep.git/tree/68a698012b16490e8cfb9d66bf8bbd9085421c69/dir">\s*dir\s*</a>#) |
|
301 |
- ; |
|
302 |
-} |
|
303 |
- |
|
304 |
-# Shortlog page (HEAD) |
|
305 |
-{ |
|
306 |
- $t->get_ok("$project/shortlog") |
|
307 |
- # HEAD link |
|
308 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/shortlog">\s*HEAD\s*</a>#) |
|
309 |
- # Next page link |
|
310 |
- ->content_like(qr#<a title="Alt-n" accesskey="n" href=\s*"/home/kimoto/labo/gitweblite_devrep.git/shortlog\?page=1">\s*Next\s*</a>#) |
|
311 |
- ; |
|
312 |
- $t->get_ok("$project/shortlog?page=1") |
|
313 |
- # Prev page link |
|
314 |
- ->content_like(qr#<a title="Alt-p" accesskey="p" href=\s*"/home/kimoto/labo/gitweblite_devrep.git/shortlog\?page=0">\s*Prev\s*</a>#) |
|
315 |
- ; |
|
316 |
-} |
|
317 |
- |
|
318 |
-# Shortlog page (not HEAD) |
|
319 |
-{ |
|
320 |
- my $id = 'efcac846dfa843dca225c6d7445e349059011a44'; |
|
321 |
- $t->get_ok("$project/shortlog/$id") |
|
322 |
- # Author |
|
323 |
- ->content_like(qr#<td class="author">Yuki Kimoto</td>#) |
|
324 |
- # Comment link |
|
325 |
- ->content_like(qr#<a class="list subject" href=\s*"/home/kimoto/labo/gitweblite_devrep.git/commit/efcac846dfa843dca225c6d7445e349059011a44">\s*edit a_renamed.txt\s*</a>#) |
|
326 |
- # Commit link |
|
327 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/commit/efcac846dfa843dca225c6d7445e349059011a44">commit</a>#) |
|
328 |
- # Commitdiff link |
|
329 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/commitdiff/efcac846dfa843dca225c6d7445e349059011a44">\s*commitdiff\s*</a>#) |
|
330 |
- # Tree link |
|
331 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tree/efcac846dfa843dca225c6d7445e349059011a44">\s*tree\s*</a>#) |
|
332 |
- # Snapshot link |
|
333 |
- ->content_like(qr#<a title="in format: tar.gz" rel="nofollow" href=\s*/home/kimoto/labo/gitweblite_devrep.git/snapshot/efcac846dfa843dca225c6d7445e349059011a44>\s*snapshot\s*</a>#) |
|
334 |
- |
|
335 |
- ; |
|
336 |
-} |
|
337 |
- |
|
338 |
-# Log page (HEAD) |
|
339 |
-{ |
|
340 |
- $t->get_ok("$project/log") |
|
341 |
- # HEAD link |
|
342 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/log">\s*HEAD\s*</a>#) |
|
343 |
- # Next page link |
|
344 |
- ->content_like(qr#<a title="Alt-n" accesskey="n" href=\s*"/home/kimoto/labo/gitweblite_devrep.git/log\?page=1">\s*Next\s*</a>#) |
|
345 |
- ; |
|
346 |
- $t->get_ok("$project/log?page=1") |
|
347 |
- # Prev page link |
|
348 |
- ->content_like(qr#<a title="Alt-p" accesskey="p" href=\s*"/home/kimoto/labo/gitweblite_devrep.git/log\?page=0">\s*Prev\s*</a>#) |
|
349 |
- ; |
|
350 |
-} |
|
351 |
- |
|
352 |
-# Log page (not HEAD) |
|
353 |
-{ |
|
354 |
- my $id = 'efcac846dfa843dca225c6d7445e349059011a44'; |
|
355 |
- $t->get_ok("$project/log/$id") |
|
356 |
- # Author |
|
357 |
- ->content_like(qr#<span class="author_date">Yuki Kimoto#) |
|
358 |
- # Comment link |
|
359 |
- ->content_like(qr#edit a_renamed.txt#) |
|
360 |
- # Commit link |
|
361 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/commit/efcac846dfa843dca225c6d7445e349059011a44">commit</a>#) |
|
362 |
- # Commitdiff link |
|
363 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/commitdiff/efcac846dfa843dca225c6d7445e349059011a44">\s*commitdiff\s*</a>#) |
|
364 |
- # Tree link |
|
365 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tree/efcac846dfa843dca225c6d7445e349059011a44">\s*tree\s*</a>#) |
|
366 |
- ; |
|
367 |
-} |
|
368 |
- |
|
369 |
-# Commitdiff page |
|
370 |
-{ |
|
371 |
- my $id = 'db9d83440469d42dda2021ebe34e20def0c0cba6'; |
|
372 |
- $t->get_ok("$project/commitdiff/$id") |
|
373 |
- # Raw link |
|
374 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/commitdiff-plain/db9d83440469d42dda2021ebe34e20def0c0cba6">\s*Raw\s*</a>#) |
|
375 |
- # Comment link |
|
376 |
- ->content_like(qr#<a class="title" href="/home/kimoto/labo/gitweblite_devrep.git/commit/">\s*edit a_renamed.txt\s*</a>#) |
|
377 |
- # Author |
|
378 |
- ->content_like(qr#<td>Author</td><td>Yuki Kimoto#) |
|
379 |
- # Committer |
|
380 |
- ->content_like(qr#<td>Committer</td><td>Yuki Kimoto#) |
|
381 |
- # Difftree (file name link) |
|
382 |
- ->content_like(qr#<a class="list" href="/home/kimoto/labo/gitweblite_devrep.git/blob/db9d83440469d42dda2021ebe34e20def0c0cba6/a_renamed.txt">\s*a_renamed.txt\s*</a>#) |
|
383 |
- # Difftree (diff link) |
|
384 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/blobdiff/efcac846dfa843dca225c6d7445e349059011a44\.\.db9d83440469d42dda2021ebe34e20def0c0cba6/a_renamed.txt">\s*diff\s*</a>#) |
|
385 |
- # Difftree (blob link) |
|
386 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/blob/db9d83440469d42dda2021ebe34e20def0c0cba6/a_renamed.txt">\s*blob\s*</a>#) |
|
387 |
- # Content (diff header) |
|
388 |
- ->content_like(qr#<div class="diff header">diff --git\s*<a href="/home/kimoto/labo/gitweblite_devrep.git/blob/efcac846dfa843dca225c6d7445e349059011a44/a_renamed.txt">a/a_renamed.txt</a>\s*<a href="/home/kimoto/labo/gitweblite_devrep.git/blob/db9d83440469d42dda2021ebe34e20def0c0cba6/a_renamed.txt">b/a_renamed.txt</a></div>#) |
|
389 |
- # Content (added) |
|
390 |
- ->content_like(qr#<div class="diff to_file">\+a</div>#) |
|
391 |
-} |
|
392 |
- |
|
393 |
-# Commitdiff plain |
|
394 |
-{ |
|
395 |
- my $id = 'db9d83440469d42dda2021ebe34e20def0c0cba6'; |
|
396 |
- $t->get_ok("$project/commitdiff-plain/$id") |
|
397 |
- # Content |
|
398 |
- ->content_like(qr#\+a#) |
|
399 |
-} |
|
400 |
- |
|
401 |
-# Tags page |
|
402 |
-{ |
|
403 |
- $t->get_ok("$project/tags") |
|
404 |
- # Tag name link |
|
405 |
- ->content_like(qr#<a class="list name"\s*href="/home/kimoto/labo/gitweblite_devrep.git/commit/6d71d9bc1ee3bd1c96a559109244c1fe745045de">\s*t21\s*</a>#) |
|
406 |
- # Tag comment link |
|
407 |
- ->content_like(qr#<a class="list subject"\s*href="/home/kimoto/labo/gitweblite_devrep.git/tag/38eaff4bf31775c7e32d5a62891e0e370e04d306">\s*t21\s*</a>#) |
|
408 |
- # Tag link |
|
409 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tag/38eaff4bf31775c7e32d5a62891e0e370e04d306">\s*tag\s*</a>#) |
|
410 |
- # Commot link |
|
411 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/commit/6d71d9bc1ee3bd1c96a559109244c1fe745045de">\s*commit\s*</a>#) |
|
412 |
- # Shotlog link |
|
413 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/shortlog/refs/tags/t21">\s*shortlog\s*</a>#) |
|
414 |
- # Log |
|
415 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/log/refs/tags/t21">\s*log\s*</a>#) |
|
416 |
- ; |
|
417 |
-} |
|
418 |
- |
|
419 |
-# Tag page |
|
420 |
-{ |
|
421 |
- $t->get_ok("$project/tag/38eaff4bf31775c7e32d5a62891e0e370e04d306") |
|
422 |
- # Object link |
|
423 |
- ->content_like(qr#<a class="list" href="/home/kimoto/labo/gitweblite_devrep.git/commit/6d71d9bc1ee3bd1c96a559109244c1fe745045de">\s*6d71d9bc1ee3bd1c96a559109244c1fe745045de\s*</a>#) |
|
424 |
- # Commit link |
|
425 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/commit/6d71d9bc1ee3bd1c96a559109244c1fe745045de">\s*commit\s*</a>#) |
|
426 |
- # Author |
|
427 |
- ->content_like(qr#<td>\s*author\s*</td>\s*<td>\s*Yuki Kimoto#) |
|
428 |
- # Comment |
|
429 |
- ->content_like(qr#<div class="page_body">\s*t21#) |
|
430 |
-} |
|
431 |
- |
|
432 |
-# Heads page |
|
433 |
-{ |
|
434 |
- $t->get_ok("$project/heads") |
|
435 |
- # Head name link |
|
436 |
- ->content_like(qr#<a class="list name" href="/home/kimoto/labo/gitweblite_devrep.git/log/refs/heads/master">\s*master\s*</a>#) |
|
437 |
- # Shortlog link |
|
438 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/shortlog/refs/heads/master">\s*shortlog\s*</a>#) |
|
439 |
- # Log link |
|
440 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/log/refs/heads/master">\s*log\s*</a>#) |
|
441 |
- # Tree link |
|
442 |
- ->content_like(qr#<a href="/home/kimoto/labo/gitweblite_devrep.git/tree/master">\s*tree\s*</a>#) |
|
443 |
- ; |
|
444 |
-} |
... | ... |
@@ -1,16 +0,0 @@ |
1 |
-use strict; |
|
2 |
-use warnings; |
|
3 |
-use utf8; |
|
4 |
- |
|
5 |
-use Test::More 'no_plan'; |
|
6 |
- |
|
7 |
-use FindBin; |
|
8 |
-use lib "$FindBin::Bin/../mojolegacy/lib"; |
|
9 |
-use lib "$FindBin::Bin/../lib"; |
|
10 |
-use Gitweblite; |
|
11 |
- |
|
12 |
-$ENV{GITWEBLITE_CONFIG_FILE} = "$FindBin::Bin/test.conf"; |
|
13 |
-my $app = Gitweblite->new; |
|
14 |
-my $conf = $app->config; |
|
15 |
-is($conf->{search_max_depth}, 15); |
|
16 |
-is($conf->{logo_link}, "https://github.com/yuki-kimoto/gitweblite"); |
... | ... |
@@ -1,39 +0,0 @@ |
1 |
-use strict; |
|
2 |
-use warnings; |
|
3 |
-use utf8; |
|
4 |
- |
|
5 |
-use Test::More; |
|
6 |
- |
|
7 |
-plan skip_all => 'require Archive::Tar' |
|
8 |
- unless eval { require Archive::Tar; 1 }; |
|
9 |
- |
|
10 |
-use File::Temp 'tempdir'; |
|
11 |
-require Archive::Tar; |
|
12 |
- |
|
13 |
-plan 'no_plan'; |
|
14 |
- |
|
15 |
-use FindBin; |
|
16 |
-use lib "$FindBin::Bin/../mojolegacy/lib"; |
|
17 |
-use lib "$FindBin::Bin/../lib"; |
|
18 |
-use Gitweblite; |
|
19 |
- |
|
20 |
-use Test::Mojo; |
|
21 |
- |
|
22 |
-my $app = Gitweblite->new; |
|
23 |
-my $t = Test::Mojo->new($app); |
|
24 |
- |
|
25 |
-my $home = '/home/kimoto/labo'; |
|
26 |
-my $project = "$home/gitweblite_devrep.git"; |
|
27 |
- |
|
28 |
-# Snapshot |
|
29 |
-{ |
|
30 |
- my $id = 'a37fbb832ab530fe9747cb128f9461211959103b'; |
|
31 |
- $t->get_ok("$project/snapshot/$id"); |
|
32 |
- my $tmpdir = tempdir(CLEANUP => 1); |
|
33 |
- my $tmpfile = "$tmpdir/snapshot.tar.gz"; |
|
34 |
- $t->tx->res->content->asset->move_to($tmpfile); |
|
35 |
- my $at = Archive::Tar->new($tmpfile); |
|
36 |
- |
|
37 |
- ok($at->contains_file('gitweblite_devrep-a37fbb8/README')); |
|
38 |
- ok($at->contains_file('gitweblite_devrep-a37fbb8/dir/a.txt')); |
|
39 |
-} |
... | ... |
@@ -1,15 +0,0 @@ |
1 |
-{ |
|
2 |
- // Search directory |
|
3 |
- "search_dirs" : ["/git/pub", "/home"], |
|
4 |
- |
|
5 |
- // Serach max depth |
|
6 |
- "search_max_depth" : 15, |
|
7 |
- |
|
8 |
- // Git command |
|
9 |
- "git_bin" : "/usr/local/bin/git", |
|
10 |
- |
|
11 |
- // Server config |
|
12 |
- "hypnotoad" : { |
|
13 |
- "listen" : ["http://*:10010"] |
|
14 |
- } |
|
15 |
-} |