[Bps-public-commit] r17321 - in Prophet/trunk: . lib/Prophet/CLI/Command lib/Prophet/Server t
jesse at bestpractical.com
jesse at bestpractical.com
Tue Dec 23 22:54:51 EST 2008
Author: jesse
Date: Tue Dec 23 22:54:50 2008
New Revision: 17321
Modified:
Prophet/trunk/Makefile.PL
Prophet/trunk/lib/Prophet/CLI/Command/Publish.pm
Prophet/trunk/lib/Prophet/Server.pm
Prophet/trunk/lib/Prophet/Server/View.pm
Prophet/trunk/t/01-dependencies.t
Log:
* Fix spurious test fails.
Modified: Prophet/trunk/Makefile.PL
==============================================================================
--- Prophet/trunk/Makefile.PL (original)
+++ Prophet/trunk/Makefile.PL Tue Dec 23 22:54:50 2008
@@ -50,6 +50,11 @@
-default => 1,
'Term::ReadKey'
],
+ 'SQLite replica support' => [
+ -default => 1,
+ 'DBI' => 1,
+ 'DBD::SQLite' => 1
+ ],
'Subversion replica support' => [
-default => 0,
'SVN::Core', # SVN::Repos SVN::Fs SVN::Ra SVN::Delta::Editor SVN::Client SVN::Delta
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 Tue Dec 23 22:54:50 2008
@@ -72,8 +72,16 @@
my $self = shift;
my $dir = shift;
- require Prophet::Server::View;
- Template::Declare->init(roots => __PACKAGE__->view_classes);
+ require Prophet::Server;
+ my $server_class = ref($self->app_handle) . "::Server";
+ if (!$self->app_handle->try_to_require($server_class)) {
+ $server_class = "Prophet::Server";
+ }
+ my $server = $server_class->new();
+ $server->app_handle( $self->app_handle );
+ $server->setup_template_roots();
+
+
# allow user to specify a specific type to render
my @types = $self->type || $self->types_to_render;
@@ -86,12 +94,12 @@
$records->matching(sub { 1 });
open (my $fh, '>',File::Spec->catdir($subdir => 'index.html'));
- print { $fh } Template::Declare->show('record_table' => $records);
+ print { $fh } $server->render_template('record_table' => $records);
close $fh;
for my $record ($records->items) {
open (my $fh, '>',File::Spec->catdir($subdir => $record->uuid.'.html'));
- print { $fh } Template::Declare->show('record' => $record);
+ print { $fh } $server->render_template('record' => $record);
}
}
}
Modified: Prophet/trunk/lib/Prophet/Server.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Server.pm (original)
+++ Prophet/trunk/lib/Prophet/Server.pm Tue Dec 23 22:54:50 2008
@@ -231,13 +231,21 @@
sub show_template {
my $self = shift;
my $p = shift;
+ my $content = $self->render_template($p);
+ if ($content) { return $self->send_content( content_type => 'text/html', content => $content,);}
+ return undef;
+}
+
+sub render_template {
+ my $self = shift;
+ my $p = shift;
if ( Template::Declare->has_template($p) ) {
$self->view_class->app_handle( $self->app_handle );
$self->view_class->cgi( $self->cgi );
$self->view_class->nav( $self->nav);
$self->view_class->server($self);
my $content = Template::Declare->show($p, at _);
- return $self->send_content( content_type => 'text/html', content => $content,);
+ return $content;
}
return undef;
}
Modified: Prophet/trunk/lib/Prophet/Server/View.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Server/View.pm (original)
+++ Prophet/trunk/lib/Prophet/Server/View.pm Tue Dec 23 22:54:50 2008
@@ -94,8 +94,7 @@
template footer => sub { };
template header => sub {
my $self = shift;
- my $args = shift;
- my $title = shift @$args;
+ my $title = shift;
if ($self->nav) {
div { { class is 'page-nav'};
outs_raw($self->nav->render_as_menubar)
Modified: Prophet/trunk/t/01-dependencies.t
==============================================================================
--- Prophet/trunk/t/01-dependencies.t (original)
+++ Prophet/trunk/t/01-dependencies.t Tue Dec 23 22:54:50 2008
@@ -61,7 +61,7 @@
for ( sort keys %used ) {
my $first_in = Module::CoreList->first_release($_);
next if defined $first_in and $first_in <= 5.00803;
- next if /^(SVB|Prophet|inc|t)(::|$)/;
+ next if /^(SVB|App::WebToy|Prophet|inc|t)(::|$)/;
#warn $_;
ok( exists $required{$_}, "$_ in Makefile.PL" )
More information about the Bps-public-commit
mailing list