1package Toadfarm::Command::reload;
2use Mojo::Base 'Toadfarm::Command::start';
3
4has description => 'Toadfarm: Hot deploy or start the server';
5
6sub run {
7  my $self = shift;
8
9  if (grep {/^--tail/} @_) {
10    exec $self->_hypnotoad, $0 unless fork;    # start or hot reload
11    return $self->_tail(grep { !/^--tail/ } @_);
12  }
13
14  # reload
15  $self->_log_daemon_msg('Reloading the process %s');
16  system $self->_hypnotoad, $0;                # start or hot reload
17  $self->_end($? >> 8);
18}
19
201;
21
22=encoding utf8
23
24=head1 NAME
25
26Toadfarm::Command::reload - Reload a Toadfarm DSL script
27
28=head1 DESCRIPTION
29
30L<Toadfarm::Command::reload> is a command for reloading a L<Toadfarm>
31application.
32
33=head1 SYNOPSIS
34
35  $ /path/to/script.pl reload
36  $ /path/to/script.pl reload --tail <args>
37
38C<--tail> will pass the call L<Toadfarm::Command::tail> after issuing
39start/reload on C<script.pl>.
40
41=head1 ATTRIBUTES
42
43=head2 description
44
45Short description of command, used for the command list.
46
47=head1 METHODS
48
49=head2 run
50
51Run command.
52
53=head1 COPYRIGHT AND LICENSE
54
55Copyright (C) 2014, Jan Henning Thorsen
56
57This program is free software, you can redistribute it and/or modify it under
58the terms of the Artistic License version 2.0.
59
60=head1 AUTHOR
61
62Jan Henning Thorsen - C<jhthorsen@cpan.org>
63
64=cut
65