Hello community,
here is the log from the commit of package perl-Mojolicious for
openSUSE:Factory checked in at 2020-07-20 21:04:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old)
and /work/SRC/openSUSE:Factory/.perl-Mojolicious.new.3592 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious"
Mon Jul 20 21:04:32 2020 rev:139 rq:821877 version:8.57
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes
2020-06-30 22:25:37.647998675 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Mojolicious.new.3592/perl-Mojolicious.changes
2020-07-20 21:06:20.261395040 +0200
@@ -1,0 +2,13 @@
+Sat Jul 18 03:10:07 UTC 2020 - Tina Müller <[email protected]>
+
+- updated to 8.57
+ see /usr/share/doc/packages/perl-Mojolicious/Changes
+
+ 8.57 2020-07-16
+ - Added support for YAML config files.
+ - Added module Mojolicious::Plugin::NotYAMLConfig.
+ - Improved app generator command to use a YAML config file.
+ - Fixed a bug in proxy helpers that caused response content to be ignored
in some cases. (mohawk2)
+ - Fixed attr_is bug in Test::Mojo that prevented false value comparisons
from working correctly. (tim-2)
+
+-------------------------------------------------------------------
Old:
----
Mojolicious-8.56.tar.gz
New:
----
Mojolicious-8.57.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Mojolicious.spec ++++++
--- /var/tmp/diff_new_pack.Kt0cAl/_old 2020-07-20 21:06:21.333396126 +0200
+++ /var/tmp/diff_new_pack.Kt0cAl/_new 2020-07-20 21:06:21.333396126 +0200
@@ -17,7 +17,7 @@
Name: perl-Mojolicious
-Version: 8.56
+Version: 8.57
Release: 0
%define cpan_name Mojolicious
Summary: Real-time web framework
++++++ Mojolicious-8.56.tar.gz -> Mojolicious-8.57.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/Changes new/Mojolicious-8.57/Changes
--- old/Mojolicious-8.56/Changes 2020-06-26 22:06:45.000000000 +0200
+++ new/Mojolicious-8.57/Changes 2020-07-16 19:44:34.000000000 +0200
@@ -1,4 +1,11 @@
+8.57 2020-07-16
+ - Added support for YAML config files.
+ - Added module Mojolicious::Plugin::NotYAMLConfig.
+ - Improved app generator command to use a YAML config file.
+ - Fixed a bug in proxy helpers that caused response content to be ignored in
some cases. (mohawk2)
+ - Fixed attr_is bug in Test::Mojo that prevented false value comparisons
from working correctly. (tim-2)
+
8.56 2020-06-19
- Fixed a bug that prevented "% end, begin" to work in Mojo::Template.
(jberger)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/MANIFEST
new/Mojolicious-8.57/MANIFEST
--- old/Mojolicious-8.56/MANIFEST 2020-06-26 22:07:54.000000000 +0200
+++ new/Mojolicious-8.57/MANIFEST 2020-07-17 11:07:34.000000000 +0200
@@ -116,6 +116,7 @@
lib/Mojolicious/Plugin/HeaderCondition.pm
lib/Mojolicious/Plugin/JSONConfig.pm
lib/Mojolicious/Plugin/Mount.pm
+lib/Mojolicious/Plugin/NotYAMLConfig.pm
lib/Mojolicious/Plugin/TagHelpers.pm
lib/Mojolicious/Plugins.pm
lib/Mojolicious/Renderer.pm
@@ -353,6 +354,11 @@
t/mojolicious/upload_stream_lite_app.t
t/mojolicious/validation_lite_app.t
t/mojolicious/websocket_lite_app.t
+t/mojolicious/yaml_config_lite_app.t
+t/mojolicious/yaml_config_lite_app.yaml
+t/mojolicious/yaml_config_lite_app.yml
+t/mojolicious/yaml_config_lite_app_abs.development.yml
+t/mojolicious/yaml_config_lite_app_abs.yml
t/pod.t
t/pod_coverage.t
t/test/mojo.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/META.json
new/Mojolicious-8.57/META.json
--- old/Mojolicious-8.56/META.json 2020-06-26 22:07:54.000000000 +0200
+++ new/Mojolicious-8.57/META.json 2020-07-17 11:07:34.000000000 +0200
@@ -63,6 +63,6 @@
"web" : "https://webchat.freenode.net/#mojo"
}
},
- "version" : "8.56",
- "x_serialization_backend" : "JSON::PP version 4.04"
+ "version" : "8.57",
+ "x_serialization_backend" : "JSON::PP version 4.05"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/META.yml
new/Mojolicious-8.57/META.yml
--- old/Mojolicious-8.56/META.yml 2020-06-26 22:07:54.000000000 +0200
+++ new/Mojolicious-8.57/META.yml 2020-07-17 11:07:34.000000000 +0200
@@ -34,5 +34,5 @@
homepage: https://mojolicious.org
license: http://www.opensource.org/licenses/artistic-license-2.0
repository: https://github.com/mojolicious/mojo.git
-version: '8.56'
+version: '8.57'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/lib/Mojo/DOM.pm
new/Mojolicious-8.57/lib/Mojo/DOM.pm
--- old/Mojolicious-8.56/lib/Mojo/DOM.pm 2020-06-19 22:05:41.000000000
+0200
+++ new/Mojolicious-8.57/lib/Mojo/DOM.pm 2020-07-16 18:19:08.000000000
+0200
@@ -936,6 +936,8 @@
# "foo\nbaz\n"
$dom->parse("<div>foo\n<p>bar</p>baz\n</div>")->at('div')->text;
+To extract text content from all descendant nodes see L</"all_text">.
+
=head2 to_string
my $str = $dom->to_string;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/lib/Mojo/Promise.pm
new/Mojolicious-8.57/lib/Mojo/Promise.pm
--- old/Mojolicious-8.56/lib/Mojo/Promise.pm 2020-06-19 22:05:28.000000000
+0200
+++ new/Mojolicious-8.57/lib/Mojo/Promise.pm 2020-07-13 00:05:22.000000000
+0200
@@ -269,7 +269,7 @@
get_p('https://mojolicious.org')->then(sub {
my $mojo = shift;
say $mojo->res->code;
- return get('https://metacpan.org');
+ return get_p('https://metacpan.org');
})->then(sub {
my $cpan = shift;
say $cpan->res->code;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.56/lib/Mojolicious/Command/Author/generate/app.pm
new/Mojolicious-8.57/lib/Mojolicious/Command/Author/generate/app.pm
--- old/Mojolicious-8.56/lib/Mojolicious/Command/Author/generate/app.pm
2020-06-19 22:05:48.000000000 +0200
+++ new/Mojolicious-8.57/lib/Mojolicious/Command/Author/generate/app.pm
2020-07-17 01:45:54.000000000 +0200
@@ -19,7 +19,7 @@
$self->render_to_rel_file('appclass', "$name/lib/$app", {class => $class});
# Config file (using the default moniker)
- $self->render_to_rel_file('config', "$name/@{[decamelize $class]}.conf");
+ $self->render_to_rel_file('config', "$name/@{[decamelize $class]}.yml");
# Controller
my $controller = "${class}::Controller::Example";
@@ -124,8 +124,8 @@
sub startup {
my $self = shift;
- # Load configuration from hash returned by config file
- my $config = $self->plugin('Config');
+ # Load configuration from config file
+ my $config = $self->plugin('NotYAMLConfig');
# Configure the application
$self->secrets($config->{secrets});
@@ -197,6 +197,6 @@
@@ config
% use Mojo::Util qw(sha1_sum steady_time);
-{
- secrets => ['<%= sha1_sum $$ . steady_time . rand %>']
-}
+---
+secrets:
+ - <%= sha1_sum $$ . steady_time . rand %>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/lib/Mojolicious/Guides/Cookbook.pod
new/Mojolicious-8.57/lib/Mojolicious/Guides/Cookbook.pod
--- old/Mojolicious-8.56/lib/Mojolicious/Guides/Cookbook.pod 2020-06-14
18:18:32.000000000 +0200
+++ new/Mojolicious-8.57/lib/Mojolicious/Guides/Cookbook.pod 2020-07-16
19:39:08.000000000 +0200
@@ -236,8 +236,8 @@
app->start;
-Or just add a C<hypnotoad> section to your L<Mojolicious::Plugin::Config> or
L<Mojolicious::Plugin::JSONConfig>
-configuration file.
+Or just add a C<hypnotoad> section to your L<Mojolicious::Plugin::Config>,
L<Mojolicious::Plugin::JSONConfig> or
+L<Mojolicious::Plugin::NotYAMLConfig> configuration file.
# myapp.conf
{
@@ -1125,6 +1125,16 @@
my $ua = Mojo::UserAgent->new;
say $ua->get('https://sri:[email protected]/hideout')->result->body;
+If you're using L<Mojo::URL> to build the URL, be aware that the userinfo part
will not be included if the object is
+stringified. You'll have to pass the object itself to L<Mojo::UserAgent> or
use L<Mojo::URL/"to_unsafe_string">.
+
+ use Mojo::UserAgent;
+ use Mojo::URL;
+
+ my $ua = Mojo::UserAgent->new;
+ my $url =
Mojo::URL->new('https://example.com/hideout')->userinfo('sri:secret');
+ say $ua->get($url)->result->body;
+
=head2 Decorating follow-up requests
L<Mojo::UserAgent> can automatically follow redirects, the event
L<Mojo::UserAgent/"start"> allows you direct access to
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/lib/Mojolicious/Guides/FAQ.pod
new/Mojolicious-8.57/lib/Mojolicious/Guides/FAQ.pod
--- old/Mojolicious-8.56/lib/Mojolicious/Guides/FAQ.pod 2020-06-14
18:18:32.000000000 +0200
+++ new/Mojolicious-8.57/lib/Mojolicious/Guides/FAQ.pod 2020-07-16
19:37:45.000000000 +0200
@@ -92,8 +92,8 @@
No, you can't, L<Hypnotoad|Mojo::Server::Hypnotoad> is a bit special in this
regard. Because when you initiate a zero
downtime software upgrade (hot deployment), you are only really sending a
C<USR2> signal to the already running server,
-and no other information can be passed along. What you can do instead, is to
use a L<Mojolicious::Plugin::Config> or
-L<Mojolicious::Plugin::JSONConfig> configuration file.
+and no other information can be passed along. What you can do instead, is to
use a L<Mojolicious::Plugin::Config>,
+L<Mojolicious::Plugin::JSONConfig> or L<Mojolicious::Plugin::NotYAMLConfig>
configuration file.
# myapp.conf
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/lib/Mojolicious/Guides/Growing.pod
new/Mojolicious-8.57/lib/Mojolicious/Guides/Growing.pod
--- old/Mojolicious-8.56/lib/Mojolicious/Guides/Growing.pod 2020-06-14
18:18:32.000000000 +0200
+++ new/Mojolicious-8.57/lib/Mojolicious/Guides/Growing.pod 2020-07-17
01:46:04.000000000 +0200
@@ -136,7 +136,7 @@
| +- MyApp # Application namespace
| +- Controller # Controller namespace
| +- Example.pm # Controller class
- |- my_app.conf # Configuration file
+ |- my_app.yml # Configuration file
|- t # Test directory
| +- basic.t # Random test
|- log # Log directory
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/lib/Mojolicious/Guides.pod
new/Mojolicious-8.57/lib/Mojolicious/Guides.pod
--- old/Mojolicious-8.56/lib/Mojolicious/Guides.pod 2020-06-14
18:18:32.000000000 +0200
+++ new/Mojolicious-8.57/lib/Mojolicious/Guides.pod 2020-07-16
19:36:27.000000000 +0200
@@ -426,6 +426,12 @@
=item * L<Mojolicious::Plugin::JSONConfig>
+=over 2
+
+=item * L<Mojolicious::Plugin::NotYAMLConfig>
+
+=back
+
=back
=item * L<Mojolicious::Plugin::DefaultHelpers>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.56/lib/Mojolicious/Plugin/DefaultHelpers.pm
new/Mojolicious-8.57/lib/Mojolicious/Plugin/DefaultHelpers.pm
--- old/Mojolicious-8.56/lib/Mojolicious/Plugin/DefaultHelpers.pm
2020-06-19 22:05:45.000000000 +0200
+++ new/Mojolicious-8.57/lib/Mojolicious/Plugin/DefaultHelpers.pm
2020-07-13 00:07:22.000000000 +0200
@@ -189,7 +189,8 @@
my $write = $source_content->is_chunked ? 'write_chunk' : 'write';
$source_content->unsubscribe('read')->on(
read => sub {
- $content->$write(pop) and $tx->resume;
+ my $data = pop;
+ $content->$write(length $data ? $data : ()) and $tx->resume;
# Throttle transparently when backpressure rises
return if $stream->can_write;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.56/lib/Mojolicious/Plugin/NotYAMLConfig.pm
new/Mojolicious-8.57/lib/Mojolicious/Plugin/NotYAMLConfig.pm
--- old/Mojolicious-8.56/lib/Mojolicious/Plugin/NotYAMLConfig.pm
1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-8.57/lib/Mojolicious/Plugin/NotYAMLConfig.pm
2020-07-17 01:46:42.000000000 +0200
@@ -0,0 +1,123 @@
+package Mojolicious::Plugin::NotYAMLConfig;
+use Mojo::Base 'Mojolicious::Plugin::JSONConfig';
+
+use CPAN::Meta::YAML;
+use Mojo::Util qw(decode encode);
+
+sub register {
+ my ($self, $app, $conf) = @_;
+
+ $conf->{ext} //= 'yml';
+ $self->{yaml} = sub { CPAN::Meta::YAML::Load(decode 'UTF-8', shift) };
+ if (my $mod = $conf->{module}) {
+ die qq{YAML module $mod has no Load function} unless $self->{yaml} =
$mod->can('Load');
+ }
+
+ return $self->SUPER::register($app, $conf);
+}
+
+sub parse {
+ my ($self, $content, $file, $conf, $app) = @_;
+ my $config = eval { $self->{yaml}->(encode('UTF-8', $self->render($content,
$file, $conf, $app))) };
+ die qq{Can't parse config "$file": $@} if $@;
+ die qq{Invalid config "$file"} unless ref $config eq 'HASH';
+ return $config;
+}
+
+1;
+
+=encoding utf8
+
+=head1 NAME
+
+Mojolicious::Plugin::NotYAMLConfig - Not quite YAML configuration plugin
+
+=head1 SYNOPSIS
+
+ # myapp.yml (it's just YAML with embedded Perl)
+ ---
+ foo: bar
+ baz:
+ - ♥
+ music_dir: <%= app->home->child('music') %>
+
+ # Mojolicious
+ my $config = $app->plugin('NotYAMLConfig');
+ say $config->{foo};
+
+ # Mojolicious::Lite
+ my $config = plugin 'NotYAMLConfig';
+ say $config->{foo};
+
+ # foo.html.ep
+ %= config->{foo}
+
+ # The configuration is available application-wide
+ my $config = app->config;
+ say $config->{foo};
+
+ # Everything can be customized with options
+ my $config = plugin NotYAMLConfig => {file => '/etc/myapp.conf'};
+
+=head1 DESCRIPTION
+
+L<Mojolicious::Plugin::NotYAMLConfig> is a YAML configuration plugin that
preprocesses its input with L<Mojo::Template>.
+By default it uses L<CPAN::Meta::YAML> for parsing, which is not the best YAML
module available, but good enough for
+most config files. If you need something more correct you can use a different
module like L<YAML::XS> with the
+L</"module"> option.
+
+The application object can be accessed via C<$app> or the C<app> function. A
default configuration filename in the
+application home directory will be generated from the value of
L<Mojolicious/"moniker"> (C<$moniker.yml>). You can
+extend the normal configuration file C<$moniker.yml> with C<mode> specific
ones like C<$moniker.$mode.yml>, which will
+be detected automatically.
+
+If the configuration value C<config_override> has been set in
L<Mojolicious/"config"> when this plugin is loaded, it
+will not do anything.
+
+The code of this plugin is a good example for learning to build new plugins,
you're welcome to fork it.
+
+See L<Mojolicious::Plugins/"PLUGINS"> for a list of plugins that are available
by default.
+
+=head1 OPTIONS
+
+L<Mojolicious::Plugin::NotYAMLConfig> inherits all options from
L<Mojolicious::Plugin::JSONConfig> and supports the
+following new ones.
+
+=head2 module
+
+ # Mojolicious::Lite
+ plugin NotYAMLConfig => {module => 'YAML::PP'};
+
+Alternative YAML module to use for parsing.
+
+=head1 METHODS
+
+L<Mojolicious::Plugin::NotYAMLConfig> inherits all methods from
L<Mojolicious::Plugin::JSONConfig> and implements the
+following new ones.
+
+=head2 parse
+
+ $plugin->parse($content, $file, $conf, $app);
+
+Process content with L<Mojolicious::Plugin::JSONConfig/"render"> and parse it
with L<CPAN::Meta::YAML>.
+
+ sub parse {
+ my ($self, $content, $file, $conf, $app) = @_;
+ ...
+ $content = $self->render($content, $file, $conf, $app);
+ ...
+ return $hash;
+ }
+
+=head2 register
+
+ my $config = $plugin->register(Mojolicious->new);
+ my $config = $plugin->register(Mojolicious->new, {file => '/etc/foo.conf'});
+
+Register plugin in L<Mojolicious> application and merge configuration.
+
+=head1 SEE ALSO
+
+L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>.
+
+=cut
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/lib/Mojolicious/Plugins.pm
new/Mojolicious-8.57/lib/Mojolicious/Plugins.pm
--- old/Mojolicious-8.56/lib/Mojolicious/Plugins.pm 2020-06-19
22:05:43.000000000 +0200
+++ new/Mojolicious-8.57/lib/Mojolicious/Plugins.pm 2020-07-16
19:36:56.000000000 +0200
@@ -103,6 +103,10 @@
Mount whole L<Mojolicious> applications.
+=item L<Mojolicious::Plugin::NotYAMLConfig>
+
+YAML configuration files.
+
=item L<Mojolicious::Plugin::TagHelpers>
Template specific helper collection, loaded automatically.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/lib/Mojolicious.pm
new/Mojolicious-8.57/lib/Mojolicious.pm
--- old/Mojolicious-8.56/lib/Mojolicious.pm 2020-06-19 22:05:27.000000000
+0200
+++ new/Mojolicious-8.57/lib/Mojolicious.pm 2020-07-13 16:34:30.000000000
+0200
@@ -58,7 +58,7 @@
has validator => sub { Mojolicious::Validator->new };
our $CODENAME = 'Supervillain';
-our $VERSION = '8.56';
+our $VERSION = '8.57';
sub BUILD_DYNAMIC {
my ($class, $method, $dyn_methods) = @_;
@@ -123,7 +123,8 @@
# Routes
$plugins->emit_hook(before_routes => $c);
- $c->helpers->reply->not_found unless $tx->res->code ||
$self->routes->dispatch($c) || $tx->res->code;
+ $c->helpers->reply->not_found
+ unless $tx->res->code || $self->routes->dispatch($c) || $tx->res->code ||
$c->stash->{'mojo.rendered'};
}
sub handler {
@@ -941,7 +942,7 @@
Danijel Tasov
-Dagfinn Ilmari Mannsåker
+Dagfinn Ilmari Manns�ker
Danny Thomas
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/lib/Test/Mojo.pm
new/Mojolicious-8.57/lib/Test/Mojo.pm
--- old/Mojolicious-8.56/lib/Test/Mojo.pm 2020-06-19 22:05:27.000000000
+0200
+++ new/Mojolicious-8.57/lib/Test/Mojo.pm 2020-07-16 19:38:19.000000000
+0200
@@ -334,7 +334,7 @@
sub _attr {
my ($self, $selector, $attr) = @_;
return '' unless my $e = $self->tx->res->dom->at($selector);
- return $e->attr($attr) || '';
+ return $e->attr($attr) // '';
}
sub _build_ok {
@@ -950,8 +950,8 @@
Construct a new L<Test::Mojo> object. In addition to a class name or
L<Mojo::File> object pointing to the application
script, you can pass along a hash reference with configuration values that
will be used to override the application
configuration. The special configuration value C<config_override> will be set
in L<Mojolicious/"config"> as well, which
-is used to disable configuration plugins like L<Mojolicious::Plugin::Config>
and L<Mojolicious::Plugin::JSONConfig> for
-tests.
+is used to disable configuration plugins like L<Mojolicious::Plugin::Config>,
L<Mojolicious::Plugin::JSONConfig> and
+L<Mojolicious::Plugin::NotYAMLConfig> for tests.
# Load application script relative to the "t" directory
use Mojo::File qw(curfile);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/t/mojolicious/app.t
new/Mojolicious-8.57/t/mojolicious/app.t
--- old/Mojolicious-8.56/t/mojolicious/app.t 2020-06-19 22:06:25.000000000
+0200
+++ new/Mojolicious-8.57/t/mojolicious/app.t 2020-07-16 18:19:08.000000000
+0200
@@ -187,7 +187,7 @@
# Foo::joy (testing HTML attributes in template)
$t->get_ok('/fun/joy')->status_is(200)->attr_is('p.joy', 'style',
'background-color: darkred;')
- ->attr_is('p.joy', 'style', 'background-color: darkred;', 'with description')
+ ->attr_is('p.joy', 'style', 'background-color: darkred;', 'with
description')->attr_is('p.joy', 'data-foo', '0')
->attr_isnt('p.joy', 'style', 'float: left;')->attr_isnt('p.joy', 'style',
'float: left;', 'with description')
->attr_like('p.joy', 'style', qr/color/)->attr_like('p.joy', 'style',
qr/color/, 'with description')
->attr_unlike('p.joy', 'style', qr/^float/)->attr_unlike('p.joy', 'style',
qr/^float/, 'with description');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/t/mojolicious/commands.t
new/Mojolicious-8.57/t/mojolicious/commands.t
--- old/Mojolicious-8.56/t/mojolicious/commands.t 2020-06-19
22:06:24.000000000 +0200
+++ new/Mojolicious-8.57/t/mojolicious/commands.t 2020-07-17
01:46:47.000000000 +0200
@@ -273,7 +273,7 @@
ok -e $app->rel_file('my_app/script/my_app'), 'script
exists';
ok -e $app->rel_file('my_app/lib/MyApp.pm'), 'application
class exists';
ok -e $app->rel_file('my_app/lib/MyApp/Controller/Example.pm'), 'controller
exists';
-ok -e $app->rel_file('my_app/my_app.conf'), 'config file
exists';
+ok -e $app->rel_file('my_app/my_app.yml'), 'config file
exists';
ok -e $app->rel_file('my_app/t/basic.t'), 'test
exists';
ok -e $app->rel_file('my_app/public/index.html'), 'static file
exists';
ok -e $app->rel_file('my_app/templates/layouts/default.html.ep'), 'layout
exists';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/t/mojolicious/dispatcher_lite_app.t
new/Mojolicious-8.57/t/mojolicious/dispatcher_lite_app.t
--- old/Mojolicious-8.56/t/mojolicious/dispatcher_lite_app.t 2020-06-19
22:06:22.000000000 +0200
+++ new/Mojolicious-8.57/t/mojolicious/dispatcher_lite_app.t 2020-07-13
16:34:36.000000000 +0200
@@ -15,7 +15,7 @@
hook around_dispatch => sub {
my ($next, $c) = @_;
$next->();
- if ($c->res->code == 404) {
+ if ($c->res->code && $c->res->code == 404) {
$c->req->url->path($c->param('wrap') ? '/wrap/again' : '/');
delete @{$c->stash}{keys %{$c->stash}};
$c->tx->res(Mojo::Message::Response->new);
@@ -43,6 +43,17 @@
$c->render(text => 'Custom static file works!') if
$c->req->url->path->contains('/hello.txt');
};
+# Custom dispatcher /hello-delay.txt
+hook before_dispatch => sub {
+ my $c = shift;
+ if ($c->req->url->path->contains('/hello-delay.txt')) {
+ $c->render_later;
+ Mojo::IOLoop->next_tick(sub {
+ $c->render(text => 'Delayed!');
+ });
+ }
+};
+
# Custom dispatcher /custom
hook before_dispatch => sub {
my $c = shift;
@@ -121,6 +132,9 @@
# Override static file
$t->get_ok('/hello.txt')->status_is(200)->content_is('Custom static file
works!');
+# render_later from before_dispatch
+$t->get_ok('/hello-delay.txt')->status_is(200)->content_is('Delayed!');
+
# Custom dispatcher
$t->get_ok('/custom?a=works+too')->status_is(205)->content_is('works too');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.56/t/mojolicious/json_config_lite_app.t
new/Mojolicious-8.57/t/mojolicious/json_config_lite_app.t
--- old/Mojolicious-8.56/t/mojolicious/json_config_lite_app.t 2020-06-19
22:06:28.000000000 +0200
+++ new/Mojolicious-8.57/t/mojolicious/json_config_lite_app.t 2020-07-16
19:15:42.000000000 +0200
@@ -10,34 +10,37 @@
use Mojo::File qw(curfile);
use Mojolicious::Lite;
-# Default
-app->config(it => 'works');
-is_deeply app->config, {it => 'works'}, 'right value';
-
-# Invalid config file
-eval { plugin JSONConfig => {file => 'public/hello.txt'} };
-like $@, qr/JSON/, 'right error';
-
-# Load plugins
-my $config = plugin j_s_o_n_config => {default => {foo => 'baz', hello =>
'there'}};
-my $path = curfile->sibling('json_config_lite_app_abs.json');
-plugin JSONConfig => {file => $path};
-is $config->{foo}, 'bar', 'right value';
-is $config->{hello}, 'there', 'right value';
-is $config->{utf}, 'утф', 'right value';
-is $config->{absolute}, 'works too!', 'right value';
-is $config->{absolute_dev}, 'dev works too!', 'right value';
-is app->config->{foo}, 'bar', 'right value';
-is app->config->{hello}, 'there', 'right value';
-is app->config->{utf}, 'утф', 'right value';
-is app->config->{absolute}, 'works too!', 'right value';
-is app->config->{absolute_dev}, 'dev works too!', 'right value';
-is app->config('foo'), 'bar', 'right value';
-is app->config('hello'), 'there', 'right value';
-is app->config('utf'), 'утф', 'right value';
-is app->config('absolute'), 'works too!', 'right value';
-is app->config('absolute_dev'), 'dev works too!', 'right value';
-is app->config('it'), 'works', 'right value';
+subtest 'Default' => sub {
+ app->config(it => 'works');
+ is_deeply app->config, {it => 'works'}, 'right value';
+};
+
+subtest 'Invalid config file' => sub {
+ eval { plugin JSONConfig => {file => 'public/hello.txt'} };
+ like $@, qr/JSON/, 'right error';
+};
+
+subtest 'Load plugins' => sub {
+ my $config = plugin j_s_o_n_config => {default => {foo => 'baz', hello =>
'there'}};
+ my $path = curfile->sibling('json_config_lite_app_abs.json');
+ plugin JSONConfig => {file => $path};
+ is $config->{foo}, 'bar', 'right value';
+ is $config->{hello}, 'there', 'right value';
+ is $config->{utf}, 'утф', 'right value';
+ is $config->{absolute}, 'works too!', 'right value';
+ is $config->{absolute_dev}, 'dev works too!', 'right value';
+ is app->config->{foo}, 'bar', 'right value';
+ is app->config->{hello}, 'there', 'right value';
+ is app->config->{utf}, 'утф', 'right value';
+ is app->config->{absolute}, 'works too!', 'right value';
+ is app->config->{absolute_dev}, 'dev works too!', 'right value';
+ is app->config('foo'), 'bar', 'right value';
+ is app->config('hello'), 'there', 'right value';
+ is app->config('utf'), 'утф', 'right value';
+ is app->config('absolute'), 'works too!', 'right value';
+ is app->config('absolute_dev'), 'dev works too!', 'right value';
+ is app->config('it'), 'works', 'right value';
+};
get '/' => 'index';
@@ -45,19 +48,19 @@
$t->get_ok('/')->status_is(200)->content_is("barbar\n");
-# No config file, default only
-$config = plugin JSONConfig => {file => 'nonexistent', default => {foo =>
'qux'}};
-is $config->{foo}, 'qux', 'right value';
-is app->config->{foo}, 'qux', 'right value';
-is app->config('foo'), 'qux', 'right value';
-is app->config('it'), 'works', 'right value';
+subtest 'No config file, default only' => sub {
+ my $config = plugin JSONConfig => {file => 'nonexistent', default => {foo =>
'qux'}};
+ is $config->{foo}, 'qux', 'right value';
+ is app->config->{foo}, 'qux', 'right value';
+ is app->config('foo'), 'qux', 'right value';
+ is app->config('it'), 'works', 'right value';
+};
-# No config file, no default
-{
+subtest 'No config file, no default' => sub {
ok !(eval { plugin JSONConfig => {file => 'nonexistent'} }), 'no config
file';
local $ENV{MOJO_CONFIG} = 'nonexistent';
ok !(eval { plugin 'JSONConfig' }), 'no config file';
-}
+};
done_testing();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.56/t/mojolicious/lib/MojoliciousTest/Foo.pm
new/Mojolicious-8.57/t/mojolicious/lib/MojoliciousTest/Foo.pm
--- old/Mojolicious-8.56/t/mojolicious/lib/MojoliciousTest/Foo.pm
2020-06-14 18:18:32.000000000 +0200
+++ new/Mojolicious-8.57/t/mojolicious/lib/MojoliciousTest/Foo.pm
2020-07-16 16:46:49.000000000 +0200
@@ -103,7 +103,7 @@
<p>Have fun!</p>\
@@ foo/joy.html.ep
-<p class="joy" style="background-color: darkred;">Joy for all!</p>\
+<p class="joy" style="background-color: darkred;" data-foo="0">Joy for
all!</p>\
@@ just/some/template.html.epl
Development template with high precedence.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/t/mojolicious/proxy_app.t
new/Mojolicious-8.57/t/mojolicious/proxy_app.t
--- old/Mojolicious-8.56/t/mojolicious/proxy_app.t 2020-06-19
22:06:23.000000000 +0200
+++ new/Mojolicious-8.57/t/mojolicious/proxy_app.t 2020-07-13
00:07:25.000000000 +0200
@@ -57,6 +57,14 @@
Mojo::IOLoop->stream($c->tx->connection)->close;
}
);
+$r->get(
+ '/res6' => sub {
+ my $c = shift;
+ $c->res->headers->content_length(4);
+ $c->write;
+ Mojo::IOLoop->timer(0.1 => sub { $c->write("Six!") });
+ }
+);
get '/proxy1/*target' => sub {
my $c = shift;
@@ -100,6 +108,7 @@
->header_is('X-Mojo-More' => '')->header_is('X-Mojo-Body' =>
0)->content_is('Three!');
$t->get_ok('/proxy1/res4')->status_is(204)->header_is('X-Mojo-App' =>
'Four')->content_is('');
$t->get_ok('/proxy1/res5')->status_is(400)->content_like(qr/Error: /);
+$t->get_ok('/proxy1/res6')->status_is(200)->content_is('Six!');
# Custom request
$t->patch_ok('/proxy2/res3')->status_is(200)->header_is('X-Mojo-App' =>
'Three')->header_is('X-Mojo-Method' => 'POST')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.56/t/mojolicious/yaml_config_lite_app.t
new/Mojolicious-8.57/t/mojolicious/yaml_config_lite_app.t
--- old/Mojolicious-8.56/t/mojolicious/yaml_config_lite_app.t 1970-01-01
01:00:00.000000000 +0100
+++ new/Mojolicious-8.57/t/mojolicious/yaml_config_lite_app.t 2020-07-17
01:47:05.000000000 +0200
@@ -0,0 +1,86 @@
+use Mojo::Base -strict;
+
+BEGIN {
+ $ENV{MOJO_MODE} = 'development';
+ $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll';
+}
+
+use Test::Mojo;
+use Test::More;
+use Mojo::File qw(curfile);
+use Mojolicious::Lite;
+
+subtest 'Default' => sub {
+ app->config(it => 'works');
+ is_deeply app->config, {it => 'works'}, 'right value';
+};
+
+subtest 'Invalid config file' => sub {
+ eval { plugin NotYAMLConfig => {file => 'public/hello.txt'} };
+ like $@, qr/Can't parse config/, 'right error';
+};
+
+subtest 'Load plugins' => sub {
+ my $config = plugin NotYAMLConfig => {default => {foo => 'baz', hello =>
'there'}};
+ my $path = curfile->sibling('yaml_config_lite_app_abs.yml');
+ plugin NotYAMLConfig => {file => $path};
+ is $config->{foo}, 'barbaz', 'right
value';
+ is $config->{hello}, 'there', 'right
value';
+ is $config->{utf}, 'утф', 'right
value';
+ is $config->{absolute}, 'works too!!!', 'right
value';
+ is $config->{absolute_dev}, 'dev works too yaml_config_lite_app!!!', 'right
value';
+ is app->config->{foo}, 'barbaz',
'right value';
+ is app->config->{hello}, 'there',
'right value';
+ is app->config->{utf}, 'утф',
'right value';
+ is app->config->{absolute}, 'works too!!!',
'right value';
+ is app->config->{absolute_dev}, 'dev works too yaml_config_lite_app!!!',
'right value';
+ is app->config('foo'), 'barbaz',
'right value';
+ is app->config('hello'), 'there',
'right value';
+ is app->config('utf'), 'утф',
'right value';
+ is app->config('absolute'), 'works too!!!',
'right value';
+ is app->config('absolute_dev'), 'dev works too yaml_config_lite_app!!!',
'right value';
+ is app->config('it'), 'works',
'right value';
+};
+
+get '/' => 'index';
+
+my $t = Test::Mojo->new;
+
+$t->get_ok('/')->status_is(200)->content_is("barbazbarbaz\n");
+
+subtest 'No config file, default only' => sub {
+ my $config = plugin NotYAMLConfig => {file => 'nonexistent', default => {foo
=> 'qux'}};
+ is $config->{foo}, 'qux', 'right value';
+ is app->config->{foo}, 'qux', 'right value';
+ is app->config('foo'), 'qux', 'right value';
+ is app->config('it'), 'works', 'right value';
+};
+
+subtest 'No config file, no default' => sub {
+ ok !(eval { plugin NotYAMLConfig => {file => 'nonexistent'} }), 'no config
file';
+ local $ENV{MOJO_CONFIG} = 'nonexistent';
+ ok !(eval { plugin 'NotYAMLConfig' }), 'no config file';
+};
+
+subtest 'YAML::XS' => sub {
+ plan skip_all => 'YAML::XS required!' unless eval "use YAML::XS; 1";
+ my $config
+ = plugin NotYAMLConfig => {module => 'YAML::XS', ext => 'yaml', default =>
{foo => 'baz', hello => 'there'}};
+ is $config->{foo}, 'yada', 'right value';
+ is $config->{hello}, 'there', 'right value';
+ is $config->{utf8}, 'утф', 'right value';
+ is app->config->{foo}, 'yada', 'right value';
+ is app->config->{hello}, 'there', 'right value';
+ is app->config->{utf8}, 'утф', 'right value';
+};
+
+subtest 'Missing YAML parser' => sub {
+ eval { plugin NotYAMLConfig => {module => 'ThisYAMLModuleDoesNotExist'} };
+ like $@, qr/YAML module ThisYAMLModuleDoesNotExist has no Load function/,
'right error';
+};
+
+done_testing();
+
+__DATA__
+@@ index.html.ep
+<%= config->{foo} %><%= config 'foo' %>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.56/t/mojolicious/yaml_config_lite_app.yaml
new/Mojolicious-8.57/t/mojolicious/yaml_config_lite_app.yaml
--- old/Mojolicious-8.56/t/mojolicious/yaml_config_lite_app.yaml
1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-8.57/t/mojolicious/yaml_config_lite_app.yaml
2020-07-17 01:48:47.000000000 +0200
@@ -0,0 +1,2 @@
+foo: yada
+utf8: утф
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.56/t/mojolicious/yaml_config_lite_app.yml
new/Mojolicious-8.57/t/mojolicious/yaml_config_lite_app.yml
--- old/Mojolicious-8.56/t/mojolicious/yaml_config_lite_app.yml 1970-01-01
01:00:00.000000000 +0100
+++ new/Mojolicious-8.57/t/mojolicious/yaml_config_lite_app.yml 2020-07-17
01:48:36.000000000 +0200
@@ -0,0 +1,3 @@
+%# Just a comment
+foo: barbaz
+utf: утф
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.56/t/mojolicious/yaml_config_lite_app_abs.development.yml
new/Mojolicious-8.57/t/mojolicious/yaml_config_lite_app_abs.development.yml
--- old/Mojolicious-8.56/t/mojolicious/yaml_config_lite_app_abs.development.yml
1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-8.57/t/mojolicious/yaml_config_lite_app_abs.development.yml
2020-07-16 19:23:26.000000000 +0200
@@ -0,0 +1,2 @@
+---
+absolute_dev: dev works too <%= app->moniker %>!!!
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.56/t/mojolicious/yaml_config_lite_app_abs.yml
new/Mojolicious-8.57/t/mojolicious/yaml_config_lite_app_abs.yml
--- old/Mojolicious-8.56/t/mojolicious/yaml_config_lite_app_abs.yml
1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-8.57/t/mojolicious/yaml_config_lite_app_abs.yml
2020-07-16 19:22:16.000000000 +0200
@@ -0,0 +1,2 @@
+---
+absolute: works <%= 'too' %>!!!
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.56/t/test/mojo.t
new/Mojolicious-8.57/t/test/mojo.t
--- old/Mojolicious-8.56/t/test/mojo.t 2020-06-19 22:05:57.000000000 +0200
+++ new/Mojolicious-8.57/t/test/mojo.t 2020-07-05 15:56:52.000000000 +0200
@@ -83,4 +83,12 @@
is_deeply \@args, ['is', 'Hello Test!', 'Hello Test!', 'some description'],
'right result';
};
+subtest 'attr_is' => sub {
+ $t->tx->res->body('<p id="test">Test</p>');
+ $t->attr_is('p', 'id', 'wrong');
+ is_deeply \@args, ['is', 'test', 'wrong', 'exact match for attribute "id" at
selector "p"'], 'right result';
+ $t->attr_is('p', 'id', 'wrong', 'some description');
+ is_deeply \@args, ['is', 'test', 'wrong', 'some description'], 'right
result';
+};
+
done_testing();