From e57c2ad03999e128363f5fd4d50505d7818428f6 Mon Sep 17 00:00:00 2001 From: Kieran Thackeray Date: Mon, 21 Feb 2022 18:37:33 +0000 Subject: [PATCH] Ensure the naming of files during app and dockerfile generation is consistent --- lib/Mojolicious.pm | 4 ++-- lib/Mojolicious/Command/Author/generate/app.pm | 2 +- t/mojo/daemon.t | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Mojolicious.pm b/lib/Mojolicious.pm index 36a18a30b2..089e59731e 100644 --- a/lib/Mojolicious.pm +++ b/lib/Mojolicious.pm @@ -35,7 +35,7 @@ has log => sub { }; has 'max_request_size'; has mode => sub { $ENV{MOJO_MODE} || $ENV{PLACK_ENV} || 'development' }; -has moniker => sub { Mojo::Util::decamelize ref shift }; +has moniker => sub { Mojo::Util::class_to_file ref shift }; has plugins => sub { Mojolicious::Plugins->new }; has preload_namespaces => sub { [] }; has renderer => sub { Mojolicious::Renderer->new }; @@ -425,7 +425,7 @@ variables or C. $app = $app->moniker('foo_bar'); Moniker of this application, often used as default filename for configuration files and the like, defaults to -decamelizing the application class with L. +transforming the application class with L. =head2 plugins diff --git a/lib/Mojolicious/Command/Author/generate/app.pm b/lib/Mojolicious/Command/Author/generate/app.pm index 1d40159530..7206dd857a 100644 --- a/lib/Mojolicious/Command/Author/generate/app.pm +++ b/lib/Mojolicious/Command/Author/generate/app.pm @@ -19,7 +19,7 @@ sub run { $self->render_to_rel_file('appclass', "$name/lib/$app", {class => $class}); # Config file (using the default moniker) - $self->render_to_rel_file('config', "$name/@{[decamelize $class]}.yml"); + $self->render_to_rel_file('config', "$name/$name.yml"); # Controller my $controller = "${class}::Controller::Example"; diff --git a/t/mojo/daemon.t b/t/mojo/daemon.t index 58567febb7..934226a70c 100644 --- a/t/mojo/daemon.t +++ b/t/mojo/daemon.t @@ -270,7 +270,7 @@ subtest 'Timeout' => sub { subtest 'Pipelined' => sub { my $daemon = Mojo::Server::Daemon->new({listen => ['http://127.0.0.1'], silent => 1}); my $port = $daemon->start->ports->[0]; - is $daemon->app->moniker, 'mojo-hello_world', 'right moniker'; + is $daemon->app->moniker, 'mojo_hello_world', 'right moniker'; my $buffer = ''; my $id; $id = Mojo::IOLoop->client(