| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package FreePAN::IndexPages; |
|
2
|
1
|
|
|
1
|
|
1229
|
use FreePAN::Plugin -Base; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use mixin 'FreePAN::Installer'; |
|
4
|
|
|
|
|
|
|
use IO::All; |
|
5
|
|
|
|
|
|
|
use SVK; |
|
6
|
|
|
|
|
|
|
use SVK::XD; |
|
7
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
const class_id => 'indexpages'; |
|
10
|
|
|
|
|
|
|
const config_file => 'config/indexpages.yaml'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# module, repository, mirror |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub register { |
|
15
|
|
|
|
|
|
|
my $reg = shift; |
|
16
|
|
|
|
|
|
|
$reg->add(command => 'create_module_index', |
|
17
|
|
|
|
|
|
|
description => 'Create Module index page'); |
|
18
|
|
|
|
|
|
|
$reg->add(command => 'create_repository_index', |
|
19
|
|
|
|
|
|
|
description => 'Create Repository index page'); |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub handle_create_repository_index { |
|
23
|
|
|
|
|
|
|
my @repos = map { $_->filename } io($self->hub->config->repos_base)->all_dirs; |
|
24
|
|
|
|
|
|
|
my $output = $self->hub->template->process('repositories.html',repos => \@repos); |
|
25
|
|
|
|
|
|
|
$output > io->catfile($self->hub->config->document_root,"repositories.html")->assert; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub handle_create_module_index { |
|
29
|
|
|
|
|
|
|
die("You don't have repos_base directory\n") |
|
30
|
|
|
|
|
|
|
unless -d $self->hub->config->repos_base; |
|
31
|
|
|
|
|
|
|
my %repos = sub { |
|
32
|
|
|
|
|
|
|
map { |
|
33
|
|
|
|
|
|
|
$_->filename , $_->name |
|
34
|
|
|
|
|
|
|
} io($self->hub->config->repos_base)->all_dirs; |
|
35
|
|
|
|
|
|
|
}->(); |
|
36
|
|
|
|
|
|
|
my $output; |
|
37
|
|
|
|
|
|
|
my $xd = SVK::XD->new(depotmap => \%repos); |
|
38
|
|
|
|
|
|
|
my $svk = SVK->new(xd => $xd, output => \$output); |
|
39
|
|
|
|
|
|
|
my %author_of; |
|
40
|
|
|
|
|
|
|
for my $author (keys %repos) { |
|
41
|
|
|
|
|
|
|
$svk->ls("/$author/"); |
|
42
|
|
|
|
|
|
|
$author_of{$_} = $author for map {s{/$}{};$_} grep !/^\s*$/,split/\n+/,$output; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
$output = $self->hub->template->process('modules.html', |
|
45
|
|
|
|
|
|
|
modules => \%author_of, |
|
46
|
|
|
|
|
|
|
hub => $self->hub); |
|
47
|
|
|
|
|
|
|
$output > io->catfile($self->hub->config->document_root,"modules.html")->assert |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__DATA__ |