| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Clustericious::Command::configure; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
586
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
25
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
19
|
|
|
5
|
1
|
|
|
1
|
|
13
|
use 5.010; |
|
|
1
|
|
|
|
|
2
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use Mojo::Base 'Clustericious::Command'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
7
|
1
|
|
|
1
|
|
356
|
use Path::Class qw( dir ); |
|
|
1
|
|
|
|
|
307
|
|
|
|
1
|
|
|
|
|
298
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Generate a default configuration. |
|
10
|
|
|
|
|
|
|
our $VERSION = '1.27'; # VERSION |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has description => <<EOT; |
|
14
|
|
|
|
|
|
|
Write default configuration files. |
|
15
|
|
|
|
|
|
|
EOT |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has usage => <<EOT; |
|
18
|
|
|
|
|
|
|
usage $0: configure |
|
19
|
|
|
|
|
|
|
EOT |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub run |
|
22
|
|
|
|
|
|
|
{ |
|
23
|
0
|
|
|
0
|
1
|
|
my($self, @args) = @_; |
|
24
|
|
|
|
|
|
|
|
|
25
|
0
|
|
0
|
|
|
|
my $root = dir($ENV{CLUSTERICIOUS_CONF_DIR} || $ENV{HOME}); |
|
26
|
0
|
|
|
|
|
|
my $conf = $self->app->generate_config(@args); |
|
27
|
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
for my $d (@{$conf->{dirs} || []}) { |
|
|
0
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $dir = dir($root, @$d); |
|
30
|
0
|
0
|
|
|
|
|
-d $dir and do { say "-> exists : $dir"; next; }; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my @made = $dir->mkpath; |
|
32
|
0
|
|
|
|
|
|
say "-> mkdir $_" for @made; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my $config_root = dir($root)->subdir('etc'); |
|
36
|
0
|
|
|
|
|
|
for my $filename (keys %{$conf->{files}}) { |
|
|
0
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my $file = $config_root->file($filename); |
|
38
|
0
|
0
|
|
|
|
|
-e $file and do { |
|
39
|
0
|
|
|
|
|
|
say "-> exists : $file"; |
|
40
|
0
|
|
|
|
|
|
next; |
|
41
|
|
|
|
|
|
|
}; |
|
42
|
0
|
|
|
|
|
|
say "-> write $file"; |
|
43
|
0
|
|
|
|
|
|
$file->spew($conf->{files}{$filename}); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
1; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=pod |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=encoding UTF-8 |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NAME |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Clustericious::Command::configure - Generate a default configuration. |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 VERSION |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
version 1.27 |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Your app: |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
package YourApp; |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
use Mojo::Base qw( Clustericious::App ); |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub generate_config |
|
74
|
|
|
|
|
|
|
{ |
|
75
|
|
|
|
|
|
|
my ($self, @args) = @_; |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
return { |
|
78
|
|
|
|
|
|
|
dirs => [ |
|
79
|
|
|
|
|
|
|
['etc'], |
|
80
|
|
|
|
|
|
|
['var', 'run' ] |
|
81
|
|
|
|
|
|
|
], |
|
82
|
|
|
|
|
|
|
files => { 'YourApp.conf' => <<<CUT } |
|
83
|
|
|
|
|
|
|
--- |
|
84
|
|
|
|
|
|
|
required_key : default_value |
|
85
|
|
|
|
|
|
|
something_else : <%= home %> |
|
86
|
|
|
|
|
|
|
CUT |
|
87
|
|
|
|
|
|
|
}; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Create a default configuration for an app. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
L<Clustericious> |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 AUTHOR |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Original author: Brian Duggan |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Current maintainer: Graham Ollis E<lt>plicease@cpan.orgE<gt> |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Contributors: |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Curt Tilmes |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Yanick Champoux |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This software is copyright (c) 2013 by NASA GSFC. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
117
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |