line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
2021
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
2
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
64
|
|
3
|
|
|
|
|
|
|
package CPAN::Testers::Metabase::Demo; |
4
|
|
|
|
|
|
|
# ABSTRACT: Demo Metabase backend |
5
|
|
|
|
|
|
|
our $VERSION = '1.999002'; # VERSION |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
526
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Metabase::Archive::SQLite 1.000; |
9
|
|
|
|
|
|
|
use Metabase::Index::FlatFile 1.000; |
10
|
|
|
|
|
|
|
use Metabase::Librarian 1.000; |
11
|
|
|
|
|
|
|
use Path::Class; |
12
|
|
|
|
|
|
|
use File::Temp; |
13
|
|
|
|
|
|
|
use namespace::autoclean; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
with 'Metabase::Gateway'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has 'data_directory' => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
isa => 'Str', |
20
|
|
|
|
|
|
|
lazy => 1, |
21
|
|
|
|
|
|
|
builder => '_build_data_directory', |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# keeps the tempdir alive until process exits |
25
|
|
|
|
|
|
|
has '_cache' => ( |
26
|
|
|
|
|
|
|
is => 'ro', |
27
|
|
|
|
|
|
|
isa => 'HashRef', |
28
|
|
|
|
|
|
|
default => sub { {} }, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _build_data_directory { |
32
|
|
|
|
|
|
|
my $self = shift; |
33
|
|
|
|
|
|
|
return q{} . ( $self->_cache->{tempdir} = File::Temp->newdir ); # stringify |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _build_fact_classes { return [qw/CPAN::Testers::Report/] } |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _build_public_librarian { return $_[0]->__build_librarian("public") } |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _build_private_librarian { return $_[0]->__build_librarian("private") } |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub __build_librarian { |
43
|
|
|
|
|
|
|
my ($self, $subspace) = @_; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $data_dir = dir( $self->data_directory )->subdir($subspace); |
46
|
|
|
|
|
|
|
$data_dir->mkpath or die "coudln't make path to $data_dir"; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $index = $data_dir->file('index.json'); |
49
|
|
|
|
|
|
|
$index->touch; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $archive = $data_dir->file('archive.sqlite'); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
return Metabase::Librarian->new( |
54
|
|
|
|
|
|
|
archive => Metabase::Archive::SQLite->new( |
55
|
|
|
|
|
|
|
filename => "$archive", |
56
|
|
|
|
|
|
|
), |
57
|
|
|
|
|
|
|
index => Metabase::Index::FlatFile->new( |
58
|
|
|
|
|
|
|
index_file => "$index", |
59
|
|
|
|
|
|
|
), |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=pod |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 NAME |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
CPAN::Testers::Metabase::Demo - Demo Metabase backend |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 VERSION |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
version 1.999002 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 SYNOPSIS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 Direct usage |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
use CPAN::Testers::Metabase::Demo; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# defaults to directory on /tmp |
85
|
|
|
|
|
|
|
my $mb = CPAN::Testers::Metabase::Demo->new; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
$mb->public_librarian->search( %search spec ); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 Metabase::Web config |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
--- |
92
|
|
|
|
|
|
|
Model::Metabase: |
93
|
|
|
|
|
|
|
class: CPAN::Testers::Metabase::Demo |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 DESCRIPTION |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This is a demo Metabase backend that uses SQLite and a flat file in |
98
|
|
|
|
|
|
|
a temporary directory. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 USAGE |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 new |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
my $mb = CPAN::Testers::Metabase::AWS->new( |
105
|
|
|
|
|
|
|
data_directory => "/tmp/my-metabase" |
106
|
|
|
|
|
|
|
); |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Arguments for C<<< new >>>: |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=over |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
C<<< data_directory >>> -- optional -- directory path to store data files. Defaults |
115
|
|
|
|
|
|
|
to a L<File::Temp> temporary directory |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=back |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 SEE ALSO |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=over |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item * |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
L<CPAN::Testers::Metabase> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item * |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
L<Metabase::Gateway> |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item * |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
L<Metabase::Web> |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=back |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 AUTHOR |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
David Golden <dagolden@cpan.org> |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This software is Copyright (c) 2012 by David Golden. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This is free software, licensed under: |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
The Apache License, Version 2.0, January 2004 |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
__END__ |
153
|
|
|
|
|
|
|
|