| 1 | package Clustericious::Command::morbo; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use 5.010001; | ||
| 6 | use base qw( Clustericious::Command ); | ||
| 7 | use Mojolicious::Command::daemon; | ||
| 8 | use File::Which qw( which ); | ||
| 9 | use Capture::Tiny qw( capture ); | ||
| 10 | |||
| 11 | # ABSTRACT: Clustericious command to stat nginx | ||
| 12 | our $VERSION = '1.29'; # VERSION | ||
| 13 | |||
| 14 | |||
| 15 | sub description { 'Start application with Morbo server' }; | ||
| 16 | sub usage { | ||
| 17 | state $usage; | ||
| 18 | |||
| 19 | unless($usage) | ||
| 20 | { | ||
| 21 | my $command = which 'morbo'; | ||
| 22 | die "morbo not found!" unless defined $command; | ||
| 23 | my($out, $err) = capture { system $command, '--help' }; | ||
| 24 | $usage = $err; | ||
| 25 | } | ||
| 26 | |||
| 27 | $usage; | ||
| 28 | }; | ||
| 29 | |||
| 30 | sub run | ||
| 31 | { | ||
| 32 | my($self, @args) = @_; | ||
| 33 | |||
| 34 | if(my $url = $self->app->config->{url}) | ||
| 35 | { | ||
| 36 | unshift @args, -l => $url; | ||
| 37 | } | ||
| 38 | |||
| 39 | my $command = which 'morbo'; | ||
| 40 | die "morbo not found!" unless defined $command; | ||
| 41 | |||
| 42 | exec $command, @args, $0; | ||
| 43 | } | ||
| 44 | |||
| 45 | 1; | ||
| 46 | |||
| 47 | __END__ |