Skip to content

Commit

Permalink
renamed check_files method to check
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 16, 2014
1 parent 55895d3 commit fd2e74f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Changes
Expand Up @@ -12,7 +12,7 @@
- Added format attribute to Mojo::Log.
- Added no_compression method to Mojo::Transaction::WebSocket.
- Added append method to Mojo::Log.
- Added check_files method to Mojo::Server::Morbo.
- Added check method to Mojo::Server::Morbo.
- Fixed Mojo::IOLoop::Server to work correctly with newer versions of
IO::Socket::SSL. (noxxi)
- Fixed warnings in Mojo::IOLoop::Delay.
Expand Down
8 changes: 4 additions & 4 deletions lib/Mojo/Server/Morbo.pm
Expand Up @@ -10,7 +10,7 @@ use POSIX 'WNOHANG';

has watch => sub { [qw(lib templates)] };

sub check_files {
sub check {
my $self = shift;

# Discover files
Expand Down Expand Up @@ -62,7 +62,7 @@ sub _check {
sub _manage {
my $self = shift;

if (defined(my $file = $self->check_files)) {
if (defined(my $file = $self->check)) {
say qq{File "$file" changed, restarting.} if $ENV{MORBO_VERBOSE};
kill 'TERM', $self->{running} if $self->{running};
$self->{modified} = 1;
Expand Down Expand Up @@ -156,9 +156,9 @@ directory.
L<Mojo::Server::Morbo> inherits all methods from L<Mojo::Base> and implements
the following new ones.
=head2 check_files
=head2 check
my $file = $morbo->check_files;
my $file = $morbo->check;
Check if file from L</"watch"> has been modified since last check and return
its name or C<undef> if there have been no changes.
Expand Down
8 changes: 4 additions & 4 deletions t/mojo/morbo.t
Expand Up @@ -25,7 +25,7 @@ use Socket qw(SO_REUSEPORT SOL_SOCKET);
my $dir = tempdir CLEANUP => 1;
my $script = catdir $dir, 'myapp.pl';
my $morbo = Mojo::Server::Morbo->new(watch => [$script]);
is $morbo->check_files, undef, 'file has not changed';
is $morbo->check, undef, 'file has not changed';
spurt <<EOF, $script;
use Mojolicious::Lite;
Expand Down Expand Up @@ -68,7 +68,7 @@ get '/hello' => {text => 'Hello World!'};
app->start;
EOF
is $morbo->check_files, $script, 'file has changed';
is $morbo->check, $script, 'file has changed';
ok((stat $script)[9] > $mtime, 'modify time has changed');
is((stat $script)[7], $size, 'still equal size');
sleep 3;
Expand All @@ -87,7 +87,7 @@ is $tx->res->body, 'Hello World!', 'right content';

# Update script without changing mtime
($size, $mtime) = (stat $script)[7, 9];
is $morbo->check_files, undef, 'file has not changed';
is $morbo->check, undef, 'file has not changed';
spurt <<EOF, $script;
use Mojolicious::Lite;
Expand All @@ -98,7 +98,7 @@ get '/hello' => {text => 'Hello!'};
app->start;
EOF
utime $mtime, $mtime, $script;
is $morbo->check_files, $script, 'file has changed';
is $morbo->check, $script, 'file has changed';
ok((stat $script)[9] == $mtime, 'modify time has not changed');
isnt((stat $script)[7], $size, 'size has changed');
sleep 3;
Expand Down

0 comments on commit fd2e74f

Please sign in to comment.