Allow generating --dev projects outside Phoenix source#1224
Allow generating --dev projects outside Phoenix source#1224jeffkreeftmeijer wants to merge 3 commits intophoenixframework:masterfrom jeffkreeftmeijer:dev-projects-outside-phoenix-directory
Conversation
|
Hey @jeffkreeftmeijer, the issue I ran with this was related to brunch. I believe brunch can't find your assets if you use absolute paths. Try scaffolding a resource in an app with --dev and see if the delete button works and see if Phoenix.Socket is there. |
|
And thanks for the PR! |
|
Hey @josevalim, thanks for the pointers and your quick reply. Brunch worked fine for me, so I did some testing and found that the assets were generated properly on Brunch 1.8.5, but not on earlier versions. So, depending on "^1.8.5" instead of "^1.8.1" would solve this issue. Do you want me to change that in package.json? |
|
Yes, please. I am also worried about this: This means the brunch file has a path to "../Users/jeff/..". It would be really weird if that is working. If you can check that too, it would be great, if not, I can check it before merging. Thank you! |
|
After some more testing, I found It works with a relative path, so I think our best bet is to reinstate Also, I tried finding something like Ruby's Pathname#relative_path_from in Elixir, but couldn't find it. Does a function like that exist, before I reinvent the wheel? |
|
We have At this point, I am wondering if it is worth to continue chasing this. The |
|
Yes, I found This seemed like a simple thing to do as my first patch, but I agree this has gotten out of hand a little, so I'll close this. Thanks a lot for your help! |
|
Thanks for exploring whether this could be changed! #1227 proposes adding more info to the README so the next person along doesn't have to re-discover it. :) |
Right now, generating a Phoenix project with the
--devflag throws an error if the generated project is not inside theinstallerdirectory in the Phoenix source;After poking around for a bit, I wasn’t able to find a reason for this, and I found that projects generated with the
--devflag would work properly anywhere if I just changed the path to Phoenix to an absolute one in the project’smix.exsfile.So, I removed the code that checks if the project path is inside
phoenix/installerand simply returned the absolute path to the Phoenix source when the--devflag is used, which results in this line in the generated mix.exs file;That eliminates the "--dev project must be inside Phoenix directory”-error and cleans up
installer/lib/phoenix_new.exquite a bit. What do you think? Did I miss anything?