共计 1329 个字符,预计需要花费 4 分钟才能阅读完成。
开发中须要和前端或其余后端共事配合,须要间接拜访我本机开发环境
在 vagrant 文件夹中的 Vagrantfile 配置下即可:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exist? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
config.vm.provision "shell" do |s|
s.inline = "awk'{sub(\"\r$\", \"\"); print }'/tmp/bash_aliases > /home/vagrant/.bash_aliases && chown vagrant:vagrant /home/vagrant/.bash_aliases"
end
end
#公有拜访地址
config.vm.network "private_network", ip: "192.168.33.10"
if File.exist? homesteadYamlPath then
settings = YAML::load(File.read(homesteadYamlPath))
elsif File.exist? homesteadJsonPath then
settings = JSON::parse(File.read(homesteadJsonPath))
else
abort "Homestead settings file not found in #{confDir}"
end
Homestead.configure(config, settings)
if File.exist? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
end
if File.exist? customizationScriptPath then
config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
end
if Vagrant.has_plugin?('vagrant-hostsupdater')
config.hostsupdater.remove_on_suspend = false
config.hostsupdater.aliases = settings['sites'].map {|site| site['map'] }
elsif Vagrant.has_plugin?('vagrant-hostmanager')
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.aliases = settings['sites'].map {|site| site['map'] }
end
end
正文完