-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure naming of files during app and dockerfile generation is consistent #1918
base: main
Are you sure you want to change the base?
Ensure naming of files during app and dockerfile generation is consistent #1918
Conversation
@@ -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 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change unfortunately. This has implications about how configuration files are loaded by default. I'd be fine changing this at a major version or at least in line with our breaking changes rules (though I would personally rather this be at a major version)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a process I should follow to put this forward for a major release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I support your stance @jberger that this is a breaking change and thus should be planned for a major release, it is also a question of definition: is the proposed change a change or a bugfix?
When looking over a couple of projects here I see that we usually end up overriding moniker
because of how the default moniker is generated (see example table from the PR description). So from that perspective if this change was to be implemented we no longer would have to set moniker
in our apps, because the problem with the auto-generated moniker would go away.
From that perspective I think it is fair to view this as a bugfix, and thus be considered for a minor-release.
0605239
to
e57c2ad
Compare
This proposed first step to resolution of #1905 has failed review on account of a breaking change. As any clean fix for this issue would necessitate a breaking change, I can't see a way to push this PR through. As such I'm closing. |
This PR has not failed review. There was just one objection. |
Noted on the closure: I didn't know how to proceed and wanted to avoid clogging the PR list. I'll be more patient. |
I'm not a maintainer, but IMO this is the cleanest solution to the problem - having two different ways to lowercase the app class name that both end up in the filesystem almost next to each other seems like it's worth making a breaking change next release (especially since I imagine the number of users affected is not huge, but even if it is, the discrepancy is kind of an eyesore). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Though I would like to see others weigh with their opinions on this is considered a bug or an ordinary change. See my reply to the comment made by @jberger .
I'm really unsure what to think about this. I'm leaning towards jberger's view that we should fix this in a major release. |
Summary
Mojo::Util::class_to_file()
for file names generated from class namesCurrently, if generating an app named
MyApp::HTMLBuilder
and its dockerfile, the following inconsistent naming is formed:class_to_file()
class_to_file()
decamelize()
decamelize()
This PR ensures only that
class_to_file()
is used consistently.Important - This change will break existing apps!
For an app generated before this change, the former, inconsistent naming of the files will be in place.
Steps for fixing:
my_app-original_app.yml
tomy_app_original_app.yml
Motivation
The goal of this PR is to ensure that naming files based on class names is predictable, by utilising only the
class_to_file()
function for this purpose - not mixing between that anddecamelize()
.Whilst there are other improvements to be made, I have left these to future PRs to avoid including too much change here. Once usage is standardised, the following further improvements might be considered.
class_to_file()
to produce unambiguous and reversible file namesdecamelize()
to produce output that is reversible withcamelize()
class_to_file()
are validReferences
#1905 - Generating Dockerfile refers to wrong script name