How to map project directory in Homestead.yaml using relative path

旧时模样 提交于 2019-12-08 06:02:11

问题


I have a per-project installation of Homestead in my Laravel project, using the guide at https://laravel.com/docs/5.4/homestead#per-project-installation.

I want the Homestead.yaml file to map the project directory as a folder accessible in the Vagrant VM.

I want to do this such that the Homestead.yaml file can be shared between development machines without alteration.

The Homestead.yaml file is in the project directory as is the Vagrantfile file.

Therefore I want to identify the project directory relatively, rather than by its full path.

Something like:

folders:
    -
        map: %CurrentDir%
        to: /home/vagrant/Code/project

(I invented %CurrentDir% for the sake of this example.)

Or even better without hardcoding the name of the project directory.

I'm on Windows and would prefer a platform-agnostic solution.

How can I do this?


回答1:


This works on macOSX w/ vagrant 2.0.1 / homestead 6.5:

folders:
    -
        map: ./
        to: /home/vagrant/code/project



回答2:


On Windows 10 this works:

folders:
    -
        map: %CurrentDir%
        to: /home/vagrant/Code/project

Yet to test on another platform...



来源:https://stackoverflow.com/questions/44070043/how-to-map-project-directory-in-homestead-yaml-using-relative-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!