forked from gleicon/swarm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vagrantfile
62 lines (48 loc) · 1.5 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Place this Vagrantfile in your src folder and run:
#
# vagrant up
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Vagrantfile API/syntax version.
VAGRANTFILE_API_VERSION = "2"
# See https://code.google.com/p/go/downloads/list
GO_ARCHIVES = {
"linux" => "go1.2.linux-amd64.tar.gz",
}
INSTALL = {
"linux" => "apt-get update -qq; apt-get install -qq -y git mercurial bzr curl",
}
# location of the Vagrantfile
def src_path
File.dirname(__FILE__)
end
# shell script to bootstrap Go
def bootstrap(box)
install = INSTALL[box]
archive = GO_ARCHIVES[box]
profile = <<-PROFILE
export GOPATH=$HOME
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
export CDPATH=.:$GOPATH/src/github.com:$GOPATH/src/code.google.com/p:$GOPATH/src/bitbucket.org:$GOPATH/src/launchpad.net
PROFILE
<<-SCRIPT
#{install}
if ! [ -f /home/vagrant/#{archive} ]; then
response=$(curl -O# https://go.googlecode.com/files/#{archive})
fi
tar -C /usr/local -xzf #{archive}
echo '#{profile}' >> /home/vagrant/.profile
echo "\nRun: vagrant ssh #{box} -c 'cd project/path; go test ./...'"
SCRIPT
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "linux" do |linux|
linux.vm.box = "precise64"
linux.vm.box_url = "http://files.vagrantup.com/precise64.box"
linux.vm.provision :shell, :inline => bootstrap("linux")
end
end