| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
1996
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
69
|
|
|
2
|
2
|
|
|
2
|
|
17
|
use warnings; |
|
|
2
|
|
|
|
|
23
|
|
|
|
2
|
|
|
|
|
122
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package App::PM::Website::Command::Init; |
|
5
|
|
|
|
|
|
|
{ |
|
6
|
|
|
|
|
|
|
$App::PM::Website::Command::Init::VERSION = '0.131611'; |
|
7
|
|
|
|
|
|
|
} |
|
8
|
2
|
|
|
2
|
|
10
|
use base 'App::PM::Website::Command'; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
199
|
|
|
9
|
2
|
|
|
2
|
|
1814
|
use YAML::Any; |
|
|
2
|
|
|
|
|
2148
|
|
|
|
2
|
|
|
|
|
12
|
|
|
10
|
2
|
|
|
2
|
|
2753
|
use File::Spec; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
128
|
|
|
11
|
2
|
|
|
2
|
|
11
|
use File::Path 2.07 qw(make_path); |
|
|
2
|
|
|
|
|
77
|
|
|
|
2
|
|
|
|
|
121
|
|
|
12
|
2
|
|
|
2
|
|
11
|
use Data::Dumper; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
1059
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#ABSTRACT: create skeleton config/pm-website.yaml |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub options |
|
17
|
|
|
|
|
|
|
{ |
|
18
|
0
|
|
|
0
|
0
|
|
my ($class, $app) = @_; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
return ( |
|
21
|
0
|
|
|
|
|
|
[ 'username' => 'pm.org username', |
|
22
|
|
|
|
|
|
|
{ default => 'USERNAME' } |
|
23
|
|
|
|
|
|
|
], |
|
24
|
|
|
|
|
|
|
[ 'groupname' => 'long city name of monger group', |
|
25
|
|
|
|
|
|
|
{ default => 'GROUPNAME' } |
|
26
|
|
|
|
|
|
|
], |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
return |
|
29
|
0
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub validate |
|
32
|
|
|
|
|
|
|
{ |
|
33
|
0
|
|
|
0
|
0
|
|
my ($self, $opt, $args ) = @_; |
|
34
|
0
|
0
|
|
|
|
|
die $self->usage_error( "no arguments allowed") if @$args; |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
return 1; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _create_config_dir |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
0
|
|
|
0
|
|
|
my ( $self, $opt, $config_file) = @_; |
|
42
|
|
|
|
|
|
|
# get path from $config_file, check that path exists as directory |
|
43
|
|
|
|
|
|
|
{ |
|
44
|
|
|
|
|
|
|
#TODO: use File::Basename, File::Dirname |
|
45
|
0
|
|
|
|
|
|
my ( $volume, $directories, $file ) |
|
|
0
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
= File::Spec->splitpath($config_file); |
|
47
|
0
|
|
|
|
|
|
my $config_dir = File::Spec->catpath( $volume, $directories ); |
|
48
|
0
|
0
|
|
|
|
|
if ( !-d $config_dir ) |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
0
|
0
|
|
|
|
|
die "config_dir: $config_dir exists and is not a dir" |
|
51
|
|
|
|
|
|
|
if -e $config_dir; |
|
52
|
0
|
0
|
|
|
|
|
print "creating config directory: $config_dir\n" |
|
53
|
|
|
|
|
|
|
if $opt->{verbose}; |
|
54
|
0
|
|
|
|
|
|
make_path($config_dir); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub _create_config_file |
|
60
|
|
|
|
|
|
|
{ |
|
61
|
0
|
|
|
0
|
|
|
my ( $self, $opt, $config_file ) = @_; |
|
62
|
0
|
0
|
|
|
|
|
open my $config_fh, '>', $config_file |
|
63
|
|
|
|
|
|
|
or die "failed to open config_file:$config_file for writing: $!"; |
|
64
|
0
|
|
|
|
|
|
my $groupname = $opt->groupname; |
|
65
|
0
|
|
|
|
|
|
my $username = $opt->username; |
|
66
|
0
|
|
|
|
|
|
my $yaml = <<"EOYAML"; |
|
67
|
|
|
|
|
|
|
--- |
|
68
|
|
|
|
|
|
|
config: |
|
69
|
|
|
|
|
|
|
website: |
|
70
|
|
|
|
|
|
|
certificate: cacert.pem |
|
71
|
|
|
|
|
|
|
machine: groups.pm.org |
|
72
|
|
|
|
|
|
|
url: https://groups.pm.org/groups/$groupname/ |
|
73
|
|
|
|
|
|
|
username: $username |
|
74
|
|
|
|
|
|
|
template_dir: |
|
75
|
|
|
|
|
|
|
build_dir: |
|
76
|
|
|
|
|
|
|
location: |
|
77
|
|
|
|
|
|
|
default: |
|
78
|
|
|
|
|
|
|
address: |
|
79
|
|
|
|
|
|
|
name: |
|
80
|
|
|
|
|
|
|
url: |
|
81
|
|
|
|
|
|
|
presenter: |
|
82
|
|
|
|
|
|
|
default: |
|
83
|
|
|
|
|
|
|
cpan: cpan username |
|
84
|
|
|
|
|
|
|
description: |
|
85
|
|
|
|
|
|
|
github: github username |
|
86
|
|
|
|
|
|
|
name: |
|
87
|
|
|
|
|
|
|
url: |
|
88
|
|
|
|
|
|
|
meetings: |
|
89
|
|
|
|
|
|
|
- event_date: 2012/06/14 |
|
90
|
|
|
|
|
|
|
location: default |
|
91
|
|
|
|
|
|
|
open_call: 1 |
|
92
|
|
|
|
|
|
|
presentations: |
|
93
|
|
|
|
|
|
|
- abstract: 'our first talk will be about #winning' |
|
94
|
|
|
|
|
|
|
presenter: default |
|
95
|
|
|
|
|
|
|
title: first |
|
96
|
|
|
|
|
|
|
- abstract: our first talk will be about App::PM::Website |
|
97
|
|
|
|
|
|
|
presenter: default |
|
98
|
|
|
|
|
|
|
title: second talk |
|
99
|
|
|
|
|
|
|
EOYAML |
|
100
|
0
|
|
|
|
|
|
print $config_fh $yaml; |
|
101
|
0
|
|
|
|
|
|
close $config_fh; |
|
102
|
0
|
|
|
|
|
|
print "creating new config file: $config_file\n"; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub validate_config |
|
106
|
|
|
|
|
|
|
{ |
|
107
|
0
|
|
|
0
|
0
|
|
my ( $self, $opt, $args ) = @_; |
|
108
|
0
|
|
|
|
|
|
my $config_file = $opt->{config_file}; |
|
109
|
0
|
0
|
|
|
|
|
if ( !-e $config_file ) |
|
110
|
|
|
|
|
|
|
{ |
|
111
|
0
|
|
|
|
|
|
$self->_create_config_dir( $opt, $config_file ); |
|
112
|
0
|
|
|
|
|
|
$self->_create_config_file( $opt, $config_file ); |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
else |
|
115
|
|
|
|
|
|
|
{ |
|
116
|
0
|
|
|
|
|
|
print "config file already exists: $config_file\n"; |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub execute |
|
121
|
|
|
|
|
|
|
{ |
|
122
|
0
|
|
|
0
|
1
|
|
my( $self, $opt, $args ) = @_; |
|
123
|
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
$self->{config} |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
__PACKAGE__ |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
__END__ |