Ensure naming of files during app and dockerfile generation is consistent #1918
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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