From b21297f6515710f70f8e6ba9520546bfc5303214 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Tue, 8 Sep 2015 23:32:35 -0500 Subject: [PATCH] move daemon build inside the mojo app This is better encapsulation, and removes a strange bit of the test. There's something to be said about having a Statocles site as a Mojolicious app as well. --- lib/Statocles/Command.pm | 4 +++- t/command/mojo_app.t | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Statocles/Command.pm b/lib/Statocles/Command.pm index 93ef5b7e..5a2657aa 100644 --- a/lib/Statocles/Command.pm +++ b/lib/Statocles/Command.pm @@ -126,7 +126,6 @@ sub main { GetOptionsFromArray( \@argv, \%build_opt, 'date|d=s', ); - $cmd->site->build( %build_opt ); require Mojo::Server::Daemon; my $app = Statocles::Command::_MOJOAPP->new( @@ -433,6 +432,9 @@ sub bundle_theme { my ( $self ) = @_; $self->log( $self->site->log ); + # First build the site + $self->site->build( %{ $self->options } ); + my $base; if ( $self->site->base_url ) { $base = Mojo::URL->new( $self->site->base_url )->path->to_string; diff --git a/t/command/mojo_app.t b/t/command/mojo_app.t index 93e033d6..0e9ebd6a 100644 --- a/t/command/mojo_app.t +++ b/t/command/mojo_app.t @@ -15,7 +15,6 @@ my ( $tmp, $config_fn, $config ) = build_temp_site( $SHARE_DIR ); subtest 'root site' => sub { my $site = Beam::Wire->new( file => "$config_fn" )->get( 'site' ); - $site->build; my $t = Test::Mojo->new( Statocles::Command::_MOJOAPP->new(