| 277 | | if ( $config->{root} ) { |
|---|
| 278 | | my $root = File::Spec->rel2abs( $config->{root} ); |
|---|
| 279 | | |
|---|
| 280 | | for my $option ( keys %default_paths ) { |
|---|
| 281 | | next if $config->{$option}; |
|---|
| 282 | | my $dir = File::Spec->catfile( $root, $default_paths{$option} ); |
|---|
| 283 | | |
|---|
| 284 | | if ( -d $dir ) { |
|---|
| 285 | | $config->{$option} = $dir; |
|---|
| 286 | | } else { |
|---|
| 287 | | warn "Could not set option '--$option=$dir': $!\n"; |
|---|
| | 277 | if ( $config->{root} ) { |
|---|
| | 278 | my $root = File::Spec->rel2abs( $config->{root} ); |
|---|
| | 279 | |
|---|
| | 280 | for my $option ( keys %default_paths ) { |
|---|
| | 281 | next if $config->{$option}; |
|---|
| | 282 | my $dir = File::Spec->catfile( $root, $default_paths{$option} ); |
|---|
| | 283 | |
|---|
| | 284 | if ( -d $dir ) { |
|---|
| | 285 | $config->{$option} = $dir; |
|---|
| | 286 | } else { |
|---|
| | 287 | warn "Could not set option '--$option=$dir': $!\n"; |
|---|
| | 288 | } |
|---|
| 299 | | if ( $config->{apache} ) { |
|---|
| 300 | | |
|---|
| 301 | | my $tt = Template->new( |
|---|
| 302 | | INCLUDE_PATH => File::Spec->catfile( $config->{src}, 'etc' ), |
|---|
| 303 | | ); |
|---|
| 304 | | |
|---|
| 305 | | my $stash = { |
|---|
| 306 | | %$config, |
|---|
| 307 | | script => $0, |
|---|
| 308 | | arguments => join( ' ', @argv ), |
|---|
| 309 | | }; |
|---|
| 310 | | |
|---|
| 311 | | my $template = $config->{template} || 'httpd.conf.tt'; |
|---|
| 312 | | |
|---|
| 313 | | $tt->process( $template, $stash ) || die $tt->error; |
|---|
| 314 | | |
|---|
| 315 | | exit 0; |
|---|
| 316 | | } |
|---|
| | 302 | |
|---|
| | 303 | if ( $config->{apache} ) { |
|---|
| | 304 | |
|---|
| | 305 | my $tt = Template->new( |
|---|
| | 306 | INCLUDE_PATH => File::Spec->catfile( $config->{src}, 'etc' ), |
|---|
| | 307 | ); |
|---|
| | 308 | |
|---|
| | 309 | my $stash = { |
|---|
| | 310 | %$config, |
|---|
| | 311 | script => $0, |
|---|
| | 312 | arguments => join( ' ', @argv ), |
|---|
| | 313 | }; |
|---|
| | 314 | |
|---|
| | 315 | my $template = $config->{template} || 'httpd.conf.tt'; |
|---|
| | 316 | |
|---|
| | 317 | $tt->process( $template, $stash ) || die $tt->error; |
|---|
| | 318 | |
|---|
| | 319 | exit 0; |
|---|
| | 320 | } |
|---|
| 325 | | my $generator = DocBuilder->new( $config ); |
|---|
| 326 | | |
|---|
| 327 | | $generator->pods( \@pod_files, 'swishsrc' ) if $config->swishsrc; |
|---|
| 328 | | $generator->website if $config->dest && !$config->podonly; |
|---|
| 329 | | |
|---|
| 330 | | $generator->pods( \@pod_files, 'develsrc' ) |
|---|
| 331 | | if $config->dest && $config->develsrc && !$config->podonly; |
|---|
| 332 | | |
|---|
| 333 | | |
|---|
| 334 | | |
|---|
| 335 | | exit $exit_value; |
|---|
| | 329 | my $generator = DocBuilder->new( $config ); |
|---|
| | 330 | |
|---|
| | 331 | # Generate the pods |
|---|
| | 332 | $generator->pods( \@pod_files, 'swishsrc' ) if $config->swishsrc; |
|---|
| | 333 | |
|---|
| | 334 | # Generate the website |
|---|
| | 335 | $generator->website if $config->dest && !$config->podonly; |
|---|
| | 336 | |
|---|
| | 337 | # Generate the development docs |
|---|
| | 338 | $generator->pods( \@pod_files, 'develsrc' ) |
|---|
| | 339 | if $config->dest && $config->develsrc && !$config->podonly; |
|---|
| | 340 | |
|---|
| | 341 | |
|---|
| | 342 | |
|---|
| | 343 | exit $exit_value; |
|---|
| 392 | | my $dest = File::Spec->rel2abs( $config->dest ); |
|---|
| 393 | | |
|---|
| 394 | | mkdir $dest unless -e $dest; |
|---|
| 395 | | |
|---|
| 396 | | die "destination directory [$dest] does not exist\n" unless -e $dest; |
|---|
| 397 | | die "destination directory [$dest] is not a directory\n" unless -d $dest; |
|---|
| 398 | | die "destination directory [$dest] is not writable\n" unless -w $dest; |
|---|
| 399 | | die "Source and destination cannot be the same\n" if $dest eq $topsrc_abs; |
|---|
| 400 | | warn "Destination directory set to [$dest]\n" if $config->verbose; |
|---|
| 401 | | |
|---|
| | 399 | die "Must specify either -dest (or -root) or -poddest\n" |
|---|
| | 400 | unless $config->dest || $config->poddest; |
|---|
| | 401 | |
|---|
| | 402 | |
|---|
| | 403 | my $dest; |
|---|
| | 404 | |
|---|
| | 405 | if ( $config->dest ) { |
|---|
| | 406 | $dest = File::Spec->rel2abs( $config->dest ); |
|---|
| | 407 | |
|---|
| | 408 | mkdir $dest unless -e $dest; |
|---|
| | 409 | |
|---|
| | 410 | die "destination directory [$dest] does not exist\n" unless -e $dest; |
|---|
| | 411 | die "destination directory [$dest] is not a directory\n" unless -d $dest; |
|---|
| | 412 | die "destination directory [$dest] is not writable\n" unless -w $dest; |
|---|
| | 413 | die "Source and destination cannot be the same\n" if $dest eq $topsrc_abs; |
|---|
| | 414 | warn "Destination directory set to [$dest]\n" if $config->verbose; |
|---|
| | 415 | } |
|---|
| 408 | | # Set podonly if pods are writting elsewhere (ie. $dest is not a substring of $poddest) |
|---|
| 409 | | # This is a bit important, if just scanning this code. |
|---|
| 410 | | # This ends up changing the OUTPUT_PATH |
|---|
| 411 | | |
|---|
| 412 | | if ( index( $poddest, $dest ) == -1 ) { |
|---|
| | 422 | # If the (website) dest directory is not set then assume we are |
|---|
| | 423 | # writing pods only. |
|---|
| | 424 | # Note: Used to check if the poddest was a sub-directory |
|---|
| | 425 | # of the dest directory, but that was when dest was automatically |
|---|
| | 426 | # set relative to $RealBin. |
|---|
| | 427 | |
|---|
| | 428 | unless ( $config->dest ) { |
|---|