line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Rudesind::Build; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
71
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
7
|
use base 'Module::Build'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2441
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
160891
|
use File::Basename (); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
13
|
|
8
|
1
|
|
|
1
|
|
5
|
use File::Copy (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
15
|
|
9
|
1
|
|
|
1
|
|
5
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
843
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub get_html_dir |
12
|
|
|
|
|
|
|
{ |
13
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my $default; |
16
|
0
|
|
|
|
|
|
foreach my $d ( qw( /var/www |
17
|
|
|
|
|
|
|
/usr/local/apache/htdocs |
18
|
|
|
|
|
|
|
/usr/local/htdocs |
19
|
|
|
|
|
|
|
/opt/apache/htdocs |
20
|
|
|
|
|
|
|
) |
21
|
|
|
|
|
|
|
) |
22
|
|
|
|
|
|
|
{ |
23
|
0
|
0
|
|
|
|
|
if ( -d $d ) |
24
|
|
|
|
|
|
|
{ |
25
|
0
|
|
|
|
|
|
$default = "$d/Rudesind"; |
26
|
0
|
|
|
|
|
|
last; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $dir = |
31
|
|
|
|
|
|
|
$self->prompt( 'Where do you want the Mason components ' |
32
|
|
|
|
|
|
|
. 'for Rudesind installed?', $default ); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
$self->notes( Rudesind_root => $dir ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub get_config_dir |
38
|
|
|
|
|
|
|
{ |
39
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my $config = eval { require Rudesind::Config; Rudesind::Config->new }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
if ($config) |
44
|
|
|
|
|
|
|
{ |
45
|
0
|
|
|
|
|
|
print "\n"; |
46
|
0
|
|
|
|
|
|
print 'You seem to have an existing Rudesind config file ' |
47
|
|
|
|
|
|
|
. $config->config_file . ".\n"; |
48
|
0
|
|
|
|
|
|
print "No boilerplate configuration file will be installed.\n"; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
print "\n"; |
54
|
0
|
|
|
|
|
|
my $dir = |
55
|
|
|
|
|
|
|
$self->prompt( 'Where do you want the boilerplate Rudesind '. |
56
|
|
|
|
|
|
|
' configuration file installed?', |
57
|
|
|
|
|
|
|
'/etc/Rudesind', |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
$self->notes( Rudesind_config_dir => $dir ); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub ACTION_install |
64
|
|
|
|
|
|
|
{ |
65
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
$self->SUPER::ACTION_install(@_); |
68
|
0
|
|
|
|
|
|
$self->dispatch('install_htdocs'); |
69
|
0
|
|
|
|
|
|
$self->dispatch('make_image_dirs'); |
70
|
0
|
|
|
|
|
|
$self->dispatch('write_config_file'); |
71
|
|
|
|
|
|
|
# $self->dispatch('print_apache_config'); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub ACTION_install_htdocs |
75
|
|
|
|
|
|
|
{ |
76
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Don't use "use", or we'll short-circuit attempts to figure out |
79
|
|
|
|
|
|
|
# this distro's prereqs. |
80
|
0
|
|
|
|
|
|
require File::Find::Rule; |
81
|
0
|
|
|
|
|
|
my $rule = File::Find::Rule->new; |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
my @files = |
84
|
|
|
|
|
|
|
$rule->or( $rule->new |
85
|
|
|
|
|
|
|
->directory |
86
|
|
|
|
|
|
|
->name('.svn') |
87
|
|
|
|
|
|
|
->prune |
88
|
|
|
|
|
|
|
->discard, |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
$rule->new |
91
|
|
|
|
|
|
|
->directory |
92
|
|
|
|
|
|
|
->name('images') |
93
|
|
|
|
|
|
|
->prune |
94
|
|
|
|
|
|
|
->discard, |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
$rule->new |
97
|
|
|
|
|
|
|
->directory |
98
|
|
|
|
|
|
|
->name('image-cache') |
99
|
|
|
|
|
|
|
->prune |
100
|
|
|
|
|
|
|
->discard, |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
$rule->new |
103
|
|
|
|
|
|
|
->name(qr/~$/) |
104
|
|
|
|
|
|
|
->prune |
105
|
|
|
|
|
|
|
->discard, |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
$rule->new, |
108
|
|
|
|
|
|
|
)->file->in('htdocs'); |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
foreach my $file (@files) |
112
|
|
|
|
|
|
|
{ |
113
|
0
|
|
|
|
|
|
my $dir = File::Basename::dirname($file); |
114
|
0
|
|
|
|
|
|
$dir =~ s:.*htdocs::; |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
my $to = |
117
|
|
|
|
|
|
|
File::Spec->catfile( $self->notes('Rudesind_root'), |
118
|
|
|
|
|
|
|
$dir, |
119
|
|
|
|
|
|
|
File::Basename::basename($file) ); |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
$self->copy_if_modified( from => $file, |
122
|
|
|
|
|
|
|
to => $to, |
123
|
|
|
|
|
|
|
flatten => 1, |
124
|
|
|
|
|
|
|
); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub ACTION_make_image_dirs |
129
|
|
|
|
|
|
|
{ |
130
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
131
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
foreach my $d ( qw( images image-cache ) ) |
133
|
|
|
|
|
|
|
{ |
134
|
0
|
|
|
|
|
|
my $dir = File::Spec->catdir( $self->notes('Rudesind_root'), $d ); |
135
|
|
|
|
|
|
|
|
136
|
0
|
0
|
|
|
|
|
unless ( -d $dir ) |
137
|
|
|
|
|
|
|
{ |
138
|
0
|
|
|
|
|
|
print "Creating $dir directory.\n"; |
139
|
|
|
|
|
|
|
|
140
|
0
|
0
|
|
|
|
|
mkdir $dir, 0755 |
141
|
|
|
|
|
|
|
or die "Cannot make dir $dir: $!"; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub ACTION_write_config_file |
147
|
|
|
|
|
|
|
{ |
148
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
149
|
|
|
|
|
|
|
|
150
|
0
|
|
|
|
|
|
my $dir = $self->notes('Rudesind_config_dir'); |
151
|
|
|
|
|
|
|
|
152
|
0
|
0
|
|
|
|
|
return unless defined $dir; |
153
|
|
|
|
|
|
|
|
154
|
0
|
|
|
|
|
|
File::Path::mkpath( $dir, 0, 0755 ); |
155
|
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
|
my $file = File::Spec->catfile( $dir, 'Rudesind.conf' ); |
157
|
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
|
print "Writing boilerplate config file at $file. You may want to edit this.\n"; |
159
|
|
|
|
|
|
|
|
160
|
0
|
0
|
|
|
|
|
open my $fh, ">$file" |
161
|
|
|
|
|
|
|
or die "Cannot write to $file: $!"; |
162
|
0
|
0
|
|
|
|
|
print $fh $self->_config_boilerplate |
163
|
|
|
|
|
|
|
or die "Cannot write to $file: $!"; |
164
|
0
|
|
|
|
|
|
close $fh; |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub _config_boilerplate |
168
|
|
|
|
|
|
|
{ |
169
|
0
|
|
|
0
|
|
|
my $self = shift; |
170
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
|
my $root = $self->notes('Rudesind_root'); |
172
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
return <<"EOF"; |
174
|
|
|
|
|
|
|
# |
175
|
|
|
|
|
|
|
# The root_dir parameter is the directory under which Rudesind's Mason |
176
|
|
|
|
|
|
|
# components are stored, as well as the images to be displayed, and |
177
|
|
|
|
|
|
|
# cached images created by Rudesind. The image directories will need |
178
|
|
|
|
|
|
|
# to be accessible via your web server. It is required. |
179
|
|
|
|
|
|
|
# |
180
|
|
|
|
|
|
|
# You should not change this unless you have manually moved the files |
181
|
|
|
|
|
|
|
# located under this directory. |
182
|
|
|
|
|
|
|
# |
183
|
|
|
|
|
|
|
root_dir = $root |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
# |
186
|
|
|
|
|
|
|
# data_dir is used by Mason. It is required. |
187
|
|
|
|
|
|
|
# |
188
|
|
|
|
|
|
|
data_dir = /var/Rudesind-mason |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
# |
191
|
|
|
|
|
|
|
# All other parameters below are optional |
192
|
|
|
|
|
|
|
# |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
# |
195
|
|
|
|
|
|
|
# The uri_root is the root of the web URI by which Rudesind will be |
196
|
|
|
|
|
|
|
# accessed. This does not need to have any correspondence to the |
197
|
|
|
|
|
|
|
# root_dir, but it can. |
198
|
|
|
|
|
|
|
# |
199
|
|
|
|
|
|
|
# Defaults to /Rudesind |
200
|
|
|
|
|
|
|
# |
201
|
|
|
|
|
|
|
#uri_root = /Rudesind |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
# |
204
|
|
|
|
|
|
|
# The image_uri_root is the root of the web URI by which your images |
205
|
|
|
|
|
|
|
# will be served. The default should work under most configurations. |
206
|
|
|
|
|
|
|
# |
207
|
|
|
|
|
|
|
# Defaults to an empty string |
208
|
|
|
|
|
|
|
# |
209
|
|
|
|
|
|
|
#image_uri_root = |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
# |
212
|
|
|
|
|
|
|
# The raw_image_subdir is the directory under the root_dir in which |
213
|
|
|
|
|
|
|
# you will store your images. So if your root_dir is |
214
|
|
|
|
|
|
|
# /var/www/gallery, and your raw_image_subdir is images, Rudesind will |
215
|
|
|
|
|
|
|
# look for images on the filesystem at /var/www/gallery/images |
216
|
|
|
|
|
|
|
# |
217
|
|
|
|
|
|
|
# Defaults to images |
218
|
|
|
|
|
|
|
# |
219
|
|
|
|
|
|
|
#raw_image_subdir = images |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
# |
222
|
|
|
|
|
|
|
# The view parameter allows you to specify what set of Mason |
223
|
|
|
|
|
|
|
# components to be used by Rudesind when generating pages. |
224
|
|
|
|
|
|
|
# |
225
|
|
|
|
|
|
|
# Rudesind will look for a directory under /. |
226
|
|
|
|
|
|
|
# |
227
|
|
|
|
|
|
|
# If this is set to anything other than "default", it will fall back |
228
|
|
|
|
|
|
|
# to using "default" for any components which are not defined in the |
229
|
|
|
|
|
|
|
# other view directory, so you can selectively replace components. |
230
|
|
|
|
|
|
|
# |
231
|
|
|
|
|
|
|
# Defaults to default |
232
|
|
|
|
|
|
|
# |
233
|
|
|
|
|
|
|
# view = default |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
# |
236
|
|
|
|
|
|
|
# The charset parameter is used to determine the character set in the |
237
|
|
|
|
|
|
|
# header for pages Rudesind generates. |
238
|
|
|
|
|
|
|
# |
239
|
|
|
|
|
|
|
# Defaults to UTF-8 |
240
|
|
|
|
|
|
|
# |
241
|
|
|
|
|
|
|
# charset = UTF-8 |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
# |
244
|
|
|
|
|
|
|
# The tmp_dir is used for saving session files. |
245
|
|
|
|
|
|
|
# |
246
|
|
|
|
|
|
|
# Defaults to File::Spec->tmpdir |
247
|
|
|
|
|
|
|
# |
248
|
|
|
|
|
|
|
# tmp_dir = |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
# |
251
|
|
|
|
|
|
|
# The admin_password is used to protect the admin functions. If it is |
252
|
|
|
|
|
|
|
# not set, the only way to login as an admin will be through HTTP |
253
|
|
|
|
|
|
|
# basic auth. See the "ADMIN AUTHORIZATION" section of the Rudesind |
254
|
|
|
|
|
|
|
# docs (perldoc Rudesind) for details. |
255
|
|
|
|
|
|
|
# |
256
|
|
|
|
|
|
|
# Defaults to undef |
257
|
|
|
|
|
|
|
# |
258
|
|
|
|
|
|
|
# admin_password = |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
# |
261
|
|
|
|
|
|
|
# The gallery_columns parameter controls how many columns of |
262
|
|
|
|
|
|
|
# thumbnails are shown when browsing a gallery. |
263
|
|
|
|
|
|
|
# |
264
|
|
|
|
|
|
|
# Defaults to 3 |
265
|
|
|
|
|
|
|
# |
266
|
|
|
|
|
|
|
# gallery_columns = 3 |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
# |
269
|
|
|
|
|
|
|
# The thumbnail_max_height parameter sets the maximum height, in |
270
|
|
|
|
|
|
|
# pixels, of thumbnail images. |
271
|
|
|
|
|
|
|
# |
272
|
|
|
|
|
|
|
# Defaults to 200 |
273
|
|
|
|
|
|
|
# |
274
|
|
|
|
|
|
|
# thumbnail_max_height = 200 |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
# |
277
|
|
|
|
|
|
|
# The thumbnail_max_width parameter sets the maximum width, in |
278
|
|
|
|
|
|
|
# pixels, of thumbnail images. |
279
|
|
|
|
|
|
|
# |
280
|
|
|
|
|
|
|
# Defaults to 200 |
281
|
|
|
|
|
|
|
# |
282
|
|
|
|
|
|
|
# thumbnail_max_width = 200 |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
# |
285
|
|
|
|
|
|
|
# The image_page_max_height parameter sets the maximum height, in |
286
|
|
|
|
|
|
|
# pixels, of image page images. |
287
|
|
|
|
|
|
|
# |
288
|
|
|
|
|
|
|
# Defaults to 400 |
289
|
|
|
|
|
|
|
# |
290
|
|
|
|
|
|
|
# image_page_max_height = 400 |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
# |
293
|
|
|
|
|
|
|
# The image_page_max_width parameter sets the maximum width, in |
294
|
|
|
|
|
|
|
# pixels, of image page images. |
295
|
|
|
|
|
|
|
# |
296
|
|
|
|
|
|
|
# Defaults to 500 |
297
|
|
|
|
|
|
|
# |
298
|
|
|
|
|
|
|
# image_page_max_width = 500 |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
# |
301
|
|
|
|
|
|
|
# The error_mode parameter is passed to Mason. Set this to output to |
302
|
|
|
|
|
|
|
# make debugging Rudesind easier. |
303
|
|
|
|
|
|
|
# |
304
|
|
|
|
|
|
|
# Defaults to fatal |
305
|
|
|
|
|
|
|
# |
306
|
|
|
|
|
|
|
# error_mode = fatal |
307
|
|
|
|
|
|
|
EOF |
308
|
|
|
|
|
|
|
} |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
1; |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
__END__ |