Homestead 站点管理器,可快速将项目添加到您的 Homestead vagrant 和主机文件中
Tool for automating sites using Laravel Homestead. With one command, Homeboy will be able to:
You can also use homeboy to provision non-laravel websites!
On your local (non homestead) machine, Homeboy requires:
composer global require "kilroyweb/homeboy" dev-masterMake sure to place the $HOME/.composer/vendor/bin directory (or the equivalent directory for your OS) in your $PATH so the laravel executable can be located by your system.
Once installed, you can use homeboy command from anywhere on your system.
Run the setup command to generate a .env file
php homeboy setupcd ~
git clone https://github.com/kilroyweb/homeboy.git homeboycd homeboy
composer installRun the setup command to generate a .env file
php homeboy setupBy this point, you should be able to run homeboy within the directory using the command:
php homeboyOn mac (in ~/.bash_profile) add:
alias homeboy='php ~/homeboy/homeboy'On windows, an alias can be added using something like if using a tool like Cmder
homeboy=php C:\Users\[USER]\homeboy\homeboy $*be sure to edit the path based on where homeboy is installed
After running homeboy setup, you should have a .env file in your homeboy directory with a few defaults that have been generated.
These options will likely need to be updated based on your particular setup, details about each available setting are listed below:
Default option to determine if homeboy should create a new composer project
USE_COMPOSER=trueDefault package used when creating a composer project
DEFAULT_COMPOSER_PROJECT=laravel/laravelWhen hosting a new project, the default directory that nginx would define as the document root. For Laravel projects, by default this is "/public"
DEFAULT_FOLDER_SUFFIX=/publicWhen creating development domains, the default domain suffix given when a domain is generated
DEFAULT_DOMAIN_EXTENSION=.appThe location to your local hosts file that homeboy will add to when hosting new projects
This file will need to have permissions adjusted to be editable by homeboy
HOSTS_FILE_PATH=/etc/hostsThe ip address given to your homestead virtual machine. This is likely found in your Homestead.yaml file
HOMESTEAD_HOST_IP=192.168.10.10The location to your Homestead.yaml file. Homeboy will update this file's sites list and database list when creating new projects
HOMESTEAD_FILE_PATH=/Users/Username/Homestead/Homestead.yamlThe root path to your websites in your homestead virtual machine
HOMESTEAD_SITES_PATH=/home/vagrant/Code/The path to your Homestead directory
HOMESTEAD_BOX_PATH=/Users/Username/HomesteadThe path on your local machine to where you store your projects. Homeboy will cd into this directory when running "composer create-project ..."
LOCAL_SITES_PATH=/Users/Username/CodeIn Windows if you are running Homestead on a different drive, an extra command may be required to switch drives before cd'ing into your directory.
This option will cause Homeboy to ignore the option: HOMESTEAD_BOX_PATH
HOMESTEAD_ACCESS_DIRECTORY_COMMAND="cd /d D: && cd /Homestead"Similar to HOMESTEAD_ACCESS_DIRECTORY_COMMAND, In Windows if your root project directory is on a different drive, an extra command may be required to switch drives before cd'ing into your directory.
This option will cause Homeboy to ignore the option: LOCAL_SITES_PATH
ACCESS_LOCAL_SITES_DIRECTORY_COMMAND="cd /d D: && cd /Code"homeboy hostBecause this is the default command, you can run host by simply running:
homeboyRunning this command automates the task of creating a new composer project, updating your hosts file and vagrant files when provisioning a new website
When the command runs, it prompts for the sites directory name, database name, and dev url to update the needed files and then provisions vagrant
A few options have been added to speed up the command. However because the command "homeboy" is simply a shortcut for "homeboy host" (allowing us to add additional commands in the future), options only work when calling "homeboy host" rather than just "homeboy".
Some options available:
--use-defaults : Automatically accept defaults before provisioning--skip-confirmation : Automatically confirm before running task--name : Directory name to create project in--database : Database to add to homestead--domain : Development domainThe following example will run all tasks automatically without any question prompts:
homeboy host --name=my-project --use-defaults --skip-confirmationHomeboy also contains the "vagrant:run" command, allowing you to quickly run any vagrant command without having to cd into that directory, ie:
homeboy vagrant:run statusQuickly view a file contents by running:
homeboy file hostsor
homeboy file homesteadThe domain command lets you quickly add a new domain record to your hosts file.
homeboy domainThe composer:create-project command prompts you details on running a "composer create-project [composer-project] [project-name]" command
homeboy composer:create-projectYour host file will need to be writable by homeboy. In many cases this can be solved with a command like:
sudo chmod 664 /etc/hosts
This may vary depending on your platform / environment
A common cause of this on Windows is when LOCAL_SITES_PATH is in a different drive than where the homeboy command is being run. Since Windows must first change drives before cd'ing into the directory, you can use the "ACCESS_LOCAL_SITES_DIRECTORY_COMMAND" to overwrite how homeboy accesses this directory. For example:
ACCESS_LOCAL_SITES_DIRECTORY_COMMAND="cd /d D: && cd /Code"This message will be displayed when Homeboy is unable to cd into the proper vagrant directory when running vagrant commands. Please verify your "HOMESTEAD_BOX_PATH" value to ensure it is correct.
On Windows, if your HOMESTEAD_BOX_PATH is in a different drive than the drive you are running your homeboy command, you may need to add the "HOMESTEAD_ACCESS_DIRECTORY_COMMAND" to add any additional commands (such as switching drives) when accessing the directory. For example:
HOMESTEAD_ACCESS_DIRECTORY_COMMAND="cd /d D: && cd /Homestead"暂无开放 Issues,或尚未同步最近议题。