Remove unused installer template bindings - #6786
Open
rhcarvalho wants to merge 1 commit into
Open
Conversation
Following up on unifying `.gitignore` templates into a static file, an audit of all installer bindings was conducted to see if any variables eliminated from `.gitignore.eex` became unused repo-wide. While all variables from `.gitignore.eex` remain required by other templates, the audit uncovered two pre-existing unused bindings (`pubsub_server` and `root_app_name`), allowing us to clean them up along with their supporting code: - `pubsub_server`: Stopped being used in templates in commit 04398b6 (June 2019) when PubSub was moved into the application supervision tree and templates switched to referencing `<%= web_namespace %>.PubSub` directly. Remove `pubsub_server` from binding and delete the helper `get_pubsub_server/1`. - `root_app_name` / `root_app`: `root_app_name` was defined when umbrella generators were added in commit dad413f (Jan 2017), but templates have always used `@root_app_module` (`MyApp.Umbrella`) instead. Remove `root_app_name` from binding and drop the `root_app` struct field from `%Phx.New.Project{}`. - Helper cleanup: `Project.new/2` already initializes `root_mod` to `app_mod` (`Module.concat([opts[:module] || Macro.camelize(app)])`). In `Phx.New.Single`, `put_root_app/1` was computing the exact same value a second time to assign `root_mod`, making it a no-op. Remove `put_root_app/1` from `Single`, and rename `put_root_app/1` to `put_root_mod/1` in `Phx.New.Umbrella` where it actually overrides `root_mod` with the `MyApp.Umbrella` module name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Following up on unifying
.gitignoretemplates into a static file, an audit of all installer bindings was conducted to see if any variables eliminated from.gitignore.eexbecame unused repo-wide.While all variables from
.gitignore.eexremain required by other templates, the audit uncovered two pre-existing unused bindings (pubsub_serverandroot_app_name), allowing us to clean them up along with their supporting code:pubsub_server: Stopped being used in templates in commit 04398b6 (June 2019) when PubSub was moved into the application supervision tree and templates switched to referencing<%= web_namespace %>.PubSubdirectly. Removepubsub_serverfrom binding and delete the helperget_pubsub_server/1.root_app_name/root_app:root_app_namewas defined when umbrella generators were added in commit dad413f (Jan 2017), but templates have always used@root_app_module(MyApp.Umbrella) instead. Removeroot_app_namefrom binding and drop theroot_appstruct field from%Phx.New.Project{}.Helper cleanup:
Project.new/2already initializesroot_modtoapp_mod(Module.concat([opts[:module] || Macro.camelize(app)])). InPhx.New.Single,put_root_app/1was computing the exact same value a second time to assignroot_mod, making it a no-op. Removeput_root_app/1fromSingle, and renameput_root_app/1toput_root_mod/1inPhx.New.Umbrellawhere it actually overridesroot_modwith theMyApp.Umbrellamodule name.