|
| 1 | +require 'json' |
| 2 | +require 'yaml' |
| 3 | + |
| 4 | +VAGRANTFILE_API_VERSION ||= "2" |
| 5 | +confDir = $confDir ||= File.expand_path("./homestead", File.dirname(__FILE__)) |
| 6 | + |
| 7 | +homesteadYamlPath = "Homestead.yaml" |
| 8 | +homesteadJsonPath = "Homestead.json" |
| 9 | +afterScriptPath = "after.sh" |
| 10 | +aliasesPath = "aliases" |
| 11 | + |
| 12 | +require File.expand_path(confDir + '/scripts/homestead.rb') |
| 13 | + |
| 14 | +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| |
| 15 | + if File.exists? aliasesPath then |
| 16 | + config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases" |
| 17 | + end |
| 18 | + |
| 19 | + if File.exists? homesteadYamlPath then |
| 20 | + Homestead.configure(config, YAML::load(File.read(homesteadYamlPath))) |
| 21 | + elsif File.exists? homesteadJsonPath then |
| 22 | + Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath))) |
| 23 | + end |
| 24 | + |
| 25 | + if File.exists? afterScriptPath then |
| 26 | + config.vm.provision "shell", path: afterScriptPath |
| 27 | + end |
| 28 | +end |
0 commit comments