forked from ggcov/ggcov
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
69 lines (54 loc) · 1.82 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
# Throw an error if required Vagrant plugins are not installed
unless Vagrant.has_plugin? 'vagrant-bindfs'
raise error "The 'vagrant-bindfs' plugin is not installed!"
end
platforms_dir = 'build/vagrant'
platforms = {}
# Read all the .yaml files in the platforms directory;
# each one defines a VM
Dir["#{platforms_dir}/*.yaml"].each do |filename|
name = File.basename(filename, ".yaml")
opts = YAML.load_file(filename)
# The yaml file can have either an inline 'script'
# entry or a 'script_file' entry which is a filename
# relative to the platforms dir
if opts['script_file']
e = Erubis::Eruby.new(File.read("#{platforms_dir}/#{opts['script_file']}"))
h = {}
opts.each_pair do |k,v|
h[k.intern] = v
end
opts['script'] = e.evaluate(h)
end
platforms[name] = opts
end
# puts "XXX platforms={"
# platforms.each_pair do |name, options|
# puts " #{name} => #{options}"
# end
# puts "}"
# exit 1
# Main Vagrant Init
Vagrant.configure(VAGRANTFILE_API_VERSION) do |global_config|
if Vagrant.has_plugin? 'vagrant-cachier'
global_config.cache.scope = :box
end
platforms.each_pair do |name, options|
global_config.vm.define name.intern do |config|
config.vm.provider "virtualbox" do |v|
v.name = "ggcov - #{name}"
v.gui = true
end
config.vm.box = options['box']
# Remove the default Vagrant directory sync
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", "/build/ggcov", type: "virtualbox", owner: "vagrant", group: "vagrant"
config.vm.hostname = name
config.vm.network "private_network", type: "dhcp"
config.vm.provision :shell, :inline => options['script']
end
end
end