Hello community, here is the log from the commit of package perl-Mojolicious for openSUSE:Factory checked in at 2017-04-17 10:23:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old) and /work/SRC/openSUSE:Factory/.perl-Mojolicious.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious" Mon Apr 17 10:23:03 2017 rev:66 rq:486680 version:7.30 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes 2017-03-18 20:47:31.255630468 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Mojolicious.new/perl-Mojolicious.changes 2017-04-17 10:23:05.709542053 +0200 @@ -1,0 +2,15 @@ +Fri Apr 7 06:15:17 UTC 2017 - co...@suse.com + +- updated to 7.30 + see /usr/share/doc/packages/perl-Mojolicious/Changes + + 7.30 2017-04-04 + - Deprecated Mojo::Server::Morbo::watch in favor of + Mojo::Server::Morbo::Backend::Poll::watch. (marcus) + - Added support for pluggable Morbo backends. (marcus) + - Added Mojo::Server::Morbo::Backend and Mojo::Server::Morbo::Backend::Poll + modules. (marcus) + - Added backend attribute to Mojo::Server::Morbo. (marcus) + - Added -b option to Morbo. (marcus) + +------------------------------------------------------------------- Old: ---- Mojolicious-7.29.tar.gz New: ---- Mojolicious-7.30.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojolicious.spec ++++++ --- /var/tmp/diff_new_pack.QSFTZs/_old 2017-04-17 10:23:06.653408381 +0200 +++ /var/tmp/diff_new_pack.QSFTZs/_new 2017-04-17 10:23:06.657407814 +0200 @@ -17,7 +17,7 @@ Name: perl-Mojolicious -Version: 7.29 +Version: 7.30 Release: 0 %define cpan_name Mojolicious Summary: Real-time web framework ++++++ Mojolicious-7.29.tar.gz -> Mojolicious-7.30.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/Changes new/Mojolicious-7.30/Changes --- old/Mojolicious-7.29/Changes 2017-03-12 13:14:41.000000000 +0100 +++ new/Mojolicious-7.30/Changes 2017-04-04 17:06:11.000000000 +0200 @@ -1,4 +1,13 @@ +7.30 2017-04-04 + - Deprecated Mojo::Server::Morbo::watch in favor of + Mojo::Server::Morbo::Backend::Poll::watch. (marcus) + - Added support for pluggable Morbo backends. (marcus) + - Added Mojo::Server::Morbo::Backend and Mojo::Server::Morbo::Backend::Poll + modules. (marcus) + - Added backend attribute to Mojo::Server::Morbo. (marcus) + - Added -b option to Morbo. (marcus) + 7.29 2017-03-12 - Added support for overriding configuration files in applications tested with Test::Mojo. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/MANIFEST new/Mojolicious-7.30/MANIFEST --- old/Mojolicious-7.29/MANIFEST 2017-03-15 00:27:16.000000000 +0100 +++ new/Mojolicious-7.30/MANIFEST 2017-04-06 14:03:34.000000000 +0200 @@ -57,6 +57,8 @@ lib/Mojo/Server/Daemon.pm lib/Mojo/Server/Hypnotoad.pm lib/Mojo/Server/Morbo.pm +lib/Mojo/Server/Morbo/Backend.pm +lib/Mojo/Server/Morbo/Backend/Poll.pm lib/Mojo/Server/Prefork.pm lib/Mojo/Server/PSGI.pm lib/Mojo/Template.pm @@ -196,6 +198,7 @@ t/mojo/lib/Mojo/LoaderTest/A.pm t/mojo/lib/Mojo/LoaderTest/B.pm t/mojo/lib/Mojo/LoaderTest/C.pm +t/mojo/lib/Mojo/Server/Morbo/Backend/TestBackend.pm t/mojo/lib/Mojo/TestConnectProxy.pm t/mojo/lib/myapp.pl t/mojo/loader.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/META.json new/Mojolicious-7.30/META.json --- old/Mojolicious-7.29/META.json 2017-03-15 00:27:16.000000000 +0100 +++ new/Mojolicious-7.30/META.json 2017-04-06 14:03:33.000000000 +0200 @@ -58,6 +58,6 @@ }, "x_IRC" : "irc://irc.perl.org/#mojo" }, - "version" : "7.29", + "version" : "7.30", "x_serialization_backend" : "JSON::PP version 2.27400" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/META.yml new/Mojolicious-7.30/META.yml --- old/Mojolicious-7.29/META.yml 2017-03-15 00:27:16.000000000 +0100 +++ new/Mojolicious-7.30/META.yml 2017-04-06 14:03:33.000000000 +0200 @@ -31,5 +31,5 @@ homepage: http://mojolicious.org license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/kraih/mojo.git -version: '7.29' +version: '7.30' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/README.md new/Mojolicious-7.30/README.md --- old/Mojolicious-7.29/README.md 2017-02-22 15:58:25.000000000 +0100 +++ new/Mojolicious-7.30/README.md 2017-03-22 19:08:08.000000000 +0100 @@ -99,4 +99,4 @@ ## Want to know more? - Take a look at our excellent [documentation](http://mojolicious.org/perldoc>)! + Take a look at our excellent [documentation](http://mojolicious.org/perldoc)! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/lib/Mojo/Server/Morbo/Backend/Poll.pm new/Mojolicious-7.30/lib/Mojo/Server/Morbo/Backend/Poll.pm --- old/Mojolicious-7.29/lib/Mojo/Server/Morbo/Backend/Poll.pm 1970-01-01 01:00:00.000000000 +0100 +++ new/Mojolicious-7.30/lib/Mojo/Server/Morbo/Backend/Poll.pm 2017-04-04 17:02:28.000000000 +0200 @@ -0,0 +1,72 @@ +package Mojo::Server::Morbo::Backend::Poll; +use Mojo::Base 'Mojo::Server::Morbo::Backend'; + +use Mojo::File 'path'; + +sub modified_files { + my $self = shift; + + sleep $self->watch_timeout; + my $cache = $self->{cache} ||= {}; + my @files; + for my $file (map { -f $_ && -r _ ? $_ : _list($_) } @{$self->watch}) { + my ($size, $mtime) = (stat $file)[7, 9]; + next unless defined $size and defined $mtime; + my $stats = $cache->{$file} ||= [$^T, $size]; + next if $mtime <= $stats->[0] && $size == $stats->[1]; + @$stats = ($mtime, $size); + push @files, $file; + } + + return \@files; +} + +sub _list { path(shift)->list_tree->map('to_string')->each } + +1; + +=encoding utf8 + +=head1 NAME + +Mojo::Server::Morbo::Backend::Poll - Morbo default backend + +=head1 SYNOPSIS + + use Mojo::Server::Morbo::Backend::Poll; + + my $backend = Mojo::Server::Morbo::Backend::Poll->new; + if (my $files = $backend->modified_files) { + ... + } + +=head1 DESCRIPTION + +L<Mojo::Server::Morbo::Backend:Poll> is the default backend for +L<Mojo::Server::Morbo>. + +=head1 ATTRIBUTES + +L<Mojo::Server::Morbo::Backend::Poll> inherits all attributes from +L<Mojo::Server::Morbo::Backend>. + +=head1 METHODS + +L<Mojo::Server::Morbo::Backend::Poll> inherits all methods from +L<Mojo::Server::Morbo::Backend> and implements the following new ones. + +=head2 modified_files + + my $files = $backend->modified_files; + +Check file size and mtime to determine which files have changed, this is not +particularly efficient, but very portable. + + # All files that have been modified + say for @{$backend->modified_files}; + +=head1 SEE ALSO + +L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicious.org>. + +=cut diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/lib/Mojo/Server/Morbo/Backend.pm new/Mojolicious-7.30/lib/Mojo/Server/Morbo/Backend.pm --- old/Mojolicious-7.29/lib/Mojo/Server/Morbo/Backend.pm 1970-01-01 01:00:00.000000000 +0100 +++ new/Mojolicious-7.30/lib/Mojo/Server/Morbo/Backend.pm 2017-04-04 16:56:14.000000000 +0200 @@ -0,0 +1,75 @@ +package Mojo::Server::Morbo::Backend; +use Mojo::Base -base; + +use Carp 'croak'; + +has watch => sub { [qw(lib templates)] }; +has watch_timeout => sub { $ENV{MOJO_MORBO_TIMEOUT} || 1 }; + +sub modified_files { + croak 'Method "modified_files" not implemented by subclass'; +} + +1; + +=encoding utf8 + +=head1 NAME + +Mojo::Server::Morbo::Backend - Morbo backend base class + +=head1 SYNOPSIS + + package Mojo::Server::Morbo::Backend::Inotify: + use Mojo::Base 'Mojo::Server::Morbo::Backend'; + + sub modified_files {...} + +=head1 DESCRIPTION + +L<Mojo::Server::Morbo::Backend> is an abstract base class for Morbo backends, +like L<Mojo::Server::Morbo::Backend::Poll>. + +=head1 ATTRIBUTES + +L<Mojo::Server::Morbo::Backend> implements the following attributes. + +=head2 watch + + my $watch = $backend->watch; + $backend = $backend->watch(['/home/sri/my_app']); + +Files and directories to watch for changes, defaults to the application script +as well as the C<lib> and C<templates> directories in the current working +directory. + +=head2 watch_timeout + + my $timeout = $backend->watch_timeout; + $backend = $backend->watch_timeout(10); + +Maximum amount of time in seconds a backend may block when waiting for files to +change, defaults to the value of the C<MOJO_MORBO_TIMEOUT> environment variable +or C<1>. + +=head1 METHODS + +L<Mojo::Server::Morbo::Backend> inherits all methods from L<Mojo::Base> and +implements the following new ones. + +=head2 modified_files + + my $files = $backend->modified_files; + +Check if files from L</"watch"> have been modified since the last check and +return an array reference with the results. Meant to be overloaded in a +subclass. + + # All files that have been modified + say for @{$backend->modified_files}; + +=head1 SEE ALSO + +L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicious.org>. + +=cut diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/lib/Mojo/Server/Morbo.pm new/Mojolicious-7.30/lib/Mojo/Server/Morbo.pm --- old/Mojolicious-7.29/lib/Mojo/Server/Morbo.pm 2017-02-22 14:59:23.000000000 +0100 +++ new/Mojolicious-7.30/lib/Mojo/Server/Morbo.pm 2017-04-04 17:02:14.000000000 +0200 @@ -4,29 +4,19 @@ # "Linda: With Haley's Comet out of ice, Earth is experiencing the devastating # effects of sudden, intense global warming. # Morbo: Morbo is pleased but sticky." -use Mojo::File 'path'; +use Mojo::Loader 'load_class'; use Mojo::Server::Daemon; +use Mojo::Util 'deprecated'; use POSIX 'WNOHANG'; +has backend => sub { + my $backend = $ENV{MOJO_MORBO_BACKEND} || 'Poll'; + $backend = "Mojo::Server::Morbo::Backend::$backend"; + return $backend->new unless my $e = load_class $backend; + die $e if ref $e; + die qq{Can't find Morbo backend class "$backend" in \@INC. (@INC)\n}; +}; has daemon => sub { Mojo::Server::Daemon->new }; -has watch => sub { [qw(lib templates)] }; - -sub modified_files { - my $self = shift; - - my $cache = $self->{cache} ||= {}; - my @files; - for my $file (map { -f $_ && -r _ ? $_ : _list($_) } @{$self->watch}) { - my ($size, $mtime) = (stat $file)[7, 9]; - next unless defined $size and defined $mtime; - my $stats = $cache->{$file} ||= [$^T, $size]; - next if $mtime <= $stats->[0] && $size == $stats->[1]; - @$stats = ($mtime, $size); - push @files, $file; - } - - return \@files; -} sub run { my ($self, $app) = @_; @@ -36,7 +26,7 @@ $self->{finished} = 1; kill 'TERM', $self->{worker} if $self->{worker}; }; - unshift @{$self->watch}, $0 = $app; + unshift @{$self->backend->watch}, $0 = $app; $self->{modified} = 1; # Prepare and cache listen sockets for smooth restarting @@ -46,12 +36,17 @@ exit 0; } -sub _list { path(shift)->list_tree->map('to_string')->each } +# DEPRECATED! +sub watch { + deprecated 'Mojo::Server::Morbo::watch is DEPRECATED' + . ' in favor of Mojo::Server::Morbo::Backend::Poll::watch'; + shift->backend->watch(@_); +} sub _manage { my $self = shift; - if (my @files = @{$self->modified_files}) { + if (my @files = @{$self->backend->modified_files}) { say @files == 1 ? qq{File "@{[$files[0]]}" changed, restarting.} : qq{@{[scalar @files]} files changed, restarting.} @@ -65,7 +60,6 @@ } $self->_spawn if !$self->{worker} && delete $self->{modified}; - sleep 1; } sub _spawn { @@ -78,7 +72,7 @@ # Worker my $daemon = $self->daemon; - $daemon->load_app($self->watch->[0]); + $daemon->load_app($self->backend->watch->[0]); $daemon->ioloop->recurring(1 => sub { shift->stop unless kill 0, $manager }); $daemon->run; exit 0; @@ -135,6 +129,13 @@ L<Mojo::Server::Morbo> implements the following attributes. +=head2 backend + + my $backend = $morbo->backend; + $morbo = $morbo->backend(Mojo::Server::Morbo::Backend::Poll->new); + +Backend, usually a L<Mojo::Server::Morbo::Backend::Poll> object. + =head2 daemon my $daemon = $morbo->daemon; @@ -142,30 +143,11 @@ L<Mojo::Server::Daemon> object this server manages. -=head2 watch - - my $watch = $morbo->watch; - $morbo = $morbo->watch(['/home/sri/my_app']); - -Files and directories to watch for changes, defaults to the application script -as well as the C<lib> and C<templates> directories in the current working -directory. - =head1 METHODS L<Mojo::Server::Morbo> inherits all methods from L<Mojo::Base> and implements the following new ones. -=head2 modified_files - - my $files = $morbo->modified_files; - -Check if files from L</"watch"> have been modified since the last check and -return an array reference with the results. - - # All files that have been modified - say for @{$morbo->modified_files}; - =head2 run $morbo->run('script/my_app'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/lib/Mojolicious/Guides.pod new/Mojolicious-7.30/lib/Mojolicious/Guides.pod --- old/Mojolicious-7.29/lib/Mojolicious/Guides.pod 2017-01-24 19:55:50.000000000 +0100 +++ new/Mojolicious-7.30/lib/Mojolicious/Guides.pod 2017-04-04 17:07:57.000000000 +0200 @@ -347,6 +347,14 @@ =item * L<Mojo::Server::Morbo> +=item * L<Mojo::Server::Morbo::Backend> + +=over 2 + +=item * L<Mojo::Server::Morbo::Backend::Poll> + +=back + =item * L<Mojo::Template> =item * L<Mojo::URL> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/lib/Mojolicious.pm new/Mojolicious-7.30/lib/Mojolicious.pm --- old/Mojolicious-7.29/lib/Mojolicious.pm 2017-03-12 13:08:54.000000000 +0100 +++ new/Mojolicious-7.30/lib/Mojolicious.pm 2017-04-03 15:46:24.000000000 +0200 @@ -58,7 +58,7 @@ has validator => sub { Mojolicious::Validator->new }; our $CODENAME = 'Doughnut'; -our $VERSION = '7.29'; +our $VERSION = '7.30'; sub AUTOLOAD { my $self = shift; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/script/morbo new/Mojolicious-7.30/script/morbo --- old/Mojolicious-7.29/script/morbo 2017-01-19 21:19:08.000000000 +0100 +++ new/Mojolicious-7.30/script/morbo 2017-04-04 16:44:32.000000000 +0200 @@ -5,16 +5,17 @@ use Mojo::Util qw(extract_usage getopt); getopt - 'h|help' => \my $help, - 'l|listen=s' => \my @listen, - 'm|mode=s' => \$ENV{MOJO_MODE}, - 'v|verbose' => \$ENV{MORBO_VERBOSE}, - 'w|watch=s' => \my @watch; + 'b|backend=s' => \$ENV{MOJO_MORBO_BACKEND}, + 'h|help' => \my $help, + 'l|listen=s' => \my @listen, + 'm|mode=s' => \$ENV{MOJO_MODE}, + 'v|verbose' => \$ENV{MORBO_VERBOSE}, + 'w|watch=s' => \my @watch; die extract_usage if $help || !(my $app = shift); my $morbo = Mojo::Server::Morbo->new; $morbo->daemon->listen(\@listen) if @listen; -$morbo->watch(\@watch) if @watch; +$morbo->backend->watch(\@watch) if @watch; $morbo->run($app); =encoding utf8 @@ -34,6 +35,8 @@ morbo -w /usr/local/lib -w public -w myapp.conf ./myapp.pl Options: + -b, --backend <name> Morbo backend to use for reloading, defaults + to "Poll" -h, --help Show this message -l, --listen <location> One or more locations you want to listen on, defaults to the value of MOJO_LISTEN or diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/t/mojo/date.t new/Mojolicious-7.30/t/mojo/date.t --- old/Mojolicious-7.29/t/mojo/date.t 2016-07-19 02:38:18.000000000 +0200 +++ new/Mojolicious-7.30/t/mojo/date.t 2017-04-04 14:39:25.000000000 +0200 @@ -77,6 +77,8 @@ is "$date", 'Sun, 06 Nov 1994 08:49:37 GMT', 'right format'; $date = Mojo::Date->new(1305280824); is $date->to_string, 'Fri, 13 May 2011 10:00:24 GMT', 'right format'; +$date = Mojo::Date->new('1305280824.23'); +is $date->to_string, 'Fri, 13 May 2011 10:00:24 GMT', 'right format'; # Current time roundtrips my $before = time; @@ -92,7 +94,7 @@ is(Mojo::Date->new('Thu, 01 Jan 1970 00:00:00 GMT')->epoch, 0, 'right epoch value'); -# Negative epoch value +# No epoch value $date = Mojo::Date->new; ok $date->parse('Mon, 01 Jan 1900 00:00:00'), 'right format'; is $date->epoch, undef, 'no epoch value'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/t/mojo/file.t new/Mojolicious-7.30/t/mojo/file.t --- old/Mojolicious-7.29/t/mojo/file.t 2017-03-07 22:17:16.000000000 +0100 +++ new/Mojolicious-7.30/t/mojo/file.t 2017-04-04 16:39:37.000000000 +0200 @@ -169,7 +169,8 @@ @files = map { path($lib)->child(split '/') } ( 'BaseTest', 'DeprecationTest.pm', 'LoaderException.pm', 'LoaderException2.pm', - 'LoaderTest', 'TestConnectProxy.pm' + 'LoaderTest', 'Server', + 'TestConnectProxy.pm' ); is_deeply path($lib)->list({dir => 1})->map('to_string')->to_array, \@files, 'right files'; @@ -185,7 +186,8 @@ 'BaseTest/Base3.pm', 'DeprecationTest.pm', 'LoaderException.pm', 'LoaderException2.pm', 'LoaderTest/A.pm', 'LoaderTest/B.pm', - 'LoaderTest/C.pm', 'TestConnectProxy.pm' + 'LoaderTest/C.pm', 'Server/Morbo/Backend/TestBackend.pm', + 'TestConnectProxy.pm' ); is_deeply path($lib)->list_tree->map('to_string')->to_array, \@files, 'right files'; @@ -194,13 +196,15 @@ is_deeply path($lib)->list_tree({hidden => 1})->map('to_string')->to_array, [@hidden, @files], 'right files'; my @all = map { path($lib)->child(split '/') } ( - '.hidden.txt', '.test', - '.test/hidden.txt', 'BaseTest', - 'BaseTest/Base1.pm', 'BaseTest/Base2.pm', - 'BaseTest/Base3.pm', 'DeprecationTest.pm', - 'LoaderException.pm', 'LoaderException2.pm', - 'LoaderTest', 'LoaderTest/A.pm', - 'LoaderTest/B.pm', 'LoaderTest/C.pm', + '.hidden.txt', '.test', + '.test/hidden.txt', 'BaseTest', + 'BaseTest/Base1.pm', 'BaseTest/Base2.pm', + 'BaseTest/Base3.pm', 'DeprecationTest.pm', + 'LoaderException.pm', 'LoaderException2.pm', + 'LoaderTest', 'LoaderTest/A.pm', + 'LoaderTest/B.pm', 'LoaderTest/C.pm', + 'Server', 'Server/Morbo', + 'Server/Morbo/Backend', 'Server/Morbo/Backend/TestBackend.pm', 'TestConnectProxy.pm' ); is_deeply path($lib)->list_tree({dir => 1, hidden => 1})->map('to_string') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/t/mojo/lib/Mojo/Server/Morbo/Backend/TestBackend.pm new/Mojolicious-7.30/t/mojo/lib/Mojo/Server/Morbo/Backend/TestBackend.pm --- old/Mojolicious-7.29/t/mojo/lib/Mojo/Server/Morbo/Backend/TestBackend.pm 1970-01-01 01:00:00.000000000 +0100 +++ new/Mojolicious-7.30/t/mojo/lib/Mojo/Server/Morbo/Backend/TestBackend.pm 2017-04-04 16:38:02.000000000 +0200 @@ -0,0 +1,6 @@ +package Mojo::Server::Morbo::Backend::TestBackend; +use Mojo::Base 'Mojo::Server::Morbo::Backend'; + +sub modified_files { return ['always_changed'] } + +1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/t/mojo/morbo.t new/Mojolicious-7.30/t/mojo/morbo.t --- old/Mojolicious-7.29/t/mojo/morbo.t 2017-01-09 18:47:43.000000000 +0100 +++ new/Mojolicious-7.30/t/mojo/morbo.t 2017-04-04 16:42:13.000000000 +0200 @@ -8,6 +8,8 @@ unless $ENV{TEST_MORBO}; use FindBin; +use lib "$FindBin::Bin/lib"; + use IO::Socket::INET; use Mojo::File 'tempdir'; use Mojo::IOLoop::Server; @@ -20,8 +22,9 @@ my $dir = tempdir; my $script = $dir->child('myapp.pl'); my $subdir = $dir->child('test', 'stuff')->make_path; -my $morbo = Mojo::Server::Morbo->new(watch => [$subdir, $script]); -is_deeply $morbo->modified_files, [], 'no files have changed'; +my $morbo = Mojo::Server::Morbo->new(); +$morbo->backend->watch([$subdir, $script]); +is_deeply $morbo->backend->modified_files, [], 'no files have changed'; $script->spurt(<<EOF); use Mojolicious::Lite; @@ -63,7 +66,7 @@ app->start; EOF -is_deeply $morbo->modified_files, [$script], 'file has changed'; +is_deeply $morbo->backend->modified_files, [$script], 'file has changed'; ok((stat $script)[9] > $mtime, 'modify time has changed'); is((stat $script)[7], $size, 'still equal size'); sleep 3; @@ -82,7 +85,7 @@ # Update script without changing mtime ($size, $mtime) = (stat $script)[7, 9]; -is_deeply $morbo->modified_files, [], 'no files have changed'; +is_deeply $morbo->backend->modified_files, [], 'no files have changed'; $script->spurt(<<EOF); use Mojolicious::Lite; @@ -93,7 +96,7 @@ app->start; EOF utime $mtime, $mtime, $script; -is_deeply $morbo->modified_files, [$script], 'file has changed'; +is_deeply $morbo->backend->modified_files, [$script], 'file has changed'; ok((stat $script)[9] == $mtime, 'modify time has not changed'); isnt((stat $script)[7], $size, 'size has changed'); sleep 3; @@ -111,12 +114,13 @@ is $tx->res->body, 'Hello!', 'right content'; # New file(s) -is_deeply $morbo->modified_files, [], 'directory has not changed'; +is_deeply $morbo->backend->modified_files, [], 'directory has not changed'; my @new = map { $subdir->child("$_.txt") } qw/test testing/; $_->spurt('whatever') for @new; -is_deeply $morbo->modified_files, \@new, 'two files have changed'; +is_deeply $morbo->backend->modified_files, \@new, 'two files have changed'; $subdir->child('.hidden.txt')->spurt('whatever'); -is_deeply $morbo->modified_files, [], 'directory has not changed again'; +is_deeply $morbo->backend->modified_files, [], + 'directory has not changed again'; # Broken symlink SKIP: { @@ -128,7 +132,7 @@ ok !-f $broken, 'symlink target does not exist'; my $warned; local $SIG{__WARN__} = sub { $warned++ }; - is_deeply $morbo->modified_files, [], 'directory has not changed'; + is_deeply $morbo->backend->modified_files, [], 'directory has not changed'; ok !$warned, 'no warnings'; } @@ -136,6 +140,16 @@ kill 'INT', $pid; sleep 1 while _port($port); +# Custom backend +{ + local $ENV{MOJO_MORBO_BACKEND} = 'TestBackend'; + my $test_morbo = Mojo::Server::Morbo->new; + isa_ok $test_morbo->backend, 'Mojo::Server::Morbo::Backend::TestBackend', + 'right backend'; + is_deeply $test_morbo->backend->modified_files, ['always_changed'], + 'always changes'; +} + # SO_REUSEPORT SKIP: { skip 'SO_REUSEPORT support required!', 2 unless eval { _reuse_port() }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.29/t/pod_coverage.t new/Mojolicious-7.30/t/pod_coverage.t --- old/Mojolicious-7.29/t/pod_coverage.t 2017-01-09 18:47:43.000000000 +0100 +++ new/Mojolicious-7.30/t/pod_coverage.t 2017-04-04 16:39:05.000000000 +0200 @@ -9,5 +9,5 @@ # DEPRECATED! my @deprecated - = qw(files is_status_class lib_dir parse parts rel_dir slurp spurt); + = qw(files is_status_class lib_dir parse parts rel_dir slurp spurt watch); all_pod_coverage_ok({also_private => \@deprecated});