[Bps-public-commit] r14937 - in Prophet/trunk: .
sartak at bestpractical.com
sartak at bestpractical.com
Sat Aug 9 11:27:30 EDT 2008
Author: sartak
Date: Sat Aug 9 11:27:30 2008
New Revision: 14937
Modified:
Prophet/trunk/ (props changed)
Prophet/trunk/lib/Prophet/CLI/Command/Publish.pm
Log:
r68992 at onn: sartak | 2008-08-09 11:27:25 -0400
Publish rendered templates into an html subdirectory
Modified: Prophet/trunk/lib/Prophet/CLI/Command/Publish.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/Command/Publish.pm (original)
+++ Prophet/trunk/lib/Prophet/CLI/Command/Publish.pm Sat Aug 9 11:27:30 2008
@@ -4,6 +4,8 @@
with 'Prophet::CLI::PublishCommand';
with 'Prophet::CLI::CollectionCommand';
+use Path::Class;
+
before run => sub {
my $self = shift;
die "Please specify a --to.\n" unless $self->has_arg('to');
@@ -17,17 +19,29 @@
my $orig = shift;
my $self = shift;
+ my $export_html = $self->has_arg('html');
+ my $export_replica = $self->has_arg('replica');
+
# if the user specifies nothing, then publish the replica
- $self->set_arg('replica' => 1)
- if !$self->has_arg('html');
+ $export_replica = 1 if !$export_html;
# if we have the html argument, populate the tempdir with rendered templates
- if ($self->has_arg('html')) {
- $self->render_templates_into($self->arg('path'));
+ if ($export_html) {
+ my $path = dir($self->arg('path'));
+
+ # if they specify both html and replica, then stick rendered templates
+ # into a subdirectory. if they specify only html, assume they really
+ # want to publish directly into the specified directory
+ if ($export_replica) {
+ $path = $path->subdir('html');
+ $path->mkpath;
+ }
+
+ $self->render_templates_into($path);
}
# otherwise, do the normal prophet export this replica
- if ($self->has_arg('replica')) {
+ if ($export_replica) {
$self->$orig(@_);
}
};
More information about the Bps-public-commit
mailing list