This conversion was actually done with phoenix master, the week before phoenix 4 released.
- Erlang 17.0
- Elixir 0.15.0
- Phoenix master, "55577a267a1635af3d19fb5c37381077bd25e484"
-
Create a new Phoenix app.
Recommend giving it the same name as the target.
I created a new app:
YourApp
, while my target app isThor
-
Reorganize config dir
- move config dir to
Thor
. - rename all confix files to extension .exs
- copy contents of new app config files into target app config files.
- update values in config files as needed.
- note the app name is in the config line:
config :phoenix, Thor.Router,
- copy
locales
from new app to config dir.
- move config dir to
-
Make a
web
directory under target app. In this example,/thor/web
-
Copy to
web
directory- directories:
controllers
,models
,queries
,templates
andviews
- files: router.ex, views.ex
- copy i18n.ex from new app.
- directories:
-
Edit files, rename directories in
web
directory.- controllers: rename files to singular.
- controllers: module name is
PageController
- templates: rename sub dirs to singular
- views: rename files to singular in this form:
page_view.ex
- views: module name changes to
Thor.PageView
- router.ex: change controller names as
Thor.PageController
- views.ex: I just copied the contents of the new app
views.ex
file.
-
Edit mix.exs:
Here are some key dependencies.
-
project:
elixir: "~> 0.15.0", elixirc_paths: ["lib", "web"],
-
deps:
{:phoenix, github: "phoenixframework/phoenix"}, {:cowboy, "~> 1.0.0"}, {:postgrex, "~> 0.5.4"}, {:ecto, "~> 0.2.3"},
-
-
Everything else goes in lib. (probably where it was before)
just a quick note that I've upgraded my phoenix application from to 0.4 version from the one before that, and all of the things described above were not necessary.
Only thing that needed to be changed was the elixir version to 1.0.0-rc1.