line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Clustericious::Command::generate::app; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
568
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
5
|
1
|
|
|
1
|
|
5
|
use Clustericious; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
16
|
|
6
|
1
|
|
|
1
|
|
5
|
use Mojo::Base 'Clustericious::Command'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
7
|
1
|
|
|
1
|
|
116
|
use File::Find; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
329
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Clustericious command to generate a new Clustericious application |
10
|
|
|
|
|
|
|
our $VERSION = '1.27'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has description => <<'EOF'; |
14
|
|
|
|
|
|
|
Generate Clustericious app. |
15
|
|
|
|
|
|
|
EOF |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has usage => <<"EOF"; |
18
|
|
|
|
|
|
|
usage: $0 generate app [NAME] |
19
|
|
|
|
|
|
|
EOF |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _installfile |
22
|
|
|
|
|
|
|
{ |
23
|
0
|
|
|
0
|
|
|
my $self = shift; |
24
|
0
|
|
|
|
|
|
my ($templatedir, $file, $class) = @_; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my $name = lc $class; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
(my $relpath = $file) =~ s/^$templatedir/$class/; |
29
|
0
|
|
|
|
|
|
$relpath =~ s/APPCLASS/$class/g; |
30
|
0
|
|
|
|
|
|
$relpath =~ s/APPNAME/$name/g; |
31
|
|
|
|
|
|
|
|
32
|
0
|
0
|
|
|
|
|
return if -e $relpath; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $content = Mojo::Template->new->render_file( $file, $class ); |
35
|
0
|
|
|
|
|
|
$self->write_file($relpath, $content ); |
36
|
0
|
0
|
|
|
|
|
-x $file && $self->chmod_file($relpath, 0755); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub run |
40
|
|
|
|
|
|
|
{ |
41
|
0
|
|
|
0
|
1
|
|
my ($self, $class, @args ) = @_; |
42
|
0
|
|
0
|
|
|
|
$class ||= 'MyClustericiousApp'; |
43
|
0
|
0
|
|
|
|
|
if (@args % 2) { |
44
|
0
|
|
|
|
|
|
die "usage : $0 generate app <name>\n"; |
45
|
|
|
|
|
|
|
} |
46
|
0
|
|
|
|
|
|
my %args = @args; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $templatedir = Clustericious->_dist_dir->subdir('tmpl', '1.08', 'app'); |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
die "Can't find template.\n" unless -d $templatedir; |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
0
|
|
|
find({wanted => sub { $self->_installfile($templatedir, $_, $class) if -f }, |
53
|
0
|
|
|
|
|
|
no_chdir => 1}, $templatedir); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=pod |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=encoding UTF-8 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 NAME |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Clustericious::Command::generate::app - Clustericious command to generate a new Clustericious application |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 VERSION |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
version 1.27 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 SYNOPSIS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
% clustericious generate app Myapp |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 DESCRIPTION |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This command generates a new Clustericious application with the given name. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SEE ALSO |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
L<Clustericious> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 AUTHOR |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Original author: Brian Duggan |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Current maintainer: Graham Ollis E<lt>plicease@cpan.orgE<gt> |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Contributors: |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Curt Tilmes |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Yanick Champoux |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This software is copyright (c) 2013 by NASA GSFC. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
101
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |