Hello community,

here is the log from the commit of package perl-Mojolicious-Plugin-AssetPack 
for openSUSE:Factory checked in at 2018-08-31 10:42:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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"

Fri Aug 31 10:42:50 2018 rev:40 rq:631318 version:2.05

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-AssetPack/perl-Mojolicious-Plugin-AssetPack.changes
      2018-07-22 23:05:37.000899877 +0200
+++ 
/work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-AssetPack.new/perl-Mojolicious-Plugin-AssetPack.changes
 2018-08-31 10:43:53.959163490 +0200
@@ -1,0 +2,13 @@
+Thu Aug  2 05:38:47 UTC 2018 - [email protected]
+
+- updated to 2.05
+   see /usr/share/doc/packages/perl-Mojolicious-Plugin-AssetPack/Changes
+
+  2.05 2018-08-01T14:19:35+0800
+   - Fix s///r is not supported in older Perls #136
+   - Fix Favicon rendering of manifest and browserconfig
+   - Add Asset::renderer() for dynamic assets
+   - Add fallback for serving assets with wrong checksum
+   - Renamed Asset::renderer() to tag_for()
+
+-------------------------------------------------------------------

Old:
----
  Mojolicious-Plugin-AssetPack-2.04.tar.gz

New:
----
  Mojolicious-Plugin-AssetPack-2.05.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Mojolicious-Plugin-AssetPack.spec ++++++
--- /var/tmp/diff_new_pack.CkYQNZ/_old  2018-08-31 10:43:54.495164128 +0200
+++ /var/tmp/diff_new_pack.CkYQNZ/_new  2018-08-31 10:43:54.495164128 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           perl-Mojolicious-Plugin-AssetPack
-Version:        2.04
+Version:        2.05
 Release:        0
 %define cpan_name Mojolicious-Plugin-AssetPack
 Summary:        Compress and convert css, less, sass, javascript and 
coffeescript files

++++++ Mojolicious-Plugin-AssetPack-2.04.tar.gz -> 
Mojolicious-Plugin-AssetPack-2.05.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.04/.travis.yml 
new/Mojolicious-Plugin-AssetPack-2.05/.travis.yml
--- old/Mojolicious-Plugin-AssetPack-2.04/.travis.yml   2017-01-10 
23:20:45.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-2.05/.travis.yml   2018-08-01 
05:18:20.000000000 +0200
@@ -1,8 +1,9 @@
 sudo: false
 language: perl
 perl:
-  - "5.20"
+  - "5.26"
   - "5.16"
+  - "5.10"
 addons:
   apt:
     packages:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.04/Changes 
new/Mojolicious-Plugin-AssetPack-2.05/Changes
--- old/Mojolicious-Plugin-AssetPack-2.04/Changes       2018-07-19 
11:39:06.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-2.05/Changes       2018-08-01 
08:19:35.000000000 +0200
@@ -1,5 +1,12 @@
 Revision history for perl distribution Mojolicious-Plugin-AssetPack
 
+2.05 2018-08-01T14:19:35+0800
+ - Fix s///r is not supported in older Perls #136
+ - Fix Favicon rendering of manifest and browserconfig
+ - Add Asset::renderer() for dynamic assets
+ - Add fallback for serving assets with wrong checksum
+ - Renamed Asset::renderer() to tag_for()
+
 2.04 2018-07-19T17:39:06+0800
  - Add support for generating manifest with Favicon pipe
  - Marked AssetPack::tag_for() as deprecated
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.04/MANIFEST 
new/Mojolicious-Plugin-AssetPack-2.05/MANIFEST
--- old/Mojolicious-Plugin-AssetPack-2.04/MANIFEST      2018-07-19 
11:39:09.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-2.05/MANIFEST      2018-08-01 
08:19:36.000000000 +0200
@@ -4,6 +4,7 @@
 .vscode/tasks.json
 Changes
 cpanfile
+examples/not-found.pl
 examples/rollup.pl
 examples/sprites.pl
 lib/Mojolicious/Plugin/AssetPack.pm
@@ -44,6 +45,7 @@
 t/assets/image/photo-1429734160945-4f85244d6a5a.jpg
 t/assets/image/sample.png
 t/assets/js/export.js
+t/assets/js/not-found.js
 t/assets/js/some-lib.js
 t/assets/js/vue-app.js
 t/assets/other/dummy.gif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.04/META.json 
new/Mojolicious-Plugin-AssetPack-2.05/META.json
--- old/Mojolicious-Plugin-AssetPack-2.04/META.json     2018-07-19 
11:39:09.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-2.05/META.json     2018-08-01 
08:19:36.000000000 +0200
@@ -53,6 +53,6 @@
          "web" : "https://github.com/jhthorsen/mojolicious-plugin-assetpack";
       }
    },
-   "version" : "2.04",
+   "version" : "2.05",
    "x_serialization_backend" : "JSON::PP version 2.97001"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.04/META.yml 
new/Mojolicious-Plugin-AssetPack-2.05/META.yml
--- old/Mojolicious-Plugin-AssetPack-2.04/META.yml      2018-07-19 
11:39:09.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-2.05/META.yml      2018-08-01 
08:19:36.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: '2.04'
+version: '2.05'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/Mojolicious-Plugin-AssetPack-2.04/examples/not-found.pl 
new/Mojolicious-Plugin-AssetPack-2.05/examples/not-found.pl
--- old/Mojolicious-Plugin-AssetPack-2.04/examples/not-found.pl 1970-01-01 
01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-2.05/examples/not-found.pl 2018-08-01 
07:31:57.000000000 +0200
@@ -0,0 +1,28 @@
+#!/usr/bin/env perl
+die "Run $0 from ./mojolicious-plugin-assetpack/ root" unless -d 't/assets';
+use lib 'lib';
+use Mojolicious::Lite;
+
+plugin 'AssetPack' => {pipes => [qw(Css JavaScript)]};
+app->asset->store->paths(['t/assets']);
+
+app->asset->process('app.css' => 'css/c.css');
+app->asset->process('app.js'  => 'js/not-found.js');
+
+# Set up the mojo lite application and start it
+get '/' => 'index';
+app->start;
+
+__DATA__
+@@ index.html.ep
+<html>
+<head>
+  <title>Test!</title>
+  <link rel="stylesheet" href="/asset/fallback/app.css">
+</head>
+<body>
+  <h1>Check the console for debug messages</h1>
+  <p>And the background should be gray.</p>
+  <script src="/asset/fallback/app.js"></script>
+</body>
+</html>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/Mojolicious-Plugin-AssetPack-2.04/lib/Mojolicious/Plugin/AssetPack/Asset.pm 
new/Mojolicious-Plugin-AssetPack-2.05/lib/Mojolicious/Plugin/AssetPack/Asset.pm
--- 
old/Mojolicious-Plugin-AssetPack-2.04/lib/Mojolicious/Plugin/AssetPack/Asset.pm 
    2018-07-19 11:08:22.000000000 +0200
+++ 
new/Mojolicious-Plugin-AssetPack-2.05/lib/Mojolicious/Plugin/AssetPack/Asset.pm 
    2018-08-01 07:00:22.000000000 +0200
@@ -25,7 +25,8 @@
 };
 
 has minified => sub { shift->url =~ /\bmin\b/ ? 1 : 0 };
-has renderer => sub { \&_default_renderer };
+has renderer => undef;
+has tag_for  => sub { \&_default_tag_for };
 
 has _asset => sub {
   my $self = shift;
@@ -90,7 +91,7 @@
 
 sub url_for { $_[1]->url_for(assetpack => $_[0]->TO_JSON); }
 
-sub _default_renderer {
+sub _default_tag_for {
   my ($asset, $c, $args, @attrs) = @_;
   my $url = $asset->url_for($c);
   my @template = @{$TAG_TEMPLATE{$asset->format} || $TAG_TEMPLATE{css}};
@@ -159,10 +160,18 @@
 =head2 renderer
 
   $code = $self->renderer;
-  $self = $self->renderer(sub { my ($c, \%args, @attrs) = @_; return qq(<link 
rel="...">) });
+  $self = $self->renderer(sub { my ($self, $c) = @_; $c->render(data => 
"...""); })
 
-Used to register a custom renderer for this asset. The arguments passed in
-are:
+Can be used to register a custom render method for this asset. This is called
+by L<Mojolicious::Plugin::AssetPack::Store/serve_asset>.
+
+=head2 tag_for
+
+  $code = $self->tag_for;
+  $self = $self->tag_for(sub { my ($c, \%args, @attrs) = @_; return qq(<link 
rel="...">) });
+
+Used to register a custom tag renderer for this asset. The arguments passed
+in are:
 
 =over 2
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/Mojolicious-Plugin-AssetPack-2.04/lib/Mojolicious/Plugin/AssetPack/Pipe/Favicon.pm
 
new/Mojolicious-Plugin-AssetPack-2.05/lib/Mojolicious/Plugin/AssetPack/Pipe/Favicon.pm
--- 
old/Mojolicious-Plugin-AssetPack-2.04/lib/Mojolicious/Plugin/AssetPack/Pipe/Favicon.pm
      2018-07-19 11:34:22.000000000 +0200
+++ 
new/Mojolicious-Plugin-AssetPack-2.05/lib/Mojolicious/Plugin/AssetPack/Pipe/Favicon.pm
      2018-08-01 06:42:23.000000000 +0200
@@ -37,20 +37,29 @@
     $store->save(\$db, $attrs);
   }
 
+  my $renderer = sub {
+    my ($asset, $c, $args, @attrs) = @_;
+    my $content = $asset->content;
+    $content
+      =~ s!"/([^.]+\.\w{3,})"!sprintf '"%s"', $sub_assets{$1} ? 
$sub_assets{$1}->url_for($c) : $1!ge;
+    return $content if $args;
+    return $c->render(data => $content);
+  };
+
   for my $url (@$urls) {
     my $asset = $store->asset($url)
       or die "AssetPack was unable to fetch icons/assets asset $url";
     $sub_assets{join '.', $asset->name, $asset->format} = $asset;
+    $asset->renderer($renderer) if $asset->format =~ m!(manifest|xml|webapp)$!;
     $self->assetpack->{by_checksum}{$asset->checksum} = $asset;
   }
 
-  $asset->renderer(
-    sub {
-      my ($asset, $c, $args, @attrs) = @_;
-      $markup
-        =~ s!href="(/?)([^"]+)"!sprintf 'href="%s"', $sub_assets{$2} ? 
$sub_assets{$2}->url_for($c) : "$1$2"!ger;
-    }
-  );
+  unless ($markup =~ m!msapplication-config!) {
+    $markup =~ s![\r\n]+$!!;
+    $markup .= qq(\n<meta name="msapplication-config" 
content="/browserconfig.xml">);
+  }
+
+  $asset->content($markup)->tag_for($renderer);
 }
 
 sub _build_design {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/Mojolicious-Plugin-AssetPack-2.04/lib/Mojolicious/Plugin/AssetPack/Store.pm 
new/Mojolicious-Plugin-AssetPack-2.05/lib/Mojolicious/Plugin/AssetPack/Store.pm
--- 
old/Mojolicious-Plugin-AssetPack-2.04/lib/Mojolicious/Plugin/AssetPack/Store.pm 
    2018-01-29 22:43:27.000000000 +0100
+++ 
new/Mojolicious-Plugin-AssetPack-2.05/lib/Mojolicious/Plugin/AssetPack/Store.pm 
    2018-08-01 07:51:24.000000000 +0200
@@ -2,6 +2,8 @@
 use Mojo::Base 'Mojolicious::Static';
 
 use Mojo::File 'path';
+use Mojo::Loader 'data_section';
+use Mojo::Template;
 use Mojo::URL;
 use Mojolicious::Types;
 use Mojolicious::Plugin::AssetPack::Asset;
@@ -12,9 +14,19 @@
 # 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);
+our %FALLBACK_TEMPLATES = %{data_section(__PACKAGE__)};
 
-has asset_class => 'Mojolicious::Plugin::AssetPack::Asset';
-has default_headers => sub { +{"Cache-Control" => "max-age=31536000"} };
+for my $name (keys %FALLBACK_TEMPLATES) {
+  my $text = delete $FALLBACK_TEMPLATES{$name};
+  $name =~ m!(\w+)\.ep$!;
+  $FALLBACK_TEMPLATES{$1}
+    = Mojo::Template->new->parse($text)->prepend('my ($c, $assets) = @_;');
+}
+
+has asset_class        => 'Mojolicious::Plugin::AssetPack::Asset';
+has default_headers    => sub { +{"Cache-Control" => "max-age=31536000"} };
+has fallback_headers   => sub { +{"Cache-Control" => "max-age=60"} };
+has fallback_templates => sub { +{%FALLBACK_TEMPLATES} };
 
 has _types => sub {
   my $t = Mojolicious::Types->new;
@@ -133,14 +145,44 @@
 
 sub serve_asset {
   my ($self, $c, $asset) = @_;
-  my $d  = $self->default_headers;
+  my $dh = $self->default_headers;
   my $h  = $c->res->headers;
-  my $ct = $self->_types->type($asset->format) || 'application/octet-stream';
 
-  $h->header($_ => $d->{$_}) for keys %$d;
-  $h->content_type($ct);
-  $self->SUPER::serve_asset($c, $asset->can('asset') ? $asset->asset : $asset);
-  $self;
+  $h->header($_ => $dh->{$_}) for keys %$dh;
+  $h->content_type($self->_types->type($asset->format) || 
'application/octet-stream');
+
+  if (my $renderer = $asset->renderer) {
+    $renderer->($asset, $c);
+  }
+  else {
+    $self->SUPER::serve_asset($c, $asset->can('asset') ? $asset->asset : 
$asset);
+  }
+
+  return $self;
+}
+
+sub serve_fallback_for_assets {
+  my ($self, $c, $topic, $assets) = @_;
+  my $fh     = $self->fallback_headers;
+  my $format = $topic =~ m!\.(\w+)$! ? $1 : 'css';
+  my $h      = $c->res->headers;
+
+  $h->header($_ => $fh->{$_}) for keys %$fh;
+  $h->content_type($self->_types->type($format) || 'application/octet-stream');
+
+  if (my $template = $self->fallback_templates->{$format}) {
+    $c->render(data => $template->process($c, $assets));
+  }
+  elsif (@$assets == 1) {
+    my $url = $assets->[0]->url_for($c);
+    $url->path->[-1] = $topic;
+    $c->redirect_to($url);
+  }
+  else {
+    $c->render(text => "// Invalid checksum for topic '$topic'\n", status => 
404);
+  }
+
+  return $self;
 }
 
 sub _already_downloaded {
@@ -323,7 +365,25 @@
   $hash_ref = $self->default_headers;
   $self = $self->default_headers({"Cache-Control" => "max-age=31536000"});
 
-Used to set default headers used by L</serve_asset>.
+Used to set headers used by L</serve_asset>.
+
+=head2 fallback_headers
+
+  $hash_ref = $self->fallback_headers;
+  $self = $self->fallback_headers({"Cache-Control" => "max-age=300"});
+
+Used to set headers used by L</serve_fallback_for_assets>.
+
+This is currently an EXPERIMENTAL feature.
+
+=head2 fallback_templates
+
+  $hash_ref = $self->fallback_templates;
+  $self = $self->fallback_templates->{"css"} = Mojo::Template->new;
+
+Used to set up templates used by L</serve_fallback_for_assets>.
+
+This is currently an EXPERIMENTAL feature.
 
 =head2 paths
 
@@ -412,11 +472,46 @@
 
 =head2 serve_asset
 
+  $self = $self->serve_asset($c, $asset);
+
 Override L<Mojolicious::Static/serve_asset> with the functionality to set
 response headers first, from L</default_headers>.
 
+Will call L<Mojolicious::Plugin::AssetPack::Asset/render> if available, after
+setting Content-Type header and other L</default_headers>.
+
+=head2 serve_fallback_for_assets
+
+  $self = $self->serve_fallback_for_assets($c, $topic, $assets);
+
+Used to serve a fallback response for given C<$topic> and a
+L<Mojo::Collection> of C<Mojolicious::Plugin::AssetPack::Asset> objects.
+
+Will set the headers in L</fallback_headers> and then either render either a
+template matching the extension from C<$topic> from L</fallback_templates>, a
+302 redirect to the actual asset, or a 404 Not Found.
+
+This is currently an EXPERIMENTAL feature.
+
 =head1 SEE ALSO
 
 L<Mojolicious::Plugin::AssetPack>.
 
 =cut
+
+__DATA__
+@@ fallback.css.ep
+% for my $asset (@$assets) {
+@import "<%= $asset->url_for($c) %>";
+% }
+@@ fallback.js.ep
+% use Mojo::JSON 'to_json';
+(function(w,d,a,b){
+var c=function(){
+var t=d.createElement("script");
+t.src=b.shift();
+if(b.length) t.addEventListener("load",c);
+a.parentNode.insertBefore(t,a);
+};
+c();
+})(window,document,document.getElementsByTagName("script")[0],<%= to_json([map 
{ $_->url_for($c) } @$assets]) %>);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/Mojolicious-Plugin-AssetPack-2.04/lib/Mojolicious/Plugin/AssetPack.pm 
new/Mojolicious-Plugin-AssetPack-2.05/lib/Mojolicious/Plugin/AssetPack.pm
--- old/Mojolicious-Plugin-AssetPack-2.04/lib/Mojolicious/Plugin/AssetPack.pm   
2018-07-19 11:39:06.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-2.05/lib/Mojolicious/Plugin/AssetPack.pm   
2018-08-01 08:19:35.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 = '2.04';
+our $VERSION = '2.05';
 
 has minify => sub { shift->_app->mode eq 'development' ? 0 : 1 };
 
@@ -86,7 +86,7 @@
 sub tag_for {
   my $self = shift;
   deprecated
-    'tag_for() is DEPRECATED in favor of 
Mojolicious::Plugin::AssetPack::Asset::renderer()';
+    'tag_for() is DEPRECATED in favor of 
Mojolicious::Plugin::AssetPack::Asset::tag_for()';
   return $self->{tag_for} unless @_;
   $self->{tag_for} = shift;
   return $self;
@@ -144,8 +144,8 @@
     }
   }
 
-  if (my $renderer = $self->{tag_for}) {
-    $_->{renderer} or $_->{renderer} = $renderer for @$assets;
+  if (my $tag_for = $self->{tag_for}) {
+    $_->{tag_for} or $_->{tag_for} = $tag_for for @$assets;
   }
 
   my @checksum = map { $_->checksum } @$assets;
@@ -195,25 +195,25 @@
 
   return Mojo::ByteStream->new(
     join "\n",
-    map { $_->renderer->($_, $c, \%args, @attrs) }
+    map { $_->tag_for->($_, $c, \%args, @attrs) }
       grep { !$_->isa('Mojolicious::Plugin::AssetPack::Asset::Null') } @$assets
   );
 }
 
 sub _serve {
-  my $c        = shift;
-  my $checksum = $c->stash('checksum');
-  my $helper   = $c->stash('assetpack.helper');
-  my $self     = $c->$helper;
+  my $c      = shift;
+  my $helper = $c->stash('assetpack.helper');
+  my $self   = $c->$helper;
 
-  if (my $f = $self->{by_checksum}{$checksum}) {
-    $self->store->serve_asset($c, $f);
+  my $checksum = $c->stash('checksum');
+  if (my $asset = $self->{by_checksum}{$checksum}) {
+    $self->store->serve_asset($c, $asset);
     return $c->rendered;
   }
 
   my $topic = $c->stash('name');
-  if ($self->{by_topic}{$topic}) {
-    return $c->render(text => "// Invalid checksum for topic '$topic'\n", 
status => 404);
+  if (my $assets = $self->{by_topic}{$topic}) {
+    return $self->store->serve_fallback_for_assets($c, $topic, $assets);
   }
 
   $c->render(text => "// No such asset '$topic'\n", status => 404);
@@ -238,7 +238,7 @@
 
 =head1 VERSION
 
-2.04
+2.05
 
 =head1 SYNOPSIS
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/Mojolicious-Plugin-AssetPack-2.04/t/assets/js/not-found.js 
new/Mojolicious-Plugin-AssetPack-2.05/t/assets/js/not-found.js
--- old/Mojolicious-Plugin-AssetPack-2.04/t/assets/js/not-found.js      
1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-2.05/t/assets/js/not-found.js      
2018-08-01 07:30:45.000000000 +0200
@@ -0,0 +1,3 @@
+(function(w,d) {
+  console.log("I'm loaded!");
+})();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.04/t/favicon.t 
new/Mojolicious-Plugin-AssetPack-2.05/t/favicon.t
--- old/Mojolicious-Plugin-AssetPack-2.04/t/favicon.t   2018-07-19 
11:34:36.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-2.05/t/favicon.t   2018-08-01 
06:42:23.000000000 +0200
@@ -1,10 +1,13 @@
 use lib '.';
+use File::Basename 'basename';
 use t::Helper;
 
 plan skip_all => 'TEST_REALFAVICONGENERATOR_API_KEY=is_not_set'
   unless $ENV{TEST_REALFAVICONGENERATOR_API_KEY};
 
 my $t = t::Helper->t(pipes => [qw(Favicon)]);
+my %sub_asset;
+
 
$t->app->asset->pipe('Favicon')->api_key($ENV{TEST_REALFAVICONGENERATOR_API_KEY});
 $t->app->asset->process('favicon.ico' => 
'/image/master_favicon_thumbnail.png');
 
@@ -19,16 +22,31 @@
   
->element_exists('[href$="32x32.png"][rel="icon"][sizes="32x32"][type="image/png"]')
   
->element_exists('[href$="safari-pinned-tab.svg"][color="#536DFE"][rel="mask-icon"]')
   ->element_exists('[href$="site.webmanifest"][rel="manifest"]')
+  
->element_exists('[name="msapplication-config"][content$="browserconfig.xml"]')
   ->element_exists('[name="msapplication-TileColor"][content="#536DFE"]')
   ->element_exists('[name="theme-color"][content="#536DFE"]');
 
 # Make sure that all the [href] above looks like 
/asset/19b5e7c873/apple-touch-icon-57x57.png
-$t->tx->res->dom->find("[href]")->each(
+$t->tx->res->dom->find("[href], [content]")->each(
   sub {
-    like $_->{href}, qr{^/asset/\w+/\w+.*$}, "href $_->{href}";
+    my $src = $_->{href} || $_->{content};
+    return if $src =~ m!\#!;    # Skip content="#536DFE"
+    my $name = basename $src;
+    $sub_asset{$name} = $src;
+    like $src, qr{^/asset/\w+/\w+.*$}, "meta $src";
   }
 );
 
+$t->get_ok($sub_asset{'site.webmanifest'})->status_is(200)
+  ->json_like('/icons/0/src', qr{^/asset/\w+/[\w-]+\.png$})
+  ->json_like('/icons/1/src', qr{^/asset/\w+/[\w-]+\.png$});
+
+$t->get_ok($sub_asset{'browserconfig.xml'})->status_is(200);
+like $t->tx->res->dom->at('square150x150logo[src]')->{src},
+  qr{^/asset/\w+/mstile-150x150.png}, 'browserconfig.xml square150x150logo';
+
+#$t->get_ok($sub_asset{'manifest.webapp'})->content_is(1);
+
 {
   no warnings 'redefine';
   local *Mojolicious::Plugin::AssetPack::Pipe::Favicon::_request = sub { die 
$_[1] };
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.04/t/not-found.t 
new/Mojolicious-Plugin-AssetPack-2.05/t/not-found.t
--- old/Mojolicious-Plugin-AssetPack-2.04/t/not-found.t 2016-11-18 
15:11:14.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-2.05/t/not-found.t 2018-08-01 
07:51:55.000000000 +0200
@@ -5,7 +5,9 @@
 eval { $t->app->asset->process };
 like $@, qr{Could not find input asset "no-such-stylesheet\.css"}, 'could not 
find asset';
 
-$t->app->asset->process('app.css', 'input.css');
+$t->app->asset->process('something.png', 'image/sample.png');
+$t->app->asset->process('app.css',       'input.css');
+
 $t->get_ok('/')->status_is(200)
   ->element_exists(qq(link[href="/asset/f956a3f925/input.css"]));
 
@@ -16,13 +18,17 @@
 $t->get_ok('/asset/f956a3f925/foo.css')->status_is(200);
 
 # This is useful when assets are combined
-$t->get_ok('/asset/aaaaaaaaaa/app.css')->status_is(404)
-  ->content_is("// Invalid checksum for topic 'app.css'\n");
+$t->get_ok('/asset/aaaaaaaaaa/app.css')->status_is(200)
+  ->content_is(qq(\@import "/asset/f956a3f925/input.css";\n));
 
 # Both checksum and topic is invalid
 $t->get_ok('/asset/aaaaaaaaaa/foo.css')->status_is(404)
   ->content_is("// No such asset 'foo.css'\n");
 
+$t->get_ok('/asset/aaaaaaaaaa/something.png')->status_is(302)
+  ->header_like(Location => qr{^/asset/\w+/something.png$});
+$t->get_ok($t->tx->res->headers->location)->status_is(200);
+
 done_testing;
 
 __DATA__


Reply via email to