trogne
trogne

Reputation: 3552

using homestead globally, with specific homestead and vagrant folder

I'm want to use homestead globally, but I don't want my ".homestead" directory to be at C:\Users\patri\.homestead

I'd like that to be at D:\vbox\.homestead

Also, when running homestead up, I'd like homestead to look for boxes aleady downloaded there : D:\vbox.vagrant.d\boxes It's because I already have numerous boxes, and homestead will redownload the same boxes and add them in ".vagrant" folder under C:\Users\patri\.homestead

Is this possible ?

I'm on windows 10.

Upvotes: 1

Views: 760

Answers (1)

trogne
trogne

Reputation: 3552

Instead of doing composer global require "laravel/homestead=~2.0", I'm installing with git : git clone https://github.com/laravel/homestead.git.

Then, inside of homestead/vendor/bin, I had a homestead.bat :

@echo off

set cwd=%cd%
set homesteadVagrant=D:\htdocs\laracasts\Homestead

cd /d %homesteadVagrant% && vagrant %*
cd /d %cwd%

set cwd=
set homesteadVagrant=

I then add homestead/vendor/bin to my path.

Now I can use homestead everywhere.

For vagrant, the VAGRANT_HOME environement variable set to D:\vbox.vagrant.d

Edit: The homestead.bat is simply using vagrant globally. So you won't have the edit optionn. To have it you could do this :

@echo off

set cwd=%cd%
set homesteadVagrant=D:\htdocs\laracasts\Homestead

if "%1" == "edit" goto end

cd /d %homesteadVagrant% && vagrant %*
cd /d %cwd%

:end
cd /d %homesteadVagrant% && start t Homestead.yaml
cd /d %cwd%

set cwd=
set homesteadVagrant=

Upvotes: 4

Related Questions