Skip to content

Instantly share code, notes, and snippets.

@joshuadegier
Created October 5, 2016 19:45
Show Gist options
  • Save joshuadegier/fe5e4e05beba56dd96ed1a315b5b12f7 to your computer and use it in GitHub Desktop.
Save joshuadegier/fe5e4e05beba56dd96ed1a315b5b12f7 to your computer and use it in GitHub Desktop.
Vagrant / Homestead activate GUI
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION = "2"
confDir = $confDir ||= File.expand_path("~/.homestead")
homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
aliasesPath = confDir + "/aliases"
require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exists? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
end
if File.exists? homesteadYamlPath then
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
elsif File.exists? homesteadJsonPath then
Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath)))
end
if File.exists? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath
end
config.vm.provider :virtualbox do |vb|
vb.gui = false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment