Hello community,
here is the log from the commit of package perl-Mojolicious-Plugin-AssetPack for openSUSE:Factory checked in at 2015-09-03 18:02:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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"
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-AssetPack/perl-Mojolicious-Plugin-AssetPack.changes 2015-08-27 08:57:57.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-AssetPack.new/perl-Mojolicious-Plugin-AssetPack.changes 2015-09-03 18:07:37.000000000 +0200
@@ -1,0 +2,13 @@
+Sat Aug 29 08:56:15 UTC 2015 - coolo@suse.com
+
+- updated to 0.63
+ see /usr/share/doc/packages/perl-Mojolicious-Plugin-AssetPack/Changes
+
+ 0.63 2015-08-29T00:51:29+0200
+ - Fix responding 404 when in-memory asset could not be found
+ - Add support for custom response headers #55
+
+ 0.62 2015-08-27T11:40:41-0400
+ - Fix @import tracking #62
+
+-------------------------------------------------------------------
Old:
----
Mojolicious-Plugin-AssetPack-0.61.tar.gz
New:
----
Mojolicious-Plugin-AssetPack-0.63.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Mojolicious-Plugin-AssetPack.spec ++++++
--- /var/tmp/diff_new_pack.dQr0JY/_old 2015-09-03 18:07:39.000000000 +0200
+++ /var/tmp/diff_new_pack.dQr0JY/_new 2015-09-03 18:07:39.000000000 +0200
@@ -17,7 +17,7 @@
Name: perl-Mojolicious-Plugin-AssetPack
-Version: 0.61
+Version: 0.63
Release: 0
%define cpan_name Mojolicious-Plugin-AssetPack
Summary: Compress and convert css, less, sass, javascript and coffeescript files
++++++ Mojolicious-Plugin-AssetPack-0.61.tar.gz -> Mojolicious-Plugin-AssetPack-0.63.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.61/Changes new/Mojolicious-Plugin-AssetPack-0.63/Changes
--- old/Mojolicious-Plugin-AssetPack-0.61/Changes 2015-08-23 13:34:34.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.63/Changes 2015-08-29 00:51:29.000000000 +0200
@@ -1,5 +1,12 @@
Revision history for perl distribution Mojolicious-Plugin-AssetPack
+0.63 2015-08-29T00:51:29+0200
+ - Fix responding 404 when in-memory asset could not be found
+ - Add support for custom response headers #55
+
+0.62 2015-08-27T11:40:41-0400
+ - Fix @import tracking #62
+
0.61 2015-08-23T13:34:34+0200
- Add include_paths() to Scss preprocessor
- Fix using SASS_PATH environment variable when calculating checksum #60
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.61/MANIFEST new/Mojolicious-Plugin-AssetPack-0.63/MANIFEST
--- old/Mojolicious-Plugin-AssetPack-0.61/MANIFEST 2015-08-23 13:34:35.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.63/MANIFEST 2015-08-29 00:51:30.000000000 +0200
@@ -91,6 +91,8 @@
t/public/sass/bs-issue-5.scss
t/public/sass/compass.scss
t/public/sass/issue-60.scss
+t/public/sass/issue-62-import.scss
+t/public/sass/issue-62.scss
t/public/sass/subdir/_issue-5.scss
t/public/sass/x.scss
t/public/sass/y.scss
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.61/META.json new/Mojolicious-Plugin-AssetPack-0.63/META.json
--- old/Mojolicious-Plugin-AssetPack-0.61/META.json 2015-08-23 13:34:35.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.63/META.json 2015-08-29 00:51:30.000000000 +0200
@@ -50,5 +50,5 @@
"url" : "https://github.com/jhthorsen/mojolicious-plugin-assetpack.git"
}
},
- "version" : "0.61"
+ "version" : "0.63"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.61/META.yml new/Mojolicious-Plugin-AssetPack-0.63/META.yml
--- old/Mojolicious-Plugin-AssetPack-0.61/META.yml 2015-08-23 13:34:34.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.63/META.yml 2015-08-29 00:51:30.000000000 +0200
@@ -27,4 +27,4 @@
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: '0.61'
+version: '0.63'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.61/README new/Mojolicious-Plugin-AssetPack-0.63/README
--- old/Mojolicious-Plugin-AssetPack-0.61/README 2015-08-23 13:34:34.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.63/README 2015-08-29 00:51:29.000000000 +0200
@@ -3,7 +3,7 @@
javascript and coffeescript files
VERSION
- 0.61
+ 0.63
SYNOPSIS
Application
@@ -97,6 +97,16 @@
NOTE! You need to have a trailing "/" at the end of the string.
+ headers
+ $hash_ref = $self->headers;
+ $self = $self->headers({"Cache-Control" => "max-age=31536000"});
+
+ This attribute can hold custom response headers when serving assets. The
+ default is no headers, but this might change in future release to
+ include "Cache-Control".
+
+ This attribute is EXPERIMENTAL.
+
minify
$bool = $self->minify;
$app->plugin("AssetPack" => {minify => $bool});
@@ -163,13 +173,14 @@
register
plugin AssetPack => {
base_url => $str, # default to "/packed"
+ headers => {"Cache-Control" => "max-age=31536000"},
minify => $bool, # compress assets
proxy => "detect", # autodetect proxy settings
out_dir => "/path/to/some/directory",
source_paths => [...],
};
- Will register the "compress" helper. All arguments are optional.
+ Will register the "asset" helper. All arguments are optional.
source_paths
$self = $self->source_paths($array_ref);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Handler/Http.pm new/Mojolicious-Plugin-AssetPack-0.63/lib/Mojolicious/Plugin/AssetPack/Handler/Http.pm
--- old/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Handler/Http.pm 2015-08-20 13:10:16.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.63/lib/Mojolicious/Plugin/AssetPack/Handler/Http.pm 2015-08-24 16:21:06.000000000 +0200
@@ -6,8 +6,8 @@
=head1 DESCRIPTION
-LMojolicious::Plugin::AssetPack::Handler::Sprites is a module that can
-fetch assets from web.
+LMojolicious::Plugin::AssetPack::Handler::Http is a module that can
+fetch assets from the web.
This class is EXPERIMENTAL.
@@ -24,7 +24,7 @@
$asset = $self->asset_for($url, $assetpack);
-This method tries to download the asset from web.
+This method tries to download the asset from the web.
=cut
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Preprocessor/Scss.pm new/Mojolicious-Plugin-AssetPack-0.63/lib/Mojolicious/Plugin/AssetPack/Preprocessor/Scss.pm
--- old/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Preprocessor/Scss.pm 2015-08-23 13:32:55.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.63/lib/Mojolicious/Plugin/AssetPack/Preprocessor/Scss.pm 2015-08-28 21:36:51.000000000 +0200
@@ -9,7 +9,7 @@
=head1 DESCRIPTION
LMojolicious::Plugin::AssetPack::Preprocessor::Scss is a preprocessor for
-C<.scss> files. This module inherite all the functionality from
+C<.scss> files. This module inherits all the functionality from
LMojolicious::Plugin::AssetPack::Preprocessor::Sass.
You need either the "sass" executable or the cpan module LCSS::Sass to make
@@ -31,7 +31,7 @@
to search for C<@import> files in directories other than relative to the
the file containing the C<@import> statement.
-Note that C need to hold absolute paths to work properly.
+Note that C needs to hold absolute paths to work properly.
Example usage:
@@ -188,8 +188,10 @@
my ($ext, $name, $path) = (pop @rel, pop @rel);
for my $p (map { File::Spec->catdir($_, @rel) } @$include_paths) {
- return $path if -r ($path = catfile $p, "$name.$ext");
- return $path if -r ($path = catfile $p, "_$name.$ext");
+ for ("$name.$ext", "_$name.$ext", $name, "_$name") {
+ my $f = catfile $p, $_;
+ return $f if -f $f and -r _;
+ }
}
if (DEBUG == 2) { local $" = '/'; warn "[ASSETPACK] Not found \@import @rel/$name.$ext\n" }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack.pm new/Mojolicious-Plugin-AssetPack-0.63/lib/Mojolicious/Plugin/AssetPack.pm
--- old/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack.pm 2015-08-23 13:34:34.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.63/lib/Mojolicious/Plugin/AssetPack.pm 2015-08-29 00:51:29.000000000 +0200
@@ -12,9 +12,10 @@
use constant DEBUG => $ENV{MOJO_ASSETPACK_DEBUG} || 0;
use constant NO_CACHE => $ENV{MOJO_ASSETPACK_NO_CACHE} || 0;
-our $VERSION = '0.61';
+our $VERSION = '0.63';
has base_url => '/packed/';
+has headers => sub { +{} };
has minify => 0;
has preprocessors => sub { Mojolicious::Plugin::AssetPack::Preprocessors->new };
has out_dir => '';
@@ -97,6 +98,7 @@
$self->_app($app);
$self->_ua->server->app($app);
$self->_ua->proxy->detect if $config->{proxy};
+ $self->headers($config->{headers} || {});
$self->minify($config->{minify} // $app->mode ne 'development');
$self->out_dir($self->_build_out_dir($app, $config));
$self->base_url($config->{base_url}) if $config->{base_url};
@@ -144,9 +146,9 @@
}
sub _assets_from_memory {
- my $self = shift;
+ my $self = shift;
+ my $headers = $self->headers;
- $self->{assets_from_memory_added} = 1;
$self->_app->hook(
before_routes => sub {
my $c = shift;
@@ -154,10 +156,11 @@
return if $c->req->is_handshake or $c->res->code;
return unless $path->[1] and 0 == index "$path", $self->base_url;
- return unless my $asset = $c->asset->_asset($path->[1]);
+ return unless my $asset = $c->asset->{asset}{$path->[1]};
return if $asset->{internal};
- $c->res->headers->last_modified(Mojo::Date->new($^T))
+ my $h = $c->res->headers->last_modified(Mojo::Date->new($^T))
->content_type($c->app->types->type($asset->path =~ /\.(\w+)$/ ? $1 : 'txt') || 'text/plain');
+ $h->header($_ => $headers->{$_}) for keys %$headers;
$c->reply->asset($asset);
}
);
@@ -317,9 +320,22 @@
};
}
- if (!$self->{assets_from_memory_added} and !$self->out_dir) {
- $self->_app->log->warn('AssetPack will store assets in memory');
- $self->_assets_from_memory;
+ unless ($self->{hook_added}++) {
+ if (!$self->out_dir) {
+ $self->_app->log->warn('AssetPack will store assets in memory');
+ $self->_assets_from_memory;
+ }
+ elsif (my $headers = $self->headers) {
+ $self->_app->hook(
+ after_static => sub {
+ my $c = shift;
+ my $path = $c->req->url->path;
+ return unless $path->[1] and 0 == index "$path", $self->base_url;
+ my $h = $c->res->headers;
+ $h->header($_ => $headers->{$_}) for keys %$headers;
+ }
+ );
+ }
}
$asset->in_memory(!$self->out_dir)->save;
@@ -393,7 +409,7 @@
=head1 VERSION
-0.61
+0.63
=head1 SYNOPSIS
@@ -515,6 +531,17 @@
NOTE! You need to have a trailing "/" at the end of the string.
+=head2 headers
+
+ $hash_ref = $self->headers;
+ $self = $self->headers({"Cache-Control" => "max-age=31536000"});
+
+This attribute can hold custom response headers when serving assets.
+The default is no headers, but this might change in future release to
+include "Cache-Control".
+
+This attribute is EXPERIMENTAL.
+
=head2 minify
$bool = $self->minify;
@@ -592,13 +619,14 @@
plugin AssetPack => {
base_url => $str, # default to "/packed"
+ headers => {"Cache-Control" => "max-age=31536000"},
minify => $bool, # compress assets
proxy => "detect", # autodetect proxy settings
out_dir => "/path/to/some/directory",
source_paths => [...],
};
-Will register the C<compress> helper. All L are optional.
+Will register the C<asset> helper. All L are optional.
=head2 source_paths
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.61/t/css.t new/Mojolicious-Plugin-AssetPack-0.63/t/css.t
--- old/Mojolicious-Plugin-AssetPack-0.61/t/css.t 2015-07-28 13:15:27.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.63/t/css.t 2015-08-28 22:16:05.000000000 +0200
@@ -1,7 +1,7 @@
use t::Helper;
{
- my $t = t::Helper->t({minify => 0});
+ my $t = t::Helper->t({minify => 0, headers => {'Cache-Control' => 'max-age=31536000'}});
ok $t->app->asset->preprocessors->can_process('css'), 'found preprocessor for css';
@@ -12,8 +12,11 @@
qr{get_ok('/packed/a-09a653553edca03ad3308a868e5a06ac.css')->content_like(qr{a1a1a1;});
+ $t->get_ok('/packed/a-09a653553edca03ad3308a868e5a06ac.css')->content_like(qr{a1a1a1;})
+ ->header_is('Cache-Control', 'max-age=31536000');
$t->get_ok('/packed/b-89dbc5a64c4e7e64a3d1ce177b740a7e.css')->content_like(qr{b1b1b1;});
+
+ $t->get_ok('/packed/a-not-found.css')->status_is(404)->header_is('Cache-Control', undef);
}
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.61/t/in-memory.t new/Mojolicious-Plugin-AssetPack-0.63/t/in-memory.t
--- old/Mojolicious-Plugin-AssetPack-0.61/t/in-memory.t 2015-07-28 13:15:27.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.63/t/in-memory.t 2015-08-28 22:16:05.000000000 +0200
@@ -1,6 +1,6 @@
use t::Helper;
-my $args = {minify => 0, out_dir => ''};
+my $args = {minify => 0, out_dir => '', headers => {'Cache-Control' => 'max-age=31536000'}};
my $t = t::Helper->t($args);
my $assetpack = $t->app->asset;
@@ -9,13 +9,16 @@
$t->get_ok('/test1')->status_is(200)->text_like('style', qr/background:#123;/)
->element_exists('link[href="/packed/from-data-f580ad0fd8d617446dda2a00e75cf8c2.css"]');
-$t->get_ok('/packed/from-data-f580ad0fd8d617446dda2a00e75cf8c2.css')->content_like(qr/background:#123;/);
+$t->get_ok('/packed/from-data-f580ad0fd8d617446dda2a00e75cf8c2.css')->content_like(qr/background:#123;/)
+ ->header_is('Cache-Control', 'max-age=31536000');
ok !-e File::Spec->catfile(qw( t public packed from-data-f580ad0fd8d617446dda2a00e75cf8c2.css )),
'no file was created on disk';
ok + (grep {/store assets in memory/} @{$args->{log}}), 'AssetPack will store assets in memory';
+$t->get_ok('/packed/../../00-basic.t')->status_is(404)->header_is('Cache-Control', undef);
+
done_testing;
__DATA__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.61/t/public/sass/issue-62-import.scss new/Mojolicious-Plugin-AssetPack-0.63/t/public/sass/issue-62-import.scss
--- old/Mojolicious-Plugin-AssetPack-0.61/t/public/sass/issue-62-import.scss 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-0.63/t/public/sass/issue-62-import.scss 2015-08-28 22:16:48.000000000 +0200
@@ -0,0 +1 @@
+$bg: #ccc;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.61/t/public/sass/issue-62.scss new/Mojolicious-Plugin-AssetPack-0.63/t/public/sass/issue-62.scss
--- old/Mojolicious-Plugin-AssetPack-0.61/t/public/sass/issue-62.scss 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-0.63/t/public/sass/issue-62.scss 2015-08-28 21:36:51.000000000 +0200
@@ -0,0 +1,4 @@
+@import "issue-62-import.scss";
+body {
+ background: $bg;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.61/t/scss.t new/Mojolicious-Plugin-AssetPack-0.63/t/scss.t
--- old/Mojolicious-Plugin-AssetPack-0.61/t/scss.t 2015-08-23 13:32:09.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.63/t/scss.t 2015-08-28 21:36:51.000000000 +0200
@@ -85,6 +85,22 @@
modify($scss_file, sub {s!333!ccc!});
}
+{
+ # https://github.com/jhthorsen/mojolicious-plugin-assetpack/pull/62
+
+ my $scss_file = File::Spec->catfile(qw( t public sass issue-62-import.scss ));
+ my $app = t::Helper->t->app;
+ $app->asset('change.css' => '/sass/issue-62.scss');
+ like + ($app->asset->get('change.css', {assets => 1}))[0]->slurp, qr{\#ccc}, 'original';
+
+ modify($scss_file, sub {s!ccc!ddd!});
+ $app = t::Helper->t->app;
+ $app->asset('change.css' => '/sass/issue-62.scss');
+ like + ($app->asset->get('change.css', {assets => 1}))[0]->slurp, qr{\#ddd}, 'updated';
+
+ modify($scss_file, sub {s!ddd!ccc!});
+}
+
done_testing;
sub modify {