line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
664
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
2
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
40
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Module::Starter::Plugin::RTx; |
5
|
1
|
|
|
1
|
|
4
|
use base 'Module::Starter::Simple'; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
929
|
|
6
|
1
|
|
|
1
|
|
15951
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
928
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub create_MI_RTx_Makefile_PL { |
10
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
11
|
0
|
|
0
|
|
|
|
my $main_module = shift || $self->{main_module}; |
12
|
0
|
|
|
|
|
|
my $fname = File::Spec->catfile( $self->{basedir}, 'Makefile.PL' ); |
13
|
0
|
|
|
|
|
|
$self->{main_module_file} = join( '/', 'lib', split /::/, $main_module ) . '.pm'; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
$self->create_file( |
16
|
|
|
|
|
|
|
$fname, |
17
|
|
|
|
|
|
|
<
|
18
|
|
|
|
|
|
|
use inc::Module::Install; |
19
|
|
|
|
|
|
|
RTx('$self->{distro}'); |
20
|
|
|
|
|
|
|
all_from('$self->{main_module_file}'); |
21
|
|
|
|
|
|
|
&WriteAll; |
22
|
|
|
|
|
|
|
EOF |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
$self->progress("Created $fname"); |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
return 'Makefile.PL'; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub create_build { |
31
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# get the builders |
34
|
0
|
|
|
|
|
|
my @builders = @{ $self->get_builders }; |
|
0
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my $builder_set = Module::Starter::BuilderSet->new(); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Remove mutually exclusive and unsupported builders |
38
|
0
|
|
|
|
|
|
@builders = $builder_set->check_compatibility(@builders); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# compile some build instructions, create a list of files generated |
41
|
|
|
|
|
|
|
# by the builders' create_* methods, and call said methods |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
return ( |
44
|
0
|
|
|
|
|
|
files => [ $self->create_MI_RTx_Makefile_PL ], |
45
|
|
|
|
|
|
|
instructions => join( "\n\n", $self->build_instructions ), |
46
|
|
|
|
|
|
|
manifest_method => 'create_MI_MANIFEST', |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub build_instructions { |
51
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
52
|
0
|
|
0
|
|
|
|
my $module = shift || $self->{main_module}; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my @out; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
push @out, 'To install this module, run the following commands:'; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my @commands = ( |
59
|
|
|
|
|
|
|
'perl Makefile.PL', |
60
|
|
|
|
|
|
|
'make', |
61
|
|
|
|
|
|
|
'make install', |
62
|
|
|
|
|
|
|
"make initdb # only if there is etc/initialdata and it hasn't been run before", |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
push @out, join( "\n", map { " $_" } @commands ); |
|
0
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
push @out, |
67
|
|
|
|
|
|
|
"add $module to \@Plugins in RT's etc/RT_SiteConfig.pm:", |
68
|
|
|
|
|
|
|
" Set( \@Plugins, qw(... $module) );"; |
69
|
0
|
|
|
|
|
|
return @out; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub create_distro { |
74
|
0
|
|
|
0
|
1
|
|
my $either = shift; |
75
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
|
( ref $either ) or $either = $either->new(@_); |
77
|
0
|
|
|
|
|
|
my $self = $either; |
78
|
0
|
|
0
|
|
|
|
my $modules = $self->{modules} || []; |
79
|
0
|
|
|
|
|
|
my @modules = map { split /,/ } @{$modules}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
80
|
0
|
0
|
|
|
|
|
croak "No modules specified.\n" unless @modules; |
81
|
0
|
|
|
|
|
|
for (@modules) { |
82
|
0
|
0
|
|
|
|
|
croak "Invalid module name: $_" unless /\A[a-z_]\w*(?:::[\w]+)*\Z/i; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
0
|
0
|
|
|
|
|
croak "Must specify an author\n" unless $self->{author}; |
86
|
0
|
0
|
|
|
|
|
croak "Must specify an email address\n" unless $self->{email}; |
87
|
0
|
|
|
|
|
|
( $self->{email_obfuscated} = $self->{email} ) =~ s/@/ at /; |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
0
|
|
|
|
$self->{license} ||= 'perl'; |
90
|
0
|
|
0
|
|
|
|
$self->{ignores_type} ||= 'generic'; |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
$self->{main_module} = $modules[0]; |
93
|
0
|
0
|
|
|
|
|
if ( not $self->{distro} ) { |
94
|
0
|
|
|
|
|
|
$self->{distro} = $self->{main_module}; |
95
|
0
|
|
|
|
|
|
$self->{distro} =~ s/::/-/g; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
0
|
|
|
|
$self->{basedir} = $self->{dir} || $self->{distro}; |
99
|
0
|
|
|
|
|
|
$self->create_basedir; |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
$self->create_modules(@modules); |
102
|
0
|
|
|
|
|
|
$self->create_ignores; |
103
|
0
|
|
|
|
|
|
my %build_results = $self->create_build(); |
104
|
0
|
|
|
|
|
|
$self->create_Changes; |
105
|
0
|
|
|
|
|
|
$self->create_README; |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
$self->create_MANIFEST( $build_results{'manifest_method'} ); |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
return; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub create_README { |
114
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
115
|
0
|
|
|
|
|
|
chdir $self->{basedir}; |
116
|
0
|
|
|
|
|
|
symlink( $self->{main_module_file}, 'README.pod' ); |
117
|
0
|
|
|
|
|
|
chdir '..'; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub _module_header { |
121
|
0
|
|
|
0
|
|
|
my $self = shift; |
122
|
0
|
|
|
|
|
|
my $module = shift; |
123
|
0
|
|
|
|
|
|
my $rtname = shift; |
124
|
0
|
|
|
|
|
|
my $content = <
|
125
|
|
|
|
|
|
|
use warnings; |
126
|
|
|
|
|
|
|
use strict; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
package $module; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
our \$VERSION = "0.01"; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
EOF |
133
|
0
|
|
|
|
|
|
return $content; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub module_guts { |
137
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
138
|
0
|
|
|
|
|
|
my $module = shift; |
139
|
0
|
|
|
|
|
|
my $rtname = shift; |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
# Sub-templates |
142
|
0
|
|
|
|
|
|
my $header = $self->_module_header( $module, $rtname ); |
143
|
0
|
|
|
|
|
|
my $install = join "\n\n", $self->build_instructions; |
144
|
0
|
|
|
|
|
|
my $license = $self->_module_license( $module, $rtname ); |
145
|
|
|
|
|
|
|
|
146
|
0
|
|
|
|
|
|
my $content = <<"HERE"; |
147
|
|
|
|
|
|
|
$header |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
1; |
150
|
|
|
|
|
|
|
__END__ |