line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Build::IkiWiki; |
2
|
3
|
|
|
3
|
|
32467
|
use base qw(Module::Build); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
5081
|
|
3
|
3
|
|
|
3
|
|
378807
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
59
|
|
4
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
70
|
|
5
|
3
|
|
|
3
|
|
14
|
use Carp; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
198
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
18
|
use File::Basename; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
199
|
|
8
|
3
|
|
|
3
|
|
30
|
use File::Spec; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1540
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.0.3'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# flag for fake installations |
13
|
|
|
|
|
|
|
my $_fake_install = 0; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Module implementation here |
16
|
|
|
|
|
|
|
sub new { |
17
|
|
|
|
|
|
|
my ($class,@params) = @_; |
18
|
|
|
|
|
|
|
my $self = $class->SUPER::new( @params ); |
19
|
|
|
|
|
|
|
my $prop = $self->_get_prop(); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my %ikiwiki_paths = ( |
22
|
|
|
|
|
|
|
'templates' => q(/usr/share/ikiwiki/templates), |
23
|
|
|
|
|
|
|
'css' => q(/usr/share/ikiwiki/basewiki), |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# checking default values |
27
|
|
|
|
|
|
|
if (not defined ($prop->{ ikiwiki_paths } )) { |
28
|
|
|
|
|
|
|
$prop->{ ikiwiki_paths } = \%ikiwiki_paths; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
foreach my $other qw(ikiwiki_templates ikiwiki_css) { |
31
|
|
|
|
|
|
|
if (not exists $prop->{ $other }) { |
32
|
|
|
|
|
|
|
$prop->{ $other } = []; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return $self; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub ACTION_install { |
40
|
|
|
|
|
|
|
my ($self,@params) = @_; |
41
|
|
|
|
|
|
|
my $prop = $self->_get_prop(); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
if (not $_fake_install) { |
44
|
|
|
|
|
|
|
$self->SUPER::ACTION_install( @params ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# process the new file types |
48
|
|
|
|
|
|
|
foreach my $category qw(templates css) { |
49
|
|
|
|
|
|
|
# get the final list |
50
|
|
|
|
|
|
|
my @source_files = @{ $prop->{ "ikiwiki_${category}" } }; |
51
|
|
|
|
|
|
|
my $dest_dir = $self->destdir() || ''; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
if (@source_files) { |
54
|
|
|
|
|
|
|
# get the target directory |
55
|
|
|
|
|
|
|
my $target_dir = File::Spec->catdir( |
56
|
|
|
|
|
|
|
$dest_dir, |
57
|
|
|
|
|
|
|
$prop->{ikiwiki_paths}->{$category} |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# install the source files |
61
|
|
|
|
|
|
|
foreach my $source (@source_files) { |
62
|
|
|
|
|
|
|
my $to_file = File::Spec->catdir($target_dir, |
63
|
|
|
|
|
|
|
scalar fileparse( $source ) ); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
if ($_fake_install) { |
66
|
|
|
|
|
|
|
print "Installing ${to_file}\n"; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
else { |
69
|
|
|
|
|
|
|
$self->copy_if_modified( from => $source, |
70
|
|
|
|
|
|
|
to => $to_file ); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
return; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub ACTION_fakeinstall { |
80
|
|
|
|
|
|
|
my ($self,@params) = @_; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# first dispatch to up |
83
|
|
|
|
|
|
|
$self->SUPER::ACTION_fakeinstall( @params ); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# and now show our files |
86
|
|
|
|
|
|
|
$_fake_install = 1; |
87
|
|
|
|
|
|
|
$self->ACTION_install( @params ); |
88
|
|
|
|
|
|
|
$_fake_install = 0; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
return; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub _get_prop { |
94
|
|
|
|
|
|
|
my $self = shift; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
return $self->{ properties }; ##Violates 'ProhibitAccessOfPrivateData' |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
100
|
|
|
|
|
|
|
__END__ |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 NAME |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Module::Build::IkiWiki - Extension for develop Ikiwiki plugins |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 VERSION |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This document describes Module::Build::IkiWiki version 0.0.2 |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 SYNOPSIS |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
#!/usr/bin/perl |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
use Module::Build::IkiWiki; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
my $build = Module::Build::IkiWiki->new( |
117
|
|
|
|
|
|
|
module_name => 'xxxx', |
118
|
|
|
|
|
|
|
license => 'gpl', |
119
|
|
|
|
|
|
|
... |
120
|
|
|
|
|
|
|
ikiwiki_paths => { |
121
|
|
|
|
|
|
|
'templates' => q(/usr/share/ikiwiki/templates), |
122
|
|
|
|
|
|
|
'css' => q(/usr/share/ikiwiki/basewiki), |
123
|
|
|
|
|
|
|
}, |
124
|
|
|
|
|
|
|
ikiwiki_templates => [ glob('extras/*.tmpl') ], |
125
|
|
|
|
|
|
|
ikiwiki_stylesheets => [ glob('extras/*.css') ], |
126
|
|
|
|
|
|
|
); |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
$build->create_build_script(); |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 DESCRIPTION |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
The goal of this module is build and install IkiWiki plugins in Perl, |
133
|
|
|
|
|
|
|
subclassing the Module::Build and adding some extra funcionalites to it. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
For a description of the interface see L<Module::Build::API>. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This is a list of a new parameters in the Module::Build::new method: |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=over |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item ikiwiki_paths |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Define the install paths of the components using a hash with the following |
144
|
|
|
|
|
|
|
keys: |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=over |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item templates |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
The default value is F</usr/share/ikiwiki/templates>. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item css |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
The default value is F</usr/share/ikiwiki/basewiki>. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=back |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=item ikiwiki_templates |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
List of templates for install. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=item ikiwiki_stylesheets |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
List of css stylesheets files to install. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=back |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 new( ) |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Override the new method in the base class and check the special parameters for |
173
|
|
|
|
|
|
|
ikiwiki. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 ACTION_install( ) |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Install the template and css files of the package. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head2 ACTION_fakeinstall( ) |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Show the install actions to the standard output. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
The error messages are from the base class. This package don't generate any exceptions. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Module::Build::IkiWiki requires no configuration files or environment variables. |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=over |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=item L<Module::Build> |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=back |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
None reported. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
No bugs have been reported. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
208
|
|
|
|
|
|
|
C<bug-module-build-ikiwiki@rt.cpan.org>, or through the web interface at |
209
|
|
|
|
|
|
|
L<http://rt.cpan.org>. |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head1 AUTHOR |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Víctor Moral <victor@taquiones.net> |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
Copyright (C) 2008 <Victor Moral> |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
220
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
221
|
|
|
|
|
|
|
the Free Software Foundation; either version 2 of the License or |
222
|
|
|
|
|
|
|
any later version. |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
225
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
226
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
227
|
|
|
|
|
|
|
GNU General Public License for more details. |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along |
230
|
|
|
|
|
|
|
with this program; if not, write to the Free Software Foundation, Inc., |
231
|
|
|
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
232
|
|
|
|
|
|
|
|