remove Mojolicious::Plugin::AutoRoute::Util::template...
...method
... | ... |
@@ -9,8 +9,6 @@ use Gitprep::Git; |
9 | 9 |
use Gitprep::Manager; |
10 | 10 |
use Scalar::Util 'weaken'; |
11 | 11 |
use Validator::Custom; |
12 |
-use Mojolicious::Plugin::AutoRoute::Util 'template'; |
|
13 |
- |
|
14 | 12 |
|
15 | 13 |
# Digest::SHA loading to Mojo::Util if not loaded |
16 | 14 |
{ |
... | ... |
@@ -217,19 +215,19 @@ sub startup { |
217 | 215 |
# Custom routes |
218 | 216 |
{ |
219 | 217 |
# Show ssh keys |
220 |
- $r->get('/(:user).keys' => template '/user-keys'); |
|
218 |
+ $r->get('/(:user).keys' => sub { shift->render_maybe('/user-keys') }); |
|
221 | 219 |
|
222 | 220 |
# User |
223 | 221 |
my $r = $r->route('/:user'); |
224 | 222 |
{ |
225 | 223 |
# Home |
226 |
- $r->get('/' => [format => 0] => template '/user'); |
|
224 |
+ $r->get('/' => [format => 0] => sub { shift->render_maybe('/user') }); |
|
227 | 225 |
|
228 | 226 |
# Settings |
229 |
- $r->get('/_settings' => template '/user-settings'); |
|
227 |
+ $r->get('/_settings' => sub { shift->render_maybe('/user-settings') }); |
|
230 | 228 |
|
231 | 229 |
# SSH keys |
232 |
- $r->any('/_settings/ssh' => template '/user-settings/ssh'); |
|
230 |
+ $r->any('/_settings/ssh' => sub { shift->render_maybe('/user-settings/ssh') }); |
|
233 | 231 |
} |
234 | 232 |
|
235 | 233 |
# Smart HTTP |
... | ... |
@@ -282,16 +280,16 @@ sub startup { |
282 | 280 |
}); |
283 | 281 |
|
284 | 282 |
# /info/refs |
285 |
- $r->get('/info/refs' => template 'smart-http/info-refs'); |
|
283 |
+ $r->get('/info/refs' => sub { shift->render_maybe('smart-http/info-refs') }); |
|
286 | 284 |
|
287 | 285 |
# /git-upload-pack or /git-receive-pack |
288 | 286 |
$r->any('/git-(:service)' |
289 | 287 |
=> [service => qr/(?:upload-pack|receive-pack)/] |
290 |
- => template 'smart-http/service' |
|
288 |
+ => sub { shift->render_maybe('smart-http/service') } |
|
291 | 289 |
); |
292 | 290 |
|
293 | 291 |
# Static file |
294 |
- $r->get('/(*Path)' => template 'smart-http/static'); |
|
292 |
+ $r->get('/(*Path)' => sub { shift->render_maybe('smart-http/static') }); |
|
295 | 293 |
} |
296 | 294 |
} |
297 | 295 |
|
... | ... |
@@ -325,72 +323,73 @@ sub startup { |
325 | 323 |
}); |
326 | 324 |
|
327 | 325 |
# Home |
328 |
- $r->get('/' => template '/tree'); |
|
326 |
+ $r->get('/' => sub { shift->render_maybe('/tree') }); |
|
329 | 327 |
|
330 | 328 |
# Commit |
331 |
- $r->get('/commit/*diff' => template '/commit'); |
|
329 |
+ $r->get('/commit/*diff' => sub { shift->render_maybe('/commit') }); |
|
332 | 330 |
|
333 | 331 |
# Commits |
334 |
- $r->get('/commits/*rev_file' => template '/commits'); |
|
332 |
+ $r->get('/commits/*rev_file' => sub { shift->render_maybe('/commits') }); |
|
335 | 333 |
|
336 | 334 |
# Branches |
337 |
- $r->any('/branches/:display' => {display => undef} => template '/branches'); |
|
335 |
+ $r->any('/branches/:display' => {display => undef} => sub { shift->render_maybe('/branches') }); |
|
338 | 336 |
|
339 | 337 |
# Tags |
340 |
- $r->get('/tags' => template '/tags'); |
|
338 |
+ $r->get('/tags' => sub { shift->render_maybe('/tags') }); |
|
341 | 339 |
|
342 | 340 |
# Tree |
343 |
- $r->get('/tree/*rev_dir' => template '/tree'); |
|
341 |
+ $r->get('/tree/*rev_dir' => sub { shift->render_maybe('/tree') }); |
|
344 | 342 |
|
345 | 343 |
# Blob |
346 |
- $r->get('/blob/*rev_file' => template '/blob'); |
|
344 |
+ $r->get('/blob/*rev_file' => sub { shift->render_maybe('/blob') }); |
|
347 | 345 |
|
348 | 346 |
# Sub module |
349 |
- $r->get('/submodule/*rev_file' => template '/submodule'); |
|
347 |
+ $r->get('/submodule/*rev_file' => sub { shift->render_maybe('/submodule') }); |
|
350 | 348 |
|
351 | 349 |
# Raw |
352 |
- $r->get('/raw/*rev_file' => template '/raw'); |
|
350 |
+ $r->get('/raw/*rev_file' => sub { shift->render_maybe('/raw') }); |
|
353 | 351 |
|
354 | 352 |
# Blame |
355 |
- $r->get('/blame/*rev_file' => template '/blame'); |
|
353 |
+ $r->get('/blame/*rev_file' => sub { shift->render_maybe('/blame') }); |
|
356 | 354 |
|
357 | 355 |
# Archive |
358 |
- $r->get('/archive/(*rev).tar.gz' => template '/archive')->to(archive_type => 'tar'); |
|
359 |
- $r->get('/archive/(*rev).zip' => template '/archive')->to(archive_type => 'zip' ); |
|
356 |
+ # Archive |
|
357 |
+ $r->get('/archive/(*rev).tar.gz' => sub { shift->render_maybe('/archive') })->to(archive_type => 'tar'); |
|
358 |
+ $r->get('/archive/(*rev).zip' => sub { shift->render_maybe('/archive') })->to(archive_type => 'zip' ); |
|
360 | 359 |
|
361 | 360 |
# Compare |
362 |
- $r->get('/compare/(*rev1)...(*rev2)' => template '/compare'); |
|
361 |
+ $r->get('/compare/(*rev1)...(*rev2)' => sub { shift->render_maybe('/compare') }); |
|
363 | 362 |
|
364 | 363 |
# Settings |
365 | 364 |
{ |
366 | 365 |
my $r = $r->route('/settings')->to(tab => 'settings'); |
367 | 366 |
|
368 | 367 |
# Settings |
369 |
- $r->any('/' => template '/settings'); |
|
368 |
+ $r->any('/' => sub { shift->render_maybe('/settings') }); |
|
370 | 369 |
|
371 | 370 |
# Collaboration |
372 |
- $r->any('/collaboration' => template '/settings/collaboration'); |
|
371 |
+ $r->any('/collaboration' => sub { shift->render_maybe('/settings/collaboration') }); |
|
373 | 372 |
} |
374 | 373 |
|
375 | 374 |
# Fork |
376 |
- $r->any('/fork' => template '/fork'); |
|
375 |
+ $r->any('/fork' => sub { shift->render_maybe('/fork') }); |
|
377 | 376 |
|
378 | 377 |
# Network |
379 | 378 |
{ |
380 | 379 |
my $r = $r->route('/network')->to(tab => 'graph'); |
381 | 380 |
|
382 | 381 |
# Network |
383 |
- $r->get('/' => template '/network'); |
|
382 |
+ $r->get('/' => sub { shift->render_maybe('/network') }); |
|
384 | 383 |
|
385 | 384 |
# Network Graph |
386 |
- $r->get('/graph/(*rev1)...(*rev2_abs)' => template '/network/graph'); |
|
385 |
+ $r->get('/graph/(*rev1)...(*rev2_abs)' => sub { shift->render_maybe('/network/graph') }); |
|
387 | 386 |
} |
388 | 387 |
|
389 | 388 |
# Import branch |
390 |
- $r->any('/import-branch/:remote_user/:remote_project' => template '/import-branch'); |
|
389 |
+ $r->any('/import-branch/:remote_user/:remote_project' => sub { shift->render_maybe('/import-branch') }); |
|
391 | 390 |
|
392 | 391 |
# Get branches and tags |
393 |
- $r->get('/api/revs' => template '/api/revs'); |
|
392 |
+ $r->get('/api/revs' => sub { shift->render_maybe('/api/revs') }); |
|
394 | 393 |
} |
395 | 394 |
} |
396 | 395 |
} |
... | ... |
@@ -119,7 +119,6 @@ note 'Smart HTTP'; |
119 | 119 |
|
120 | 120 |
# /git-upload-pack |
121 | 121 |
{ |
122 |
- $main::p = 1; |
|
123 | 122 |
my $content = <<EOS; |
124 | 123 |
006fwant 6410316f2ed260666a8a6b9a223ad3c95d7abaed multi_ack_detailed no-done side-band-64k thin-pack ofs-delta |
125 | 124 |
0032want 6410316f2ed260666a8a6b9a223ad3c95d7abaed |