| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ABSTRACT: Initializes a new Pinto repository |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Pinto::Initializer; |
|
4
|
|
|
|
|
|
|
|
|
5
|
51
|
|
|
51
|
|
25204
|
use Moose; |
|
|
51
|
|
|
|
|
117
|
|
|
|
51
|
|
|
|
|
370
|
|
|
6
|
51
|
|
|
51
|
|
319257
|
use MooseX::StrictConstructor; |
|
|
51
|
|
|
|
|
123
|
|
|
|
51
|
|
|
|
|
467
|
|
|
7
|
51
|
|
|
51
|
|
159829
|
use MooseX::MarkAsMethods ( autoclean => 1 ); |
|
|
51
|
|
|
|
|
142
|
|
|
|
51
|
|
|
|
|
445
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
51
|
|
|
51
|
|
172360
|
use IO::Zlib; |
|
|
51
|
|
|
|
|
118
|
|
|
|
51
|
|
|
|
|
558
|
|
|
10
|
51
|
|
|
51
|
|
2666
|
use Path::Class; |
|
|
51
|
|
|
|
|
108
|
|
|
|
51
|
|
|
|
|
3374
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
51
|
|
|
51
|
|
288
|
use Pinto; |
|
|
51
|
|
|
|
|
118
|
|
|
|
51
|
|
|
|
|
1038
|
|
|
13
|
51
|
|
|
51
|
|
319
|
use Pinto::Config; |
|
|
51
|
|
|
|
|
138
|
|
|
|
51
|
|
|
|
|
1681
|
|
|
14
|
51
|
|
|
51
|
|
273
|
use Pinto::Util qw(debug); |
|
|
51
|
|
|
|
|
96
|
|
|
|
51
|
|
|
|
|
32997
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.14'; # VERSION |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub init { |
|
23
|
113
|
|
|
113
|
0
|
5381
|
my ( $self, %args ) = @_; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
die "Must specify a root\n" |
|
26
|
113
|
50
|
|
|
|
619
|
if not $args{root}; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Normalize root |
|
29
|
113
|
|
|
|
|
1090
|
$args{root} =~ s{^file://}{}; |
|
30
|
|
|
|
|
|
|
|
|
31
|
113
|
|
|
|
|
3181
|
$self->_check_sanity(%args); |
|
32
|
113
|
|
|
|
|
678
|
$self->_make_dirs(%args); |
|
33
|
113
|
|
|
|
|
752
|
$self->_write_config(%args); |
|
34
|
113
|
|
|
|
|
845
|
$self->_write_mailrc(%args); |
|
35
|
113
|
|
|
|
|
738
|
$self->_set_version(%args); |
|
36
|
113
|
|
|
|
|
678
|
$self->_create_db(%args); |
|
37
|
113
|
|
|
|
|
23444
|
$self->_create_stack(%args); |
|
38
|
|
|
|
|
|
|
|
|
39
|
113
|
|
|
|
|
19241
|
return $self; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _check_sanity { |
|
45
|
113
|
|
|
113
|
|
487
|
my ( $self, %args ) = @_; |
|
46
|
|
|
|
|
|
|
|
|
47
|
113
|
|
|
|
|
576
|
my $root_dir = dir( $args{root} ); |
|
48
|
113
|
50
|
33
|
|
|
4702
|
die "Directory $root_dir must be empty to create a repository there\n" |
|
49
|
|
|
|
|
|
|
if -e $root_dir and $root_dir->children; |
|
50
|
|
|
|
|
|
|
|
|
51
|
113
|
|
|
|
|
18317
|
return; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub _make_dirs { |
|
57
|
113
|
|
|
113
|
|
486
|
my ( $self, %args ) = @_; |
|
58
|
|
|
|
|
|
|
|
|
59
|
113
|
|
|
|
|
4136
|
my $config = Pinto::Config->new( root => $args{root} ); |
|
60
|
|
|
|
|
|
|
|
|
61
|
113
|
|
|
|
|
791
|
for my $dir ( $config->directories ) { |
|
62
|
678
|
|
|
|
|
125523
|
debug "Making directory $dir"; |
|
63
|
678
|
|
|
|
|
1907
|
$dir->mkpath; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
113
|
|
|
|
|
13149
|
return; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub _write_config { |
|
72
|
113
|
|
|
113
|
|
530
|
my ( $self, %args ) = @_; |
|
73
|
|
|
|
|
|
|
|
|
74
|
113
|
|
|
|
|
3066
|
my $config = Pinto::Config->new( root => $args{root} ); |
|
75
|
|
|
|
|
|
|
|
|
76
|
113
|
|
|
|
|
4023
|
my $config_file = $config->config_dir->file( $config->basename ); |
|
77
|
113
|
|
|
|
|
14864
|
$config->write_config_file( file => $config_file, values => \%args ); |
|
78
|
|
|
|
|
|
|
|
|
79
|
113
|
|
|
|
|
571759
|
return; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub _write_mailrc { |
|
85
|
113
|
|
|
113
|
|
572
|
my ( $self, %args ) = @_; |
|
86
|
|
|
|
|
|
|
|
|
87
|
113
|
|
|
|
|
3527
|
my $config = Pinto::Config->new( root => $args{root} ); |
|
88
|
|
|
|
|
|
|
|
|
89
|
113
|
50
|
|
|
|
3616
|
my $fh = IO::Zlib->new( $config->mailrc_file->stringify, 'wb' ) or die $!; |
|
90
|
113
|
|
|
|
|
221841
|
print {$fh} ''; # File will be empty, but have gzip headers |
|
|
113
|
|
|
|
|
967
|
|
|
91
|
113
|
50
|
|
|
|
11315
|
close $fh or throw $!; |
|
92
|
|
|
|
|
|
|
|
|
93
|
113
|
|
|
|
|
40999
|
return; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub _set_version { |
|
99
|
113
|
|
|
113
|
|
503
|
my ( $self, %args ) = @_; |
|
100
|
|
|
|
|
|
|
|
|
101
|
113
|
|
|
|
|
3355
|
my $pinto = Pinto->new( root => $args{root} ); |
|
102
|
|
|
|
|
|
|
|
|
103
|
113
|
|
|
|
|
2832
|
$pinto->repo->set_version; |
|
104
|
|
|
|
|
|
|
|
|
105
|
113
|
|
|
|
|
3721
|
return; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub _create_db { |
|
111
|
113
|
|
|
113
|
|
451
|
my ( $self, %args ) = @_; |
|
112
|
|
|
|
|
|
|
|
|
113
|
113
|
|
|
|
|
2775
|
my $pinto = Pinto->new( root => $args{root} ); |
|
114
|
|
|
|
|
|
|
|
|
115
|
113
|
|
|
|
|
2422
|
$pinto->repo->db->deploy; |
|
116
|
|
|
|
|
|
|
|
|
117
|
113
|
|
|
|
|
12869
|
return; |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub _create_stack { |
|
123
|
113
|
|
|
113
|
|
620
|
my ( $self, %args ) = @_; |
|
124
|
|
|
|
|
|
|
|
|
125
|
113
|
|
100
|
|
|
1209
|
my $stack = $args{stack} || 'master'; |
|
126
|
113
|
100
|
|
|
|
528
|
my $is_default = $args{no_default} ? 0 : 1; |
|
127
|
113
|
|
|
|
|
3532
|
my $pinto = Pinto->new( root => $args{root} ); |
|
128
|
|
|
|
|
|
|
|
|
129
|
113
|
|
|
|
|
884
|
$pinto->run( New => ( stack => $stack, default => $is_default ) ); |
|
130
|
|
|
|
|
|
|
|
|
131
|
113
|
|
|
|
|
2941
|
return; |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
__END__ |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=pod |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=encoding UTF-8 |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=for :stopwords Jeffrey Ryan Thalhammer |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 NAME |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Pinto::Initializer - Initializes a new Pinto repository |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 VERSION |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
version 0.14 |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 AUTHOR |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Jeffrey Ryan Thalhammer <jeff@stratopan.com> |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer. |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
167
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=cut |