| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Hyper::Developer::Generator::Environment; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3634
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
56
|
|
|
4
|
1
|
|
|
1
|
|
48
|
use warnings; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
40
|
|
|
5
|
1
|
|
|
1
|
|
17
|
use version; our $VERSION = qv('0.01'); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
184
|
use base qw(Hyper::Developer::Generator); |
|
|
1
|
|
|
|
|
8
|
|
|
|
1
|
|
|
|
|
176
|
|
|
8
|
|
|
|
|
|
|
use Class::Std; |
|
9
|
|
|
|
|
|
|
use File::Path (); |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Hyper::Functions; |
|
12
|
|
|
|
|
|
|
use Hyper::Error; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub create { |
|
15
|
|
|
|
|
|
|
my $self = shift; |
|
16
|
|
|
|
|
|
|
my $arg_ref = shift; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $base_path = $self->get_base_path(); |
|
19
|
|
|
|
|
|
|
my $namespace = $self->get_namespace(); |
|
20
|
|
|
|
|
|
|
my $lc_path = Hyper::Functions::class_to_path(lc $namespace); |
|
21
|
|
|
|
|
|
|
my $template = $self->get_template(); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
File::Path::mkpath([ |
|
24
|
|
|
|
|
|
|
map { |
|
25
|
|
|
|
|
|
|
my $path = "$base_path/$_/$namespace"; |
|
26
|
|
|
|
|
|
|
$self->verbose_message("creating path >$path<"); |
|
27
|
|
|
|
|
|
|
$path; |
|
28
|
|
|
|
|
|
|
} qw(lib var etc t) |
|
29
|
|
|
|
|
|
|
], 0, 0770 |
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
for my $dir ( qw(cgi-bin htdocs bin) ) { |
|
34
|
|
|
|
|
|
|
my $path = "$base_path/$dir/$lc_path"; |
|
35
|
|
|
|
|
|
|
$self->verbose_message("creating path >$path<"); |
|
36
|
|
|
|
|
|
|
File::Path::mkpath([$path], 0, 0770); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Context.ini |
|
40
|
|
|
|
|
|
|
my $file = "$base_path/" |
|
41
|
|
|
|
|
|
|
. Hyper::Functions::get_path_for('config') |
|
42
|
|
|
|
|
|
|
. "/$namespace/Context.ini"; |
|
43
|
|
|
|
|
|
|
if ( $self->get_force() || ! -e $file ) { |
|
44
|
|
|
|
|
|
|
$self->verbose_message("creating initial context >$file<"); |
|
45
|
|
|
|
|
|
|
$template->process( |
|
46
|
|
|
|
|
|
|
"Generator/Environment/Context.ini.tpl", |
|
47
|
|
|
|
|
|
|
{ this => $self }, |
|
48
|
|
|
|
|
|
|
$file |
|
49
|
|
|
|
|
|
|
) or throw($template->error()); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
else { |
|
52
|
|
|
|
|
|
|
print STDERR "won't create >$file< - file already exists. use param force to overwrite\n"; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# index.pl |
|
56
|
|
|
|
|
|
|
$file = "$base_path/cgi-bin/$lc_path/index.pl"; |
|
57
|
|
|
|
|
|
|
if ( $self->get_force() || ! -e $file ) { |
|
58
|
|
|
|
|
|
|
$self->verbose_message("creating default cgi script >$file<"); |
|
59
|
|
|
|
|
|
|
$template->process( |
|
60
|
|
|
|
|
|
|
"Generator/Environment/index.pl.tpl", |
|
61
|
|
|
|
|
|
|
{ this => $self }, |
|
62
|
|
|
|
|
|
|
$file, |
|
63
|
|
|
|
|
|
|
) or throw($template->error()); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
else { |
|
66
|
|
|
|
|
|
|
print STDERR "won't create >$file< - file already exists. use param force to overwrite\n"; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# server.pl |
|
70
|
|
|
|
|
|
|
$file = "$base_path/bin/$lc_path/server.pl"; |
|
71
|
|
|
|
|
|
|
if ( $self->get_force() || ! -e $file ) { |
|
72
|
|
|
|
|
|
|
$self->verbose_message("creating default server >$file<"); |
|
73
|
|
|
|
|
|
|
$template->process( |
|
74
|
|
|
|
|
|
|
"Generator/Environment/server.pl.tpl", |
|
75
|
|
|
|
|
|
|
{ this => $self }, |
|
76
|
|
|
|
|
|
|
$file, |
|
77
|
|
|
|
|
|
|
) or throw($template->error()); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
else { |
|
80
|
|
|
|
|
|
|
print STDERR "won't create >$file< - file already exists. use param force to overwrite\n"; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
return $self; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__END__ |