Skip to content

Remove unused installer template bindings - #6786

Open
rhcarvalho wants to merge 1 commit into
phoenixframework:mainfrom
praialabs:installer-unused-template-bindings
Open

Remove unused installer template bindings#6786
rhcarvalho wants to merge 1 commit into
phoenixframework:mainfrom
praialabs:installer-unused-template-bindings

Conversation

@rhcarvalho

Copy link
Copy Markdown
Contributor

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant