Hello community, here is the log from the commit of package perl-Mojolicious-Plugin-AssetPack for openSUSE:Factory checked in at 2017-10-18 16:16:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-AssetPack (Old) and /work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-AssetPack.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "perl-Mojolicious-Plugin-AssetPack" Wed Oct 18 16:16:40 2017 rev:35 rq:534738 version:1.47 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-AssetPack/perl-Mojolicious-Plugin-AssetPack.changes 2017-10-03 23:17:40.671101518 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-AssetPack.new/perl-Mojolicious-Plugin-AssetPack.changes 2017-10-18 16:16:41.612151700 +0200 @@ -1,0 +2,9 @@ +Tue Oct 17 05:36:00 UTC 2017 - coolo@suse.com + +- updated to 1.47 + see /usr/share/doc/packages/perl-Mojolicious-Plugin-AssetPack/Changes + + 1.47 2017-10-14T18:58:55+0200 + - Dropping "original" from assetpack.db + +------------------------------------------------------------------- Old: ---- Mojolicious-Plugin-AssetPack-1.46.tar.gz New: ---- Mojolicious-Plugin-AssetPack-1.47.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojolicious-Plugin-AssetPack.spec ++++++ --- /var/tmp/diff_new_pack.q2tgfM/_old 2017-10-18 16:16:42.372116142 +0200 +++ /var/tmp/diff_new_pack.q2tgfM/_new 2017-10-18 16:16:42.372116142 +0200 @@ -17,7 +17,7 @@ Name: perl-Mojolicious-Plugin-AssetPack -Version: 1.46 +Version: 1.47 Release: 0 %define cpan_name Mojolicious-Plugin-AssetPack Summary: Compress and convert css, less, sass, javascript and coffeescript files ++++++ Mojolicious-Plugin-AssetPack-1.46.tar.gz -> Mojolicious-Plugin-AssetPack-1.47.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.46/Changes new/Mojolicious-Plugin-AssetPack-1.47/Changes --- old/Mojolicious-Plugin-AssetPack-1.46/Changes 2017-09-27 21:35:33.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-1.47/Changes 2017-10-14 18:58:55.000000000 +0200 @@ -1,5 +1,8 @@ Revision history for perl distribution Mojolicious-Plugin-AssetPack +1.47 2017-10-14T18:58:55+0200 + - Dropping "original" from assetpack.db + 1.46 2017-09-27T21:35:33+0200 - Add "asset_class" attribute to AssetPack::Store - Add rollupjs pipe - https://rollupjs.org/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.46/META.json new/Mojolicious-Plugin-AssetPack-1.47/META.json --- old/Mojolicious-Plugin-AssetPack-1.46/META.json 2017-09-27 21:35:34.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-1.47/META.json 2017-10-14 18:58:57.000000000 +0200 @@ -48,6 +48,6 @@ "url" : "https://github.com/jhthorsen/mojolicious-plugin-assetpack.git" } }, - "version" : "1.46", + "version" : "1.47", "x_serialization_backend" : "JSON::PP version 2.27400_02" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.46/META.yml new/Mojolicious-Plugin-AssetPack-1.47/META.yml --- old/Mojolicious-Plugin-AssetPack-1.46/META.yml 2017-09-27 21:35:34.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-1.47/META.yml 2017-10-14 18:58:56.000000000 +0200 @@ -25,5 +25,5 @@ bugtracker: https://github.com/jhthorsen/mojolicious-plugin-assetpack/issues homepage: https://github.com/jhthorsen/mojolicious-plugin-assetpack repository: https://github.com/jhthorsen/mojolicious-plugin-assetpack.git -version: '1.46' +version: '1.47' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.46/README new/Mojolicious-Plugin-AssetPack-1.47/README --- old/Mojolicious-Plugin-AssetPack-1.46/README 2017-09-27 21:35:33.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-1.47/README 2017-10-14 18:58:55.000000000 +0200 @@ -3,7 +3,7 @@ javascript and coffeescript files VERSION - 1.46 + 1.47 SYNOPSIS Application @@ -49,6 +49,15 @@ is delegated to "pipe objects". Please see "Pipes" in Mojolicious::Plugin::AssetPack::Guides::Tutorial for a complete list. +BREAKING CHANGES + assetpack.db (v1.47) + "assetpack.db" no longer track files downloaded from the internet. It + will mostly "just work", but in some cases version 1.47 might download + assets that have already been downloaded with AssetPack version 1.46 and + earlier. + + The goal is to remove "assetpack.db" completely. + GUIDES * Mojolicious::Plugin::AssetPack::Guides::Tutorial diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Asset.pm new/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Asset.pm --- old/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Asset.pm 2017-09-23 12:42:43.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Asset.pm 2017-10-14 18:41:40.000000000 +0200 @@ -79,8 +79,12 @@ } sub path { - $_[0]->_asset->isa('Mojo::Asset::File') ? Mojo::File->new($_[0]->_asset->path) : undef; + my $self = shift; + return $self->_asset(Mojo::Asset::File->new(path => $_[0])) if $_[0]; + return Mojo::File->new($self->_asset->path) if $self->_asset->isa('Mojo::Asset::File'); + return undef; } + sub size { $_[0]->_asset->size } sub url_for { $_[1]->url_for(assetpack => $_[0]->TO_JSON); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Guides/Tutorial.pod new/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Guides/Tutorial.pod --- old/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Guides/Tutorial.pod 2017-09-05 18:22:34.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Guides/Tutorial.pod 2017-10-14 18:41:40.000000000 +0200 @@ -26,7 +26,7 @@ $app->plugin(AssetPack => {pipes => [qw(Sass Css Combine)]}); Loading the plugin with the list above will enable AssetPack to process Sass -and Css files, minify them and combine them into a aingle asset in production. +and Css files, minify them and combine them into a single asset in production. =head2 Optional dependencies @@ -189,7 +189,7 @@ Moving the definition to an external file can be useful for keeping the application code tidy. The definition file should be located in the L<assets|Mojolicious::Plugin::AssetPack::Store/paths> directory, or optionally -defined it in the "DATA" section. section. The default file is called +defined it in the "DATA" section. The default file is called "assetpack.def" and will be looked up if LMojolicious::Plugin::AssetPack/process is called without arguments. Example file: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Pipe.pm new/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe.pm --- old/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Pipe.pm 2017-09-27 21:34:18.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Pipe.pm 2017-10-14 17:15:37.000000000 +0200 @@ -9,7 +9,7 @@ use Mojolicious::Plugin::AssetPack::Asset; use Mojolicious::Plugin::AssetPack::Util qw(diag has_ro DEBUG); -my $REQUIRE_JS = path(__FILE__)->dirname->child(qw(Pipe require.js)); +my $REQUIRE_JS = path(__FILE__)->dirname->child(qw(Pipe require.js))->realpath; $ENV{PATH} ||= ''; @@ -39,10 +39,10 @@ $apps = [$apps] unless ref $apps eq 'ARRAY'; for my $name (@$apps) { + return $self->{apps}{$name} if $self->{apps}{$name}; # Already found my $key = uc "MOJO_ASSETPACK_${name}_APP"; diag 'Looking for "%s" in $%s', $name, $key if DEBUG > 1; return $ENV{$key} if $ENV{$key}; # MOJO_ASSETPACK_FOO_APP wins - return $self->{apps}{$name} if $self->{apps}{$name}; # Already found diag 'Looking for "%s" in $PATH.', $name if DEBUG > 1; $path = first {-e} map { path($_, $name) } File::Spec->path; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Store.pm new/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Store.pm --- old/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack/Store.pm 2017-09-23 12:42:43.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack/Store.pm 2017-10-14 18:41:40.000000000 +0200 @@ -1,11 +1,14 @@ package Mojolicious::Plugin::AssetPack::Store; use Mojo::Base 'Mojolicious::Static'; + use Mojo::File 'path'; use Mojo::URL; use Mojolicious::Types; use Mojolicious::Plugin::AssetPack::Asset; use Mojolicious::Plugin::AssetPack::Util qw(diag checksum has_ro DEBUG); +use constant CACHE_DIR => 'cache'; + # MOJO_ASSETPACK_DB_FILE is used in tests use constant DB_FILE => $ENV{MOJO_ASSETPACK_DB_FILE} || 'assetpack.db'; our %DB_KEYS = map { $_ => 1 } qw(checksum format minified rel); @@ -64,8 +67,7 @@ else { local $self->{paths} = [$path]; next unless $asset = $self->file($url); - my $attrs = $self->_db_get({key => 'original', url => $url}) || {url => $url}; - return $self->asset_class->new(%$attrs, content => $asset); + return $self->asset_class->new(url => $url, content => $asset); } } } @@ -142,20 +144,30 @@ sub _already_downloaded { my ($self, $url) = @_; - my $attrs = $self->_db_get({key => 'original', url => $url}) or return undef; - my $asset; + my $asset = $self->asset_class->new(url => "$url"); + my @dirname = $self->_url2path($url, ''); + my $basename = pop @dirname; + + for my $path (map { path $_, @dirname } @{$self->paths}) { + + # URL with extension + my $file = $path->child($basename); + return $asset->format($1)->path($file) if -e $file and $file =~ m!.(\w+)$!; + + # URL without extension - https://fonts.googleapis.com/css?family=Roboto + for my $file ($path->list->each) { + next unless $file->basename =~ /^$basename(\w+)$/; + return $asset->format($1)->path($file); + } + } - return undef unless $attrs->{rel} and $asset = $self->asset($attrs->{rel}); - $asset->{url} = $url; - $asset->{format} ||= $attrs->{format} if $attrs->{format}; - diag 'Already downloaded: %s', $asset->url if DEBUG; - return $asset; + return undef; } sub _cache_path { my ($self, $attrs) = @_; return ( - 'cache', sprintf '%s-%s.%s%s', + CACHE_DIR, sprintf '%s-%s.%s%s', $attrs->{name}, checksum($attrs->{url}), $attrs->{minified} ? 'min.' : '', @@ -172,59 +184,67 @@ } sub _db_set { + return if $ENV{MOJO_ASSETPACK_LAZY}; my ($self, %attrs) = @_; my ($key, $url) = @attrs{qw(key url)}; - return if $ENV{MOJO_ASSETPACK_LAZY} and $key ne 'original'; $self->_db->{$url}{$key} = {%attrs}; } sub _download { my ($self, $url) = @_; - my $req_url = $url; - my ($asset, $attrs, $path); + my %attrs = (url => $url->clone); + my ($asset, $path); - if ($req_url->host eq 'local') { + if ($attrs{url}->host eq 'local') { my $base = $self->ua->server->url; - $req_url = $url->clone->scheme($base->scheme)->host_port($base->host_port); + $url = $url->clone->scheme($base->scheme)->host_port($base->host_port); } - return $asset if $asset = $self->_already_downloaded($url); + return $asset + if $attrs{url}->host ne 'local' and $asset = $self->_already_downloaded($url); - my $rel = _rel($url); - my $tx = $self->ua->get($req_url); - my $h = $tx->res->headers; + my $tx = $self->ua->get($url); + my $h = $tx->res->headers; - if ($tx->res->is_error or $tx->error) { - $self->ua->server->app->log->warn( - "[AssetPack] Unable to download $req_url: @{[$tx->error->{message}]}"); + if (my $err = $tx->error) { + $self->_log->warn("[AssetPack] Unable to download $url: $err->{message}"); return undef; } - if ($url->host ne 'local') { - $path = path($self->paths->[0], split '/', $rel); - $self->ua->server->app->log->info(qq(Caching "$req_url" to "$path".)); - $path->dirname->make_path unless -d $path->dirname; - $path->spurt($tx->res->body); + my $ct = $h->content_type || ''; + if ($ct ne 'text/plain') { + $ct =~ s!;.*$!!; + $attrs{format} = $self->_types->detect($ct)->[0]; } - if (my $ct = $h->content_type) { - $ct =~ s!;.*$!!; - $attrs->{format} = $self->_types->detect($ct)->[0] unless $ct eq 'text/plain'; + $attrs{format} ||= $tx->req->url->path->[-1] =~ /.(\w+)$/ ? $1 : 'bin'; + + if ($attrs{url}->host ne 'local') { + $path = path($self->paths->[0], $self->_url2path($attrs{url}, $attrs{format})); + $self->_log->info(qq(Caching "$url" to "$path".)); + $path->dirname->make_path unless -d $path->dirname; + $path->spurt($tx->res->body); } - $attrs->{format} ||= $tx->req->url->path->[-1] =~ /.(\w+)$/ ? $1 : undef; - @$attrs{qw(key rel url)} = ('original', $rel, $url); - $self->_db_set(%$attrs); - return $self->asset_class->new(%$attrs, path => $path) if $path; - return $self->asset_class->new(%$attrs)->content($tx->res->body); + $attrs{url} = "$attrs{url}"; + return $self->asset_class->new(%attrs, path => $path) if $path; + return $self->asset_class->new(%attrs)->content($tx->res->body); } -sub _rel { - local $_ = shift->clone->scheme(undef)->to_string; - s![^\w./-]!_!g; - s!^/+!!; - s!/+$!!; - "cache/$_"; +sub _log { shift->ua->server->app->log } + +sub _url2path { + my ($self, $url, $format) = @_; + my $query = $url->query->to_string; + my @path; + + push @path, $url->host; + push @path, @{$url->path}; + + $query =~ s!\W!_!g; + $path[-1] .= "_$query.$format" if $query; + + return CACHE_DIR, @path; } 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack.pm new/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack.pm --- old/Mojolicious-Plugin-AssetPack-1.46/lib/Mojolicious/Plugin/AssetPack.pm 2017-09-27 21:35:33.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-1.47/lib/Mojolicious/Plugin/AssetPack.pm 2017-10-14 18:58:55.000000000 +0200 @@ -6,7 +6,7 @@ use Mojolicious::Plugin::AssetPack::Store; use Mojolicious::Plugin::AssetPack::Util qw(diag has_ro load_module DEBUG); -our $VERSION = '1.46'; +our $VERSION = '1.47'; my %TAG_TEMPLATE; $TAG_TEMPLATE{css} = [qw(link rel stylesheet href)]; @@ -254,7 +254,7 @@ =head1 VERSION -1.46 +1.47 =head1 SYNOPSIS @@ -304,6 +304,16 @@ delegated to "pipe objects". Please see LMojolicious::Plugin::AssetPack::Guides::Tutorial/Pipes for a complete list. +=head1 BREAKING CHANGES + +=head2 assetpack.db (v1.47) + +C<assetpack.db> no longer track files downloaded from the internet. It will +mostly "just work", but in some cases version 1.47 might download assets that +have already been downloaded with AssetPack version 1.46 and earlier. + +The goal is to remove C<assetpack.db> completely. + =head1 GUIDES =over 2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.46/t/fetch-all.t new/Mojolicious-Plugin-AssetPack-1.47/t/fetch-all.t --- old/Mojolicious-Plugin-AssetPack-1.46/t/fetch-all.t 2017-09-05 18:08:28.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-1.47/t/fetch-all.t 2017-10-14 17:14:31.000000000 +0200 @@ -8,9 +8,9 @@ $t->get_ok('/')->status_is(200); $t->get_ok($t->tx->res->dom->at('link')->{href})->status_is(200) - ->content_like(qr{\Q../../\Easset/\w+/chosen-sprite.png'?)}) - ->content_like(qr{\Q../../\Easset/\w+/chosen-sprite@2x.png'?)}) - ->content_unlike(qr{\Qurl('chosen-sprite.png')\E}); + ->content_like(qr{\Q../../\Easset/\w+/chosen-sprite.png["'])}) + ->content_like(qr{\Q../../\Easset/\w+/chosen-sprite@2x.png["'])}) + ->content_unlike(qr{\Qurl(['"]chosen-sprite.png['"])\E}); done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.46/t/google-font.t new/Mojolicious-Plugin-AssetPack-1.47/t/google-font.t --- old/Mojolicious-Plugin-AssetPack-1.46/t/google-font.t 2017-09-23 12:42:43.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-1.47/t/google-font.t 2017-10-14 18:41:40.000000000 +0200 @@ -3,21 +3,22 @@ plan skip_all => 'TEST_ONLINE=1' unless $ENV{TEST_ONLINE} or -e '.test-everything'; -my $t = t::Helper->t(pipes => [qw(Css Fetch)]); -$t->app->asset->process( +my $t1 = t::Helper->t(pipes => [qw(Css Fetch)]); +$t1->app->asset->process( 'app.css' => 'https://fonts.googleapis.com/css?family=Roboto:400,700'); -$t->get_ok('/')->status_is(200); +$t1->get_ok('/')->status_is(200); # comment from https://github.com/hugeinc/flexboxgrid-sass/blob/master/demo/sass/_code.scss -$t->get_ok($t->tx->res->dom->at('link')->{href})->status_is(200) +$t1->get_ok($t1->tx->res->dom->at('link')->{href})->status_is(200) ->header_is('Content-Type', 'text/css')->content_like(qr{font-family:\W*Roboto}) ->content_like(qr{\Qurl(../../asset/\E\w+/.*.ttf)}); my $cache_file = File::Spec->catfile( - qw(t assets cache fonts.googleapis.com css_family_Roboto_400_700)); + qw(t assets cache fonts.googleapis.com css_family_Roboto_400_700.css)); ok -e $cache_file, 'cache file does not contain weird characters'; -# make sure we are able to load from cache +Mojo::Util::monkey_patch('Mojo::UserAgent', + 'get' => sub { shift; die "Should get font from cache! @_" }); my $t2 = t::Helper->t(pipes => [qw(Css Fetch)]); $t2->app->asset->process( 'app.css' => 'http://fonts.googleapis.com/css?family=Roboto:400,700'); @@ -26,24 +27,9 @@ ->header_is('Content-Type', 'text/css')->content_like(qr{font-family:\W*Roboto}); my $t3 = t::Helper->t(pipes => [qw(Css Fetch)]); -my $db = $t3->app->asset->store->_db; -is_deeply( - $db->{'https://fonts.googleapis.com/css?family=Roboto:400,700'}, - { - original => - {format => 'css', rel => 'cache/fonts.googleapis.com/css_family_Roboto_400_700'} - }, - 'assetpack.db looks right' -); - -for my $url (keys %$db) { - like $url, qr{^https?:}, "db $url"; - for my $key (keys %{$db->{$url}}) { - is $key, 'original', 'db has no processed assets'; - is_deeply [sort keys %{$db->{$url}{$key}}], [qw(format rel)], 'correct db attributes'; - } -} +is_deeply($t2->app->asset->store->_db, {}, 'nothing stored in db file (t2)'); +is_deeply($t3->app->asset->store->_db, {}, 'nothing stored in db file (t3)'); done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-1.46/t/sass-unable-to-download.t new/Mojolicious-Plugin-AssetPack-1.47/t/sass-unable-to-download.t --- old/Mojolicious-Plugin-AssetPack-1.46/t/sass-unable-to-download.t 2017-06-19 21:02:44.000000000 +0200 +++ new/Mojolicious-Plugin-AssetPack-1.47/t/sass-unable-to-download.t 2017-10-14 18:41:40.000000000 +0200 @@ -3,33 +3,31 @@ plan skip_all => 'TEST_ONLINE=1' unless $ENV{TEST_ONLINE} or -e '.test-everything'; plan skip_all => 'cpanm CSS::Sass' unless eval 'use CSS::Sass 3.3.0;1'; -my @message; +my ($t, @message); my $url = 'https://raw.githubusercontent.com/select2/select2/master/src/scss/core.scss'; -my $t = t::Helper->t(pipes => [qw(Sass Css)]); -$t->app->log->on(message => sub { shift; push @message, join ' ', @_ }); -$t->app->asset->process('app.css' => $url); -$t->get_ok('/')->status_is(200); -$t->get_ok($t->tx->res->dom->at('link[href]')->{href} || '/nope')->status_is(200) - ->content_like(qr{select2}); +run(); ok + (grep {/Caching/} @message), 'cached assets' or diag join ',', @message; ok + (grep {/Unable to download.*_layout.scss/} @message), 'unable to download' or map { diag $_ } @message; -@message = (); -$t = t::Helper->t(pipes => [qw(Sass Css)]); -$t->app->log->on(message => sub { shift; push @message, @_ }); -$t->app->asset->process('app.css' => $url); -$t->get_ok('/')->status_is(200); -$t->get_ok($t->tx->res->dom->at('link[href]')->{href} || '/nope')->status_is(200) - ->content_like(qr{select2}); - +run(); ok !(grep {/Caching/} @message), 'assets are already cached' or diag join ',', @message; ok !(grep {/Unable to download.*_layout.scss/} @message), 'assets are already downloaded' or diag join ',', @message; done_testing; +sub run { + @message = (); + $t = t::Helper->t(pipes => ['Sass']); + $t->app->log->on(message => sub { shift; push @message, join ' ', @_ }); + $t->app->asset->process('app.css' => $url); + $t->get_ok('/')->status_is(200); + $t->get_ok($t->tx->res->dom->at('link[href]')->{href} || '/nope')->status_is(200) + ->content_like(qr{select2}); +} + __DATA__ @@ index.html.ep %= asset 'app.css'