VirtualBox

Ticket #21387: vagrantfile.homestead.2.3.4

File vagrantfile.homestead.2.3.4, 2.4 KB (added by white-tiger, 21 months ago)

vagrant configuration file

Line 
1class VagrantPlugins::ProviderVirtualBox::Action::Network
2 def dhcp_server_matches_config?(dhcp_server, config)
3 true
4 end
5end
6# -*- mode: ruby -*-
7# vi: set ft=ruby :
8
9require 'json'
10require 'yaml'
11
12VAGRANTFILE_API_VERSION ||= "2"
13confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))
14
15homesteadYamlPath = confDir + "/Homestead.yaml"
16homesteadJsonPath = confDir + "/Homestead.json"
17afterScriptPath = confDir + "/after.sh"
18customizationScriptPath = confDir + "/user-customizations.sh"
19aliasesPath = confDir + "/aliases"
20
21require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')
22
23Vagrant.require_version '>= 2.3.4'
24
25Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
26 config.vm.box = "laravel/homestead"
27 config.vm.box_version = "11.3.0"
28 config.vm.provider "virtualbox" do |v|
29 v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
30 end
31 if File.exist? aliasesPath then
32 config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
33 config.vm.provision "shell" do |s|
34 s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases && chown vagrant:vagrant /home/vagrant/.bash_aliases"
35 end
36 end
37
38 if File.exist? homesteadYamlPath then
39 settings = YAML::load(File.read(homesteadYamlPath))
40 elsif File.exist? homesteadJsonPath then
41 settings = JSON::parse(File.read(homesteadJsonPath))
42 else
43 abort "Homestead settings file not found in #{confDir}"
44 end
45
46 Homestead.configure(config, settings)
47
48 if File.exist? afterScriptPath then
49 config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
50 end
51
52 if File.exist? customizationScriptPath then
53 config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
54 end
55
56 if Vagrant.has_plugin?('vagrant-hostsupdater')
57 config.hostsupdater.remove_on_suspend = false
58 config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
59 elsif Vagrant.has_plugin?('vagrant-hostmanager')
60 config.hostmanager.enabled = true
61 config.hostmanager.manage_host = true
62 config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
63 end
64
65 if Vagrant.has_plugin?('vagrant-notify-forwarder')
66 config.notify_forwarder.enable = true
67 end
68end

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy