Skip to content

Commit

Permalink
Remove deprecated syntax on Elixir v1.19+
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jan 22, 2025
1 parent 4ebefb9 commit e93303e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion installer/lib/phx_new/ecto.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule Phx.New.Ecto do
app_path = Path.expand(project.base_path)
project_path = Path.dirname(Path.dirname(app_path))

%Project{project | in_umbrella?: true, app_path: app_path, project_path: project_path}
%{project | in_umbrella?: true, app_path: app_path, project_path: project_path}
end

def generate(%Project{} = project) do
Expand Down
2 changes: 1 addition & 1 deletion installer/lib/phx_new/generator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ defmodule Phx.New.Generator do
dev: dev
]

%Project{project | binding: binding}
%{project | binding: binding}
end

defp namespaced?(project) do
Expand Down
2 changes: 1 addition & 1 deletion installer/lib/phx_new/mailer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule Phx.New.Mailer do
app_path = Path.expand(project.base_path)
project_path = Path.dirname(Path.dirname(app_path))

%Project{project | in_umbrella?: true, app_path: app_path, project_path: project_path}
%{project | in_umbrella?: true, app_path: app_path, project_path: project_path}
end

def generate(%Project{} = project) do
Expand Down
10 changes: 5 additions & 5 deletions installer/lib/phx_new/single.ex
Original file line number Diff line number Diff line change
Expand Up @@ -100,29 +100,29 @@ defmodule Phx.New.Single do

def prepare_project(%Project{app: app, base_path: base_path} = project) when not is_nil(app) do
if in_umbrella?(base_path) do
%Project{project | in_umbrella?: true, project_path: Path.dirname(Path.dirname(base_path))}
%{project | in_umbrella?: true, project_path: Path.dirname(Path.dirname(base_path))}
else
%Project{project | in_umbrella?: false, project_path: base_path}
%{project | in_umbrella?: false, project_path: base_path}
end
|> put_app()
|> put_root_app()
|> put_web_app()
end

defp put_app(%Project{base_path: base_path} = project) do
%Project{project | app_path: base_path}
%{project | app_path: base_path}
end

defp put_root_app(%Project{app: app, opts: opts} = project) do
%Project{
%{
project
| root_app: app,
root_mod: Module.concat([opts[:module] || Macro.camelize(app)])
}
end

defp put_web_app(%Project{app: app} = project) do
%Project{
%{
project
| web_app: app,
lib_web_name: "#{app}_web",
Expand Down
6 changes: 3 additions & 3 deletions installer/lib/phx_new/umbrella.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ defmodule Phx.New.Umbrella do
project_path = Path.expand(project.base_path <> "_umbrella")
app_path = Path.join(project_path, "apps/#{project.app}")

%Project{project | in_umbrella?: true, app_path: app_path, project_path: project_path}
%{project | in_umbrella?: true, app_path: app_path, project_path: project_path}
end

def put_web(%Project{app: app, opts: opts} = project) do
web_app = :"#{app}_web"
web_namespace = Module.concat([opts[:web_module] || "#{project.app_mod}Web"])

%Project{
%{
project
| web_app: web_app,
lib_web_name: web_app,
Expand All @@ -46,7 +46,7 @@ defmodule Phx.New.Umbrella do
end

defp put_root_app(%Project{app: app} = project) do
%Project{
%{
project
| root_app: :"#{app}_umbrella",
root_mod: Module.concat(project.app_mod, "Umbrella")
Expand Down
2 changes: 1 addition & 1 deletion installer/lib/phx_new/web.ex
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ defmodule Phx.New.Web do
web_path = Path.expand(project.base_path)
project_path = Path.dirname(Path.dirname(web_path))

%Project{
%{
project
| in_umbrella?: true,
project_path: project_path,
Expand Down

0 comments on commit e93303e

Please sign in to comment.