-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow generating --dev projects outside Phoenix source #1224
Allow generating --dev projects outside Phoenix source #1224
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
--dev
flag throws an error if the generated project is not inside theinstaller
directory 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
--dev
flag would work properly anywhere if I just changed the path to Phoenix to an absolute one in the project’smix.exs
file.So, I removed the code that checks if the project path is inside
phoenix/installer
and simply returned the absolute path to the Phoenix source when the--dev
flag 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.ex
quite a bit. What do you think? Did I miss anything?