Skip to content

Commit

Permalink
deprecated Mojolicious::Commands->start in favor of Mojolicious::Comm…
Browse files Browse the repository at this point in the history
…ands->start_app
  • Loading branch information
kraih committed Jan 5, 2013
1 parent 3b7848d commit 2779ed6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 29 deletions.
2 changes: 2 additions & 0 deletions Changes
@@ -1,5 +1,7 @@

3.73 2013-01-06
- Deprecated Mojolicious::Commands->start in favor of
Mojolicious::Commands->start_app.
- Improved name detection in Mojolicious::Plugin::Config.

3.72 2013-01-05
Expand Down
16 changes: 5 additions & 11 deletions lib/Mojolicious/Commands.pm
Expand Up @@ -109,7 +109,12 @@ sub run {
return print $self->hint;
}

# DEPRECATED in Rainbow!
sub start {
warn <<EOF;
Mojolicious::Commands->start is DEPRECATED in favor of
Mojolicious::Commands->start_app!!!
EOF
my $self = shift;
return $self->start_app($ENV{MOJO_APP} => @_) if $ENV{MOJO_APP};
return $self->new->app->start(@_);
Expand Down Expand Up @@ -317,17 +322,6 @@ Try to detect environment.
Load and run commands. Automatic deployment environment detection can be
disabled with the C<MOJO_NO_DETECT> environment variable.
=head2 C<start>
Mojolicious::Commands->start;
Mojolicious::Commands->start(@ARGV);
Start the command line interface for application from the value of the
C<MOJO_APP> environment variable or L<Mojo::HelloWorld>.
# Always start daemon and ignore @ARGV
Mojolicious::Commands->start('daemon', '-l', 'http://*:8080');
=head2 C<start_app>
Mojolicious::Commands->start_app('MyApp');
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Plugin/Config.pm
Expand Up @@ -39,10 +39,10 @@ sub register {
unless ($file) {

# Executable
if ($app->isa('Mojolicious::Lite')) { $file = basename($ENV{MOJO_EXE}) }
if ($app->isa('Mojolicious::Lite')) { $file = basename $ENV{MOJO_EXE} }

# Class
else { $file = decamelize(ref $app) }
else { $file = decamelize ref $app }

# Replace ".pl" and ".t" with default extension
$file =~ s/\.(?:pl|t)$//i;
Expand Down
2 changes: 1 addition & 1 deletion script/mojo
Expand Up @@ -7,7 +7,7 @@ use FindBin;
use lib "$FindBin::Bin/../lib";

require Mojolicious::Commands;
Mojolicious::Commands->start;
Mojolicious::Commands->start_app('Mojo::HelloWorld');

=head1 NAME
Expand Down
14 changes: 0 additions & 14 deletions t/mojolicious/commands.t
Expand Up @@ -34,26 +34,12 @@ is ref Mojolicious::Commands->run('psgi'), 'CODE', 'right reference';
is ref Mojolicious::Commands->start_app('MojoliciousTest'),
'MojoliciousTest', 'right class';
}
{
local $ENV{MOJO_APP_LOADER} = 1;
local $ENV{MOJO_APP} = 'MojoliciousTest';
is ref Mojolicious::Commands->start, 'MojoliciousTest', 'right class';
}
{
local $ENV{MOJO_APP_LOADER} = 1;
local $ENV{MOJO_APP};
is ref Mojolicious::Commands->start, 'Mojolicious::Lite', 'right class';
}

# Start application with command
{
is ref Mojolicious::Commands->start_app(MojoliciousTest => 'psgi'), 'CODE',
'right reference';
}
{
local $ENV{MOJO_APP};
is ref Mojolicious::Commands->start('psgi'), 'CODE', 'right reference';
}

# Start application with application specific command
my $app;
Expand Down
2 changes: 1 addition & 1 deletion t/pod_coverage.t
Expand Up @@ -8,7 +8,7 @@ plan skip_all => 'Test::Pod::Coverage 1.04 required for this test!'
unless eval 'use Test::Pod::Coverage 1.04; 1';

# DEPRECATED in Rainbow!
my @rainbow = qw(namespace);
my @rainbow = qw(namespace start);

# False positive constants
all_pod_coverage_ok({also_private => [@rainbow, qw(IPV6 TLS)]});

0 comments on commit 2779ed6

Please sign in to comment.